(*                (c) Copyright, Bill Richter 2013                           *)
(*          Distributed under the same license as HOL Light                  *)
(*                                                                           *)
(* An ongoing readable.ml port of Multivariate/topology.ml with 3 features:  *)
(* 1) A topological space will be an ordered pair α = (X, L), where L is the *)
(* the set of open sets on X.  topology.ml defines a topological space to be *)
(* just L, and the topspace X is defined as UNIONS L.                        *)
(* 2) Result about Connectiveness, limit points, interior and closure  are   *)
(* first proved for general topological spaces and then specialized to       *)
(* Euclidean space.                                                          *)
(* 3)All general topology theorems using subtopology α u have antecedent     *)
(* u â topspace α.                                                           *)
(* The math character â is used for DIFF.                                    *)
(* This file, together with from_topology.ml, shows that all of              *)
(* Multivariate/topology.ml is either ported/modified here, or else run on   *)
(* top of this file.                                                         *)
(* Thanks to Vince Aravantinos for improving the proofs of OPEN_BALL,        *)
(* CONNECTED_OPEN_IN_EQ, CONNECTED_CLOSED_IN_EQ and INTERIOR_EQ.             *)
needs "RichterHilbertAxiomGeometry/readable.ml";;
needs "Multivariate/determinants.ml";;
ParseAsInfix("â",(11, "right"));;
let NOTIN = NewDefinition `;
  âa l. a â l â ¬(a â l)`;;
let DIFF_UNION = theorem `;
  âu s t.  u â (s ⪠t) = (u â s) â© (u â t)
  by set`;;
let DIFF_INTER = theorem `;
  âu s t.  u â (s â© t) = (u â s) ⪠(u â t)
  by set`;;
let DIFF_REFL = theorem `;
  âu t.  t â u â u â (u â t) = t
  by set`;;
let DIFF_SUBSET = theorem `;
  âu s t.  s â t  â  s â u â t â u
  by set`;;
let DOUBLE_DIFF_UNION = theorem `;
  âA s t. A â s â t = A â (s ⪠t)
  by set`;;
let SUBSET_COMPLEMENT = theorem `;
  âs t A.  s â A  â  (s â A â t â s â© t = â
)
  by set`;;
let COMPLEMENT_DISJOINT = theorem `;
  âA s t.  s â A  â  (s â t â s â© (A â t) = â
)
  by set`;;
let COMPLEMENT_DUALITY = theorem `;
  âA s t. s â A â§ t â A  â  (s = t â A â s = A â t)
  by set`;;
let COMPLEMENT_DUALITY_UNION = theorem `;
  âA s t.  s â A â§ t â A â§ u â A  â  (s = t ⪠u â A â s = (A â t) â© (A â u))
  by set`;;
let SUBSET_DUALITY = theorem `;
  âs t u.  t â u  â  s â u â s â t
  by set`;;
let COMPLEMENT_INTER_DIFF = theorem `;
  âA s t. s â A  â  s â t = s â© (A â t)
  by set`;;
let INTERS_SUBSET = theorem `;
  âf t. ¬(f = â
) â§ (âs. s â f â s â t)  â  INTERS f â t
  by set`;;
let IN_SET_FUNCTION_PREDICATE = theorem `;
  âx f P. x â {f y | P y}  â  ây. x = f y â§ P y
  by set`;;
let INTER_TENSOR = theorem `;
  âs s' t t'.  s â s' â§ t â t'  â  s â© t â s' â© t'
  by set`;;
let UNION_TENSOR = theorem `;
  âs s' t t'.  s â s' â§ t â t'  â  s ⪠t â s' ⪠t'
  by set`;;
let ExistsTensorInter = theorem `;
  âF G H.  (âx y. F x â§ G y  â H (x â© y))  â
    (âx. F x) â§ (ây. G y) â (âz. H z)
  by fol`;;
let istopology = NewDefinition `;
  istopology (X, L)  â
  (âU. U â L  â  U â X)  â§  â
 â L  â§  X â L  â§
  (âs t. s â L â§ t â L  â s â© t â L)  â§ âk. k â L  â  UNIONS k â L`;;
let UnderlyingSpace = NewDefinition `;
  UnderlyingSpace α = FST α`;;
let OpenSets = NewDefinition `;
  OpenSets α = SND α`;;
let ExistsTopology = theorem `;
  âX. âα. istopology α  â§  UnderlyingSpace α = X
  proof
    intro_TAC âX;
    consider L such that L = {U | U â X}     [Lexists] by fol;
    exists_TAC (X, L);
    rewrite istopology IN_ELIM_THM Lexists UnderlyingSpace;
    set;
  qed;
`;;
let topology_tybij_th = theorem `;
  ât. istopology t
  by fol ExistsTopology`;;
let topology_tybij =
  new_type_definition "topology" ("mk_topology","dest_topology")
  topology_tybij_th;;
let ISTOPOLOGYdest_topology = theorem `;
  âα. istopology (dest_topology α)
  by fol topology_tybij`;;
let OpenIn = NewDefinition `;
  âα. open_in α = OpenSets (dest_topology α)`;;
let topspace = NewDefinition `;
  âα. topspace α = UnderlyingSpace (dest_topology  α)`;;
let TopologyPAIR = theorem `;
  âα.  dest_topology α = (topspace α, open_in α)
  by rewrite PAIR_EQ OpenIn topspace UnderlyingSpace OpenSets`;;
let Topology_Eq = theorem `;
  âα β.  topspace α =  topspace β  â§  (âU. open_in α U â open_in β U)
    â α = β
  proof
    intro_TAC âα β;
    eq_tac     [Right] by fol;
    intro_TAC H1 H2;
    dest_topology α = dest_topology β     [] by simplify TopologyPAIR PAIR_EQ H1 H2 FUN_EQ_THM;
    fol - topology_tybij;
  qed;
`;;
let OpenInCLAUSES = theorem `;
  âα X. topspace α = X  â
    (âU. open_in α U  â  U â X)  â§  open_in α â
  â§  open_in α X  â§
    (âs t. open_in α s â§ open_in α t  â open_in α (s â© t))  â§
    âk. (âs. s â k â open_in α s)  â  open_in α (UNIONS k)
  proof
    intro_TAC âα X, H1;
    consider L such that L = open_in α     [Ldef] by fol;
    istopology (X, L)     [] by fol H1 Ldef TopologyPAIR PAIR_EQ ISTOPOLOGYdest_topology;
    fol Ldef - istopology IN SUBSET;
  qed;
`;;
let OPEN_IN_SUBSET = theorem `;
  âα s.  open_in α s  â  s â topspace α
  by fol OpenInCLAUSES`;;
let OPEN_IN_EMPTY = theorem `;
  âα. open_in α â
  by fol OpenInCLAUSES`;;
let OPEN_IN_INTER = theorem `;
  âα s t. open_in α s â§ open_in α t  â  open_in α (s â© t)
  by fol OpenInCLAUSES`;;
let OPEN_IN_UNIONS = theorem `;
  âα k. (âs. s â k â open_in α s)  â  open_in α (UNIONS k)
  by fol OpenInCLAUSES`;;
let OpenInTopspace = theorem `;
  âα.  open_in α (topspace α)
  by fol OpenInCLAUSES`;;
let OPEN_IN_UNION = theorem `;
  âα s t. open_in α s â§ open_in α t  â  open_in α (s ⪠t)
  proof
    intro_TAC âα s t, H;
    âx. x â {s, t} â x = s ⨠x = t     [] by fol IN_INSERT NOT_IN_EMPTY;
    fol - UNIONS_2 H OPEN_IN_UNIONS;
  qed;
`;;
let OPEN_IN_TOPSPACE = theorem `;
  âα. open_in α (topspace α)
  by fol OpenInCLAUSES`;;
let OPEN_IN_INTERS = theorem `;
  âα s. FINITE s ⧠¬(s = â
) â§ (ât. t â s  â  open_in α t)
    â open_in α (INTERS s)
  proof
    intro_TAC âα;
    rewrite IMP_CONJ;
    MATCH_MP_TAC FINITE_INDUCT;
    rewrite INTERS_INSERT NOT_INSERT_EMPTY FORALL_IN_INSERT;
    intro_TAC âx s, H1, xWorks sWorks;
    assume ¬(s = â
)     [Nonempty] by simplify INTERS_0 INTER_UNIV xWorks;
    fol xWorks Nonempty H1 sWorks OPEN_IN_INTER;
  qed;
`;;
let OPEN_IN_SUBOPEN = theorem `;
  âα s.  open_in α s â âx. x â s â ât. open_in α t â§ x â t â§ t â s
  proof
    intro_TAC âα s;
    eq_tac     [Left] by set;
    intro_TAC ALLtExist;
    consider f such that
    âx. x â s  â  open_in α (f x) â§ x â f x â§ f x â s     [fExists] by fol ALLtExist SKOLEM_THM_GEN;
    s = UNIONS (IMAGE f s)     [] by set -;
    fol - fExists FORALL_IN_IMAGE OPEN_IN_UNIONS;
  qed;
`;;
let closed_in = NewDefinition `;
  âα s.  closed_in α s  â
      s â topspace α â§ open_in α (topspace α â s)`;;
let CLOSED_IN_SUBSET = theorem `;
  âα s. closed_in α s   â  s â topspace α
  by fol closed_in`;;
let CLOSED_IN_EMPTY = theorem `;
  âα. closed_in α â
  by fol closed_in EMPTY_SUBSET DIFF_EMPTY OPEN_IN_TOPSPACE`;;
let CLOSED_IN_TOPSPACE = theorem `;
  âα. closed_in α (topspace α)
  by fol closed_in SUBSET_REFL DIFF_EQ_EMPTY OPEN_IN_EMPTY`;;
let CLOSED_IN_UNION = theorem `;
  âα s t. closed_in α s â§ closed_in α t  â  closed_in α (s ⪠t)
  proof
    intro_TAC âα s t, Hst;
    fol Hst closed_in DIFF_UNION UNION_SUBSET OPEN_IN_INTER;
  qed;
`;;
let CLOSED_IN_INTERS = theorem `;
  âα k.  ¬(k = â
) â§ (âs. s â k â closed_in α s)  â  closed_in α (INTERS k)
  proof
    intro_TAC âα k, H1 H2;
    consider X such that X = topspace α     [Xdef] by fol;
    simplify GSYM Xdef closed_in DIFF_INTERS SIMPLE_IMAGE;
    fol H1 H2 Xdef INTERS_SUBSET closed_in FORALL_IN_IMAGE OPEN_IN_UNIONS;
  qed;
`;;
let CLOSED_IN_FORALL_IN = theorem `;
  âα P Q.  ¬(P = â
) â§ (âa. P a â closed_in α {x | Q a x})  â
    closed_in α {x | âa. P a â Q a x}
  proof
    intro_TAC âα P Q, Pnonempty H1;
    consider f such that f = {{x | Q a x} | P a}     [fDef] by fol;
    ¬(f = â
)     [fNonempty] by set fDef Pnonempty;
    (âa. P a â closed_in α {x | Q a x})  â  (âs. s â f â closed_in α s)     [] by simplify fDef FORALL_IN_GSPEC;
    closed_in α (INTERS f)     [] by fol fNonempty H1 - CLOSED_IN_INTERS;
    MP_TAC -;
    {x | âa. P a â x â {x | Q a x}} = {x | âa. P a â Q a x}     [] by set;
    simplify fDef INTERS_GSPEC -;
  qed;
`;;
let CLOSED_IN_INTER = theorem `;
  âα s t. closed_in α s â§ closed_in α t â closed_in α (s â© t)
  proof
    intro_TAC âα s t, Hs Ht;
    rewrite GSYM INTERS_2;
    MATCH_MP_TAC CLOSED_IN_INTERS;
    set Hs Ht;
  qed;
`;;
let OPEN_IN_CLOSED_IN_EQ = theorem `;
  âα s. open_in α s  â  s â topspace α â§ closed_in α (topspace α â s)
  proof
    intro_TAC âα s;
    simplify closed_in SUBSET_DIFF OPEN_IN_SUBSET;
    fol SET_RULE [X â (X â s) = X â© s  â§  (s â X â X â© s = s)] OPEN_IN_SUBSET;
  qed;
`;;
let OPEN_IN_CLOSED_IN = theorem `;
  âs. s â topspace α
    â (open_in α s â closed_in α (topspace α â s))
  by fol OPEN_IN_CLOSED_IN_EQ`;;
let OPEN_IN_DIFF = theorem `;
  âα s t.  open_in α s â§ closed_in α t  â  open_in α (s â t)
  proof
    intro_TAC âα s t, H1 H2;
    consider X such that X = topspace α     [Xdef] by fol;
    fol COMPLEMENT_INTER_DIFF OPEN_IN_SUBSET - H1 H2 closed_in OPEN_IN_INTER;
  qed;
`;;
let CLOSED_IN_DIFF = theorem `;
  âα s t.  closed_in α s â§ open_in α t  â  closed_in α (s â t)
  proof
    intro_TAC âα s t, H1 H2;
    consider X such that X = topspace α     [Xdef] by fol;
    fol COMPLEMENT_INTER_DIFF H1 - OPEN_IN_SUBSET SUBSET_DIFF DIFF_REFL H2 closed_in CLOSED_IN_INTER;
  qed;
`;;
let CLOSED_IN_UNIONS = theorem `;
  âα s.  FINITE s â§ (ât. t â s â closed_in α t)
    â closed_in α (UNIONS s)
  proof
    intro_TAC âα;
    rewrite IMP_CONJ;
    MATCH_MP_TAC FINITE_INDUCT;
    fol UNIONS_INSERT UNIONS_0 CLOSED_IN_EMPTY IN_INSERT CLOSED_IN_UNION;
  qed;
`;;
let subtopology = NewDefinition `;
  âα u.  subtopology α u = mk_topology (u, {s â© u | open_in α s})`;;
let IstopologySubtopology = theorem `;
  âα u:A->bool. u â topspace α  â  istopology (u, {s â© u | open_in α s})
  proof
    intro_TAC âα u, H1;
    â
 = â
 â© u â§ open_in α â
     [emptysetOpen] by fol INTER_EMPTY OPEN_IN_EMPTY;
    u = topspace α ⩠u ⧠open_in α (topspace α)     [uOpen] by fol OPEN_IN_TOPSPACE H1 INTER_COMM SUBSET_INTER_ABSORPTION;
    âs' s. open_in α s' â§ open_in α s  â  open_in α (s' â© s)  â§
    (s' â© u) â© (s â© u) = (s' â© s) â© u     [interOpen]
    proof
      intro_TAC âs' s, H1 H2;
      set MESON [H1; H2; OPEN_IN_INTER] [open_in α (s' ⩠s)];
    qed;
    âk. k â {s | open_in α s}  â  open_in α (UNIONS k)  â§
    UNIONS (IMAGE (λs. s ⩠u) k) = (UNIONS k) ⩠u     [unionsOpen]
    proof
      intro_TAC âk, kProp;
      open_in α (UNIONS k)     [] by fol kProp SUBSET IN_ELIM_THM OPEN_IN_UNIONS;
      simplify - UNIONS_IMAGE UNIONS_GSPEC INTER_UNIONS;
    qed;
    {s ⩠u | open_in α s} = IMAGE (λs. s ⩠u) {s | open_in α s}     [] by set;
    simplify istopology IN_SET_FUNCTION_PREDICATE LEFT_IMP_EXISTS_THM INTER_SUBSET - FORALL_SUBSET_IMAGE;
    fol  emptysetOpen uOpen interOpen unionsOpen;
  qed;
`;;
let OpenInSubtopology = theorem `;
  âα u s. u â topspace α â
    (open_in (subtopology α u) s  â  ât. open_in α t â§ s = t â© u)
  proof
    intro_TAC âα u s, H1;
    open_in (subtopology α u) = OpenSets (u,{s ⩠u | open_in α s})     [] by fol subtopology H1 IstopologySubtopology topology_tybij OpenIn;
    rewrite - OpenSets PAIR_EQ SND EXTENSION IN_ELIM_THM;
  qed;
`;;
let TopspaceSubtopology = theorem `;
  âα u. u â topspace α  â  topspace (subtopology α u) = u
  proof
    intro_TAC âα u , H1;
    topspace (subtopology α u) = UnderlyingSpace (u,{s ⩠u | open_in α s})     [] by fol subtopology H1 IstopologySubtopology topology_tybij topspace;
    rewrite - UnderlyingSpace PAIR_EQ FST;
    fol  INTER_COMM H1 SUBSET_INTER_ABSORPTION;
  qed;
`;;
let OpenInRefl = theorem `;
  âα s.  s â topspace α  â  open_in (subtopology α s) s
  by fol TopspaceSubtopology OPEN_IN_TOPSPACE`;;
let ClosedInRefl = theorem `;
  âα s.  s â topspace α  â  closed_in (subtopology α s) s
  by fol TopspaceSubtopology CLOSED_IN_TOPSPACE`;;
let ClosedInSubtopology = theorem `;
  âα u C.  u â topspace α  â
    (closed_in (subtopology α u) C  â  âD. closed_in α D â§ C = D â© u)
  proof
    intro_TAC âα u C, H1;
    consider X such that
    X = topspace α â§ u â X     [Xdef] by fol H1;
    closed_in (subtopology α u) C  â
    ât. C â u â§ t â X â§ open_in α t â§ u â C = t â© u     [] by fol closed_in H1 Xdef OpenInSubtopology OPEN_IN_SUBSET TopspaceSubtopology;
    closed_in (subtopology α u) C  â
    âD. C â u â§ D â X â§ open_in α (X â D) â§ u â C = (X â D) â© u     []
    proof
      rewrite -;
      eq_tac     [Left]
      proof
        STRIP_TAC;     exists_TAC X â t;
        ASM_SIMP_TAC H1 OPEN_IN_SUBSET DIFF_REFL SUBSET_DIFF;
      qed;
      STRIP_TAC;     exists_TAC X â D;
      ASM_SIMP_TAC SUBSET_DIFF;
    qed;
    simplify - GSYM Xdef H1 closed_in;
    âD C. C â u â§ u â C = (X â D) â© u  â  C = D â© u     [] by set Xdef DIFF_REFL INTER_SUBSET;
    fol -;
  qed;
`;;
let OPEN_IN_SUBTOPOLOGY_EMPTY = theorem `;
  âα s. open_in (subtopology α â
) s  â  s = â
  proof
    simplify EMPTY_SUBSET OpenInSubtopology INTER_EMPTY;
    fol  OPEN_IN_EMPTY;
  qed;
`;;
let CLOSED_IN_SUBTOPOLOGY_EMPTY = theorem `;
  âα s. closed_in (subtopology α â
) s  â  s = â
  proof
    simplify EMPTY_SUBSET ClosedInSubtopology INTER_EMPTY;
    fol  CLOSED_IN_EMPTY;
  qed;
`;;
let SUBTOPOLOGY_TOPSPACE = theorem `;
  âα. subtopology α (topspace α) = α
  proof
    intro_TAC âα;
    topspace (subtopology α (topspace α)) = topspace α     [topXsub] by simplify SUBSET_REFL TopspaceSubtopology;
    simplify topXsub GSYM Topology_Eq;
    fol MESON [SUBSET_REFL] [topspace α â topspace α] OpenInSubtopology OPEN_IN_SUBSET SUBSET_INTER_ABSORPTION;
  qed;
`;;
let OpenInImpSubset = theorem `;
  âα s t.  s â topspace α  â
    open_in (subtopology α s) t  â  t â s
  by fol OpenInSubtopology INTER_SUBSET`;;
let ClosedInImpSubset = theorem `;
  âα s t.  s â topspace α  â
    closed_in (subtopology α s) t  â  t â s
  by fol ClosedInSubtopology INTER_SUBSET`;;
let OpenInSubtopologyUnion = theorem `;
  âα s t u.  t â topspace α  â§  u â topspace α  â
    open_in (subtopology α t) s  ⧠ open_in (subtopology α u) s
    â  open_in (subtopology α (t ⪠u)) s
  proof
    intro_TAC âα s t u, Ht Hu;
    simplify Ht Hu Ht Hu UNION_SUBSET OpenInSubtopology;
    intro_TAC sOpenSub_t sOpenSub_u;
    consider a b such that
    open_in α a  â§  s = a â© t  â§
    open_in α b  ⧠ s = b ⩠u     [abExist] by fol sOpenSub_t sOpenSub_u;
    exists_TAC a â© b;
    set MESON [abExist; OPEN_IN_INTER] [open_in α (a ⩠b)] abExist;
  qed;
`;;
let ClosedInSubtopologyUnion = theorem `;
  âα s t u.  t â topspace α  â§  u â topspace α  â
    closed_in (subtopology α t) s  ⧠ closed_in (subtopology α u) s
    â  closed_in (subtopology α (t ⪠u)) s
  proof
    intro_TAC âα s t u, Ht Hu;
    simplify Ht Hu Ht Hu UNION_SUBSET ClosedInSubtopology;
    intro_TAC sClosedSub_t sClosedSub_u;
    consider a b such that
    closed_in α a  â§  s = a â© t  â§
    closed_in α b  ⧠ s = b ⩠u     [abExist] by fol sClosedSub_t sClosedSub_u;
    exists_TAC a â© b;
    set MESON [abExist; CLOSED_IN_INTER] [closed_in α (a ⩠b)] abExist;
  qed;
`;;
let OpenInSubtopologyInterOpen = theorem `;
  âα s t u.  u â topspace α  â
    open_in (subtopology α u) s  ⧠ open_in α t
    â open_in (subtopology α u) (s â© t)
  proof
    intro_TAC âα s t u, H1, sOpenSub_t tOpen;
    consider a b such that
    open_in α a  ⧠ s = a ⩠u  ⧠ b = a ⩠t     [aExists] by fol sOpenSub_t H1 OpenInSubtopology;
    fol - tOpen OPEN_IN_INTER INTER_ACI H1 OpenInSubtopology;
  qed;
`;;
let OpenInOpenInter = theorem `;
  âα u s.  u â topspace α  â open_in α s
    â  open_in (subtopology α u) (u â© s)
  by fol INTER_COMM OpenInSubtopology`;;
let OpenOpenInTrans = theorem `;
  âα s t.  open_in α s â§ open_in α t â§ t â s
    â open_in (subtopology α s) t
  by fol OPEN_IN_SUBSET SUBSET_INTER_ABSORPTION OpenInSubtopology`;;
let ClosedClosedInTrans = theorem `;
  âα s t.  closed_in α s â§ closed_in α t â§ t â s
    â closed_in (subtopology α s) t
  by fol CLOSED_IN_SUBSET SUBSET_INTER_ABSORPTION ClosedInSubtopology`;;
let OpenSubset = theorem `;
  âα s t.  t â topspace α  â
    s â t  â§  open_in α s â open_in (subtopology α t) s
  by fol OpenInSubtopology SUBSET_INTER_ABSORPTION`;;
let ClosedSubsetEq = theorem `;
  âα u s.  u â topspace α  â
    closed_in α s  â  (closed_in (subtopology α u) s  â  s â u)
  by fol ClosedInSubtopology INTER_SUBSET SUBSET_INTER_ABSORPTION`;;
let ClosedInInterClosed = theorem `;
  âα s t u.  u â topspace α  â
        closed_in (subtopology α u) s ⧠closed_in α t
        â closed_in (subtopology α u) (s â© t)
  proof
    intro_TAC âα s t u, H1, sClosedSub_t tClosed;
    consider a b such that
    closed_in α a  ⧠ s = a ⩠u  ⧠ b = a ⩠t     [aExists] by fol sClosedSub_t H1 ClosedInSubtopology;
    fol - tClosed CLOSED_IN_INTER INTER_ACI H1 ClosedInSubtopology;
  qed;
`;;
let ClosedInClosedInter = theorem `;
  âα u s.  u â topspace α  â
    closed_in α s  â  closed_in (subtopology α u) (u â© s)
  by fol INTER_COMM ClosedInSubtopology`;;
let ClosedSubset = theorem `;
  âα s t.  t â topspace α  â
    s â t  â§  closed_in α s  â  closed_in (subtopology α t) s
  by fol ClosedInSubtopology SUBSET_INTER_ABSORPTION`;;
let OpenInSubsetTrans = theorem `;
  âα s t u.  u â topspace α  â§  t â topspace α  â
    open_in (subtopology α u) s  â§  s â t  â§  t â u
    â open_in (subtopology α t) s
  proof
    intro_TAC âα s t u, uSubset tSubset;
    simplify uSubset tSubset OpenInSubtopology;
    intro_TAC sOpen_u s_t t_u;
    consider a such that
    open_in α a  ⧠ s = a ⩠u     [aExists] by fol uSubset sOpen_u OpenInSubtopology;
    set aExists s_t t_u;
  qed;
`;;
let ClosedInSubsetTrans = theorem `;
  âα s t u.  u â topspace α  â§  t â topspace α  â
        closed_in (subtopology α u) s  â§  s â t  â§  t â u
        â closed_in (subtopology α t) s
  proof
    intro_TAC âα s t u, uSubset tSubset;
    simplify uSubset tSubset ClosedInSubtopology;
    intro_TAC sClosed_u s_t t_u;
    consider a such that
    closed_in α a  ⧠ s = a ⩠u     [aExists] by fol uSubset sClosed_u ClosedInSubtopology;
    set aExists s_t t_u;
  qed;
`;;
let OpenInTrans = theorem `;
  âα s t u.  t â topspace α  â§  u â topspace α  â
    open_in (subtopology α t) s   ⧠ open_in (subtopology α u) t
    â open_in (subtopology α u) s
  proof
    intro_TAC âα s t u, H1 H2;
    simplify H1 H2 OpenInSubtopology;
    fol H1 H2 OpenInSubtopology OPEN_IN_INTER INTER_ASSOC;
  qed;
`;;
let OpenInTransEq = theorem `;
  âα s t.  t â topspace α  â§  s â topspace α  â
    ((âu. open_in (subtopology α t) u  â  open_in (subtopology α s) t)
    â open_in (subtopology α s) t)
  by fol OpenInTrans OpenInRefl`;;
let OpenInOpenTrans = theorem `;
  âα u s.  u â topspace α  â
    open_in (subtopology α u) s â§ open_in α u  â  open_in α s
  by fol OpenInSubtopology OPEN_IN_INTER`;;
let OpenInSubtopologyTrans = theorem `;
  âα s t u.  t â topspace α  â§  u â topspace α  â
    open_in (subtopology α t) s  ⧠ open_in (subtopology α u) t
    â open_in (subtopology α u) s
  proof
    simplify OpenInSubtopology;
    fol  OPEN_IN_INTER INTER_ASSOC;
  qed;
`;;
let SubtopologyOpenInSubopen = theorem `;
  âα u s.  u â topspace α â
    (open_in (subtopology α u) s  â
    s â u  â§  âx. x â s â ât. open_in α t  â§  x â t  â§  t â© u â s)
  proof
    intro_TAC âα u s, H1;
    rewriteL OPEN_IN_SUBOPEN;
    simplify H1 OpenInSubtopology;
    eq_tac     [Right] by fol SUBSET IN_INTER;
    intro_TAC H2;
    conj_tac     [Left]
    proof     simplify SUBSET;     fol H2 IN_INTER;     qed;
    intro_TAC âx, xs;
    consider t such that
    open_in α t â§ x â t â© u â§ t â© u â s     [tExists] by fol H2 xs;
    fol  - IN_INTER;
  qed;
`;;
let ClosedInSubtopologyTrans = theorem `;
  âα s t u.  t â topspace α  â§  u â topspace α  â
    closed_in (subtopology α t) s  ⧠ closed_in (subtopology α u) t
    â closed_in (subtopology α u) s
  proof
    simplify ClosedInSubtopology;
    fol  CLOSED_IN_INTER INTER_ASSOC;
  qed;
`;;
let ClosedInSubtopologyTransEq = theorem `;
  âα s t.  t â topspace α  â§  s â topspace α  â
    ((âu. closed_in (subtopology α t) u  â  closed_in (subtopology α s) t)
    â closed_in (subtopology α s) t)
  proof
    intro_TAC âα s t, H1 H2;
    fol H1 H2 ClosedInSubtopologyTrans CLOSED_IN_TOPSPACE;
  qed;
`;;
let ClosedInClosedTrans = theorem `;
  âα s t.  u â topspace α  â
    closed_in (subtopology α u) s â§ closed_in α u â closed_in α s
  by fol ClosedInSubtopology CLOSED_IN_INTER`;;
let OpenInSubtopologyInterSubset = theorem `;
  âα s u v.  u â topspace α  â§  v â topspace α  â
    open_in (subtopology α u) (u â© s)  â§  v â u
    â open_in (subtopology α v) (v â© s)
  proof
    simplify OpenInSubtopology;
    set;
  qed;
`;;
let OpenInOpenEq = theorem `;
  âα s t.  s â topspace α  â
    open_in α s  â  (open_in (subtopology α s) t  â  open_in α t â§ t â s)
  by fol OpenOpenInTrans OPEN_IN_SUBSET TopspaceSubtopology OpenInOpenTrans`;;
let ClosedInClosedEq = theorem `;
  âα s t.  s â topspace α  â  closed_in α s  â
    (closed_in (subtopology α s) t  â  closed_in α t â§ t â s)
  by fol ClosedClosedInTrans CLOSED_IN_SUBSET TopspaceSubtopology ClosedInClosedTrans`;;
let OpenImpliesSubtopologyInterOpen = theorem `;
  âα u s.  u â topspace α  â
    open_in α s  â  open_in (subtopology α u) (u â© s)
    by fol OpenInSubtopology INTER_COMM`;;
let OPEN_IN_EXISTS_IN = theorem `;
  âα P Q.  (âa. P a â open_in α {x | Q a x})  â
    open_in α {x | âa. P a â§ Q a x}
  proof
    intro_TAC âα P Q, H1;
    consider f such that f = {{x | Q a x} | P a}     [fDef] by fol;
    (âa. P a â open_in α {x | Q a x})  â  (âs. s â f â open_in α s)     [] by simplify fDef FORALL_IN_GSPEC;
    MP_TAC MESON [H1; -; OPEN_IN_UNIONS] [open_in α  (UNIONS f)];
    simplify fDef UNIONS_GSPEC;
    set;
  qed;
`;;
let Connected_DEF = NewDefinition `;
  âα. Connected α â
    ¬(âe1 e2. open_in α e1  â§  open_in α e2  â§  topspace α = e1 ⪠e2  â§
    e1 â© e2 = â
  â§  ¬(e1 = â
)  â§  ¬(e2 = â
))`;;
let ConnectedClosedHelp = theorem `;
  âα e1 e2. topspace α = e1 ⪠e2  â§  e1 â© e2 = â
  â
    (closed_in α e1  â§  closed_in α e2  â  open_in α e1  â§  open_in α e2)
  proof
    intro_TAC âα e1 e2, H1 H2;
    e1 = topspace α â e2  â§  e2 = topspace α â e1     [e12Complements] by set H1 H2;
    fol H1 SUBSET_UNION e12Complements OPEN_IN_CLOSED_IN_EQ;
  qed;
`;;
let ConnectedClosed = theorem `;
  âα. Connected α  â
    ¬(âe1 e2. closed_in α e1  â§  closed_in α e2  â§
    topspace α = e1 ⪠e2  â§  e1 â© e2 = â
  â§  ¬(e1 = â
) ⧠¬(e2 = â
))
  proof
    rewrite Connected_DEF;
    fol ConnectedClosedHelp;
  qed;
`;;
let ConnectedOpenIn = theorem `;
  âα s.  s â topspace α  â
    (Connected (subtopology α s)  â  Â¬(âe1 e2.
    open_in (subtopology α s) e1  â§  open_in (subtopology α s) e2  â§
    s â e1 ⪠e2  â§  e1 â© e2 = â
  â§  ¬(e1 = â
)  â§  ¬(e2 = â
)))
  proof
    simplify Connected_DEF TopspaceSubtopology;
    fol SUBSET_REFL OpenInImpSubset UNION_SUBSET SUBSET_ANTISYM;
  qed;
`;;
let ConnectedClosedIn = theorem `;
  âα s.  s â topspace α  â
    (Connected (subtopology α s)  â  Â¬(âe1 e2.
    closed_in (subtopology α s) e1  â§  closed_in (subtopology α s) e2  â§
    s â e1 ⪠e2  â§  e1 â© e2 = â
  â§  ¬(e1 = â
)  â§  ¬(e2 = â
)))
  proof
    simplify ConnectedClosed TopspaceSubtopology;
    fol SUBSET_REFL ClosedInImpSubset UNION_SUBSET SUBSET_ANTISYM;
  qed;
`;;
let ConnectedSubtopology = theorem `;
  âα s. s â topspace α  â
    (Connected (subtopology α s)  â
    ¬(âe1 e2. open_in α e1  â§  open_in α e2  â§  s â e1 ⪠e2  â§
    e1 â© e2 â© s = â
  â§  ¬(e1 â© s = â
)  â§  ¬(e2 â© s = â
)))
  proof
    intro_TAC âα s, H1;
    simplify H1 Connected_DEF OpenInSubtopology TopspaceSubtopology;
    AP_TERM_TAC;
    eq_tac     [Left]
    proof
    intro_TAC H2;
    consider t1 t2 such that
    open_in α t1  â§  open_in α t2  â§  s = (t1 â© s) ⪠(t2 â© s)  â§
    (t1 â© s) â© (t2 â© s) = â
  â§  ¬(t1 â© s = â
)  â§  ¬(t2 â© s = â
)     [t12Exist] by fol H2;
    s â t1 ⪠t2  â§  t1 â© t2 â© s = â
     [] by set t12Exist;
    fol t12Exist -;
    qed;
    rewrite LEFT_IMP_EXISTS_THM;
    intro_TAC âe1 e2, e12Exist;
    exists_TAC e1 â© s;
    exists_TAC e2 â© s;
    set e12Exist;
  qed;
`;;
let ConnectedSubtopology_ALT = theorem `;
  âα s. s â topspace α  â
    (Connected (subtopology α s)  â
    âe1 e2. open_in α e1  â§  open_in α e2  â§
    s â e1 ⪠e2  â§  e1 â© e2 â© s = â
    â e1 â© s = â
  ⨠ e2 â© s = â
)
  proof     simplify ConnectedSubtopology;     fol;     qed;
`;;
let ConnectedClosedSubtopology = theorem `;
  âα s. s â topspace α  â
    (Connected (subtopology α s)  â
    ¬(âe1 e2. closed_in α e1  â§  closed_in α e2  â§  s â e1 ⪠e2  â§
    e1 â© e2 â© s = â
  â§  ¬(e1 â© s = â
)  â§  ¬(e2 â© s = â
)))
  proof
    intro_TAC âα s, H1;
    simplify H1 ConnectedSubtopology;
    AP_TERM_TAC;
    eq_tac     [Left]
    proof
      rewrite LEFT_IMP_EXISTS_THM;
      intro_TAC âe1 e2, e12Exist;
      exists_TAC topspace α â e2;
      exists_TAC topspace α â e1;
      simplify OPEN_IN_SUBSET H1 SUBSET_DIFF DIFF_REFL closed_in e12Exist;
      set H1 e12Exist;
    qed;
    rewrite LEFT_IMP_EXISTS_THM;
    intro_TAC âe1 e2, e12Exist;
    exists_TAC topspace α â e2;
    exists_TAC topspace α â e1;
    e1 â topspace α  â§  e2 â topspace α     [e12Top] by fol closed_in e12Exist;
    simplify DIFF_REFL SUBSET_DIFF e12Top OPEN_IN_CLOSED_IN;
    set H1 e12Exist;
  qed;
`;;
let ConnectedClosedSubtopology_ALT = theorem `;
  âα s. s â topspace α  â
    (Connected (subtopology α s)  â
    âe1 e2. closed_in α e1  â§  closed_in α e2  â§
    s â e1 ⪠e2  â§  e1 â© e2 â© s = â
     â e1 â© s = â
  ⨠ e2 â© s = â
)
  proof     simplify ConnectedClosedSubtopology;     fol;     qed;
`;;
let ConnectedClopen = theorem `;
  âα. Connected α  â
    ât. open_in α t â§ closed_in α t  â  t = â
 ⨠t = topspace α
  proof
    intro_TAC âα;
    simplify Connected_DEF closed_in TAUT [(¬a â b) â (a â ¬b)] NOT_FORALL_THM NOT_IMP DE_MORGAN_THM;
    eq_tac     [Left]
    proof
      rewrite LEFT_IMP_EXISTS_THM;     intro_TAC âe1 e2, H1 H2 H3 H4 H5 H6;
      exists_TAC e1;
      e1 â topspace α  â§  e2 = topspace α â e1  â§  ¬(e1 = topspace alpha)     [] by set H3 H4 H6;
      fol H1 - H2 H5;
    qed;
    rewrite LEFT_IMP_EXISTS_THM;     intro_TAC ât, H1;
    exists_TAC t;     exists_TAC topspace α â t;
    set H1;
  qed;
`;;
let ConnectedClosedSet = theorem `;
  âα s. s â topspace α  â  closed_in α s  â
    (Connected (subtopology α s)  â  Â¬(âe1 e2.
    closed_in α e1  â§  closed_in α e2  â§
    ¬(e1 = â
)  â§  ¬(e2 = â
)  â§  e1 ⪠e2 = s  â§  e1 â© e2 = â
))
  proof
    intro_TAC âα s, H1, H2;
    simplify H1 ConnectedClosedSubtopology;
    AP_TERM_TAC;
    eq_tac     [Left]
    proof
      rewrite LEFT_IMP_EXISTS_THM;     intro_TAC âe1 e2, H3 H4 H5 H6 H7 H8;
      exists_TAC e1 â© s;     exists_TAC e2 â© s;
      simplify H2 H3 H4 H7 H8 CLOSED_IN_INTER;
      set H5 H6;
    qed;
    rewrite LEFT_IMP_EXISTS_THM;     intro_TAC âe1 e2, H3 H4 H5 H6 H7 H8;
    exists_TAC e1;     exists_TAC e2;
    set H3 H4 H7 H8 H5 H6;
  qed;
`;;
let ConnectedOpenSet = theorem `;
  âα s.  open_in α s  â
    (Connected (subtopology α s) â
    ¬(âe1 e2.  open_in α e1  â§  open_in α e2  â§
    ¬(e1 = â
)  â§  ¬(e2 = â
)  â§  e1 ⪠e2 = s  â§  e1 â© e2 = â
))
  proof
    intro_TAC âα s, H1;
    simplify H1 OPEN_IN_SUBSET ConnectedSubtopology;
    AP_TERM_TAC;
    eq_tac     [Left]
    proof
      rewrite LEFT_IMP_EXISTS_THM;     intro_TAC âe1 e2, H3 H4 H5 H6 H7 H8;
      exists_TAC e1 â© s;     exists_TAC e2 â© s;
      e1 â topspace α  â§  e2 â topspace α     [e12Subsets] by fol H3 H4 OPEN_IN_SUBSET;
      simplify H1 H3 H4 OPEN_IN_INTER H7 H8;
      set e12Subsets H5 H6;
    qed;
    rewrite LEFT_IMP_EXISTS_THM;     intro_TAC âe1 e2, H3 H4 H5 H6 H7 H8;
    exists_TAC e1;     exists_TAC e2;
    set H3 H4 H7 H8 H5 H6;
  qed;
`;;
let ConnectedEmpty = theorem `;
  âα. Connected (subtopology α â
)
  proof
    simplify Connected_DEF INTER_EMPTY EMPTY_SUBSET TopspaceSubtopology;
    fol UNION_SUBSET SUBSET_EMPTY;
  qed;
`;;
let ConnectedSing = theorem `;
  âα a. a â topspace α  â  Connected (subtopology α {a})
  proof
    simplify Connected_DEF SING_SUBSET TopspaceSubtopology;
    set;
  qed;
`;;
let ConnectedUnions = theorem `;
  âα P. (âs. s â P â s â topspace α)  â
    (âs. s â P â Connected (subtopology α s)) ⧠¬(INTERS P = â
)
        â Connected (subtopology α (UNIONS P))
  proof
    intro_TAC âα P, H1;
    simplify H1 ConnectedSubtopology UNIONS_SUBSET NOT_EXISTS_THM;
    intro_TAC allConnected PnotDisjoint, â[d/e1] [e/e2];
    consider a such that
    ât. t â P â a â t     [aInterP] by fol PnotDisjoint MEMBER_NOT_EMPTY IN_INTERS;
    ONCE_REWRITE_TAC TAUT [âp. ¬p â p â F];
    intro_TAC dOpen eOpen Pde deDisjoint dNonempty eNonempty;
    a â d ⨠a â e     [adORae] by set aInterP Pde dNonempty;
    consider s x t y such that
    s â P  â§  x â d â© s  â§
    t â P  â§  y â e â© t     [xdsANDyet] by set dNonempty eNonempty;
    d â© e â© s = â
  â§  d â© e â© t = â
     [] by set - deDisjoint;
    (d â© s = â
  ⨠ e â© s = â
)  â§
    (d â© t = â
  ⨠ e â© t = â
)     [] by fol xdsANDyet allConnected dOpen eOpen Pde -;
    set adORae xdsANDyet aInterP -;
  qed;
`;;
let ConnectedUnion = theorem `;
  âα s t.  s â topspace α  â§  t â topspace α  â§  ¬(s â© t = â
)  â§
    Connected (subtopology α s) ⧠Connected (subtopology α t)
    â Connected (subtopology α (s ⪠t))
  proof
    rewrite GSYM UNIONS_2 GSYM INTERS_2;
    intro_TAC âα s t, H1 H2 H3 H4 H5;
    âu. u â {s, t}  â  u â topspace α     [stEuclidean] by set H1 H2;
    âu. u â {s, t}  â  Connected (subtopology α u)     [] by set H4 H5;
    fol stEuclidean - H3 ConnectedUnions;
  qed;
`;;
let ConnectedDiffOpenFromClosed = theorem `;
  âα s t u.  u â topspace α  â
    s â t  â§  t â u â§ open_in α s  â§  closed_in α t  â§
    Connected (subtopology α u)  â§  Connected (subtopology α (t â s))
    â Connected (subtopology α (u â s))
  proof
    ONCE_REWRITE_TAC TAUT
    [âa b c d e f g. (a â§ b â§ c â§ d â§ e â§ f â g)  â
    (a â§ b â§ c â§ d â ¬g â f â ¬e)];
    intro_TAC âα s t u, uSubset, st tu sOpen tClosed;
    t â s â topspace α  â§  u â s â topspace α     [] by fol uSubset sOpen OPEN_IN_SUBSET tClosed closed_in SUBSET_DIFF SUBSET_TRANS;
    simplify uSubset - ConnectedSubtopology;
    rewrite LEFT_IMP_EXISTS_THM;
    intro_TAC â[v/e1] [w/e2];
    intro_TAC vOpen wOpen u_sDisconnected vwDisjoint vNonempty wNonempty;
    rewrite NOT_EXISTS_THM;
    intro_TAC t_sConnected;
    t â s â v ⪠w  â§  v â© w â© (t â s) = â
     [] by set tu u_sDisconnected vwDisjoint;
    v â© (t â s) = â
  ⨠ w â© (t â s) = â
     [] by fol t_sConnected vOpen wOpen -;
    case_split vEmpty | wEmpty by fol -;
    suppose v â© (t â s) = â
;
      exists_TAC w ⪠s;     exists_TAC v â t;
      simplify vOpen wOpen sOpen tClosed OPEN_IN_UNION OPEN_IN_DIFF;
      set st tu u_sDisconnected vEmpty vwDisjoint wNonempty vNonempty;
    end;
    suppose w â© (t â s) = â
;
      exists_TAC v ⪠s;     exists_TAC w â t;
      simplify vOpen wOpen sOpen tClosed OPEN_IN_UNION OPEN_IN_DIFF;
      set st tu u_sDisconnected wEmpty vwDisjoint wNonempty vNonempty;
    end;
  qed;
`;;
let ConnectedDisjointUnionsOpenUniquePart1 = theorem `;
  âα f f' s t a.  pairwise DISJOINT f â§ pairwise DISJOINT f' â§
    (âs. s â f  â  open_in α s â§ Connected (subtopology α s) ⧠¬(s = â
)) â§
    (âs. s â f'  â  open_in α s â§ Connected (subtopology α s) ⧠¬(s = â
)) â§
    UNIONS f = UNIONS f' â§ s â f â§ t â f' â§ a â s â§ a â t
     â s â t
  proof
    intro_TAC âα f f' s t a, pDISJf pDISJf' fConn f'Conn Uf_Uf' sf tf' a_s a_t;
    âs.  s â f â s â topspace α     [fTop] by fol fConn OPEN_IN_SUBSET;
    âs.  s â f' â s â topspace α     [f'Top] by fol f'Conn OPEN_IN_SUBSET;
    rewrite SUBSET;
    X_genl_TAC b;     intro_TAC bs;
    assume ¬(b â t)     [Contradiction] by fol;
    âe1 e2.  open_in α e1 â§ open_in α e2 â§ e1 â© e2 â© s = â
 â§
     s â e1 ⪠e2 ⧠¬(e1 â© s = â
) ⧠¬(e2 â© s = â
)     []
     proof
       exists_TAC t;     exists_TAC UNIONS (f' DELETE t);
       simplify tf' f'Conn IN_DELETE OPEN_IN_UNIONS;
       conj_tac     [Right] by set sf Uf_Uf' a_s a_t sf bs Contradiction;
       MATCH_MP_TAC SET_RULE [âs t u. t â© u = â
 â t â© u â© s = â
];
       rewrite INTER_UNIONS EMPTY_UNIONS FORALL_IN_GSPEC;
       rewrite IN_DELETE GSYM DISJOINT;
       fol pDISJf' tf' pairwise;
     qed;
     fol - sf fTop fConn ConnectedSubtopology;
  qed;
`;;
let ConnectedDisjointUnionsOpenUnique = theorem `;
  âα f f'.  pairwise DISJOINT f â§ pairwise DISJOINT f' â§
    (âs. s â f  â  open_in α s â§ Connected (subtopology α s) ⧠¬(s = â
)) â§
    (âs. s â f'  â  open_in α s â§ Connected (subtopology α s) ⧠¬(s = â
)) â§
    UNIONS f = UNIONS f'
    â f = f'
  proof
    MATCH_MP_TAC MESON [SUBSET_ANTISYM]
    [(âα s t. P α s t â P α t s) â§ (âα s t. P α s t â s â t)
    â (âα s t. P α s t â s = t)];
    conj_tac     [Left] by fol;
    intro_TAC âα f f', pDISJf pDISJf' fConn f'Conn Uf_Uf';
    rewrite SUBSET;     X_genl_TAC s;     intro_TAC sf;
    consider t a such that
    t â f' â§ a â s â§ a â t     [taExist] by set sf fConn Uf_Uf';
    MP_TAC ISPECL [α; f; f'; s; t] ConnectedDisjointUnionsOpenUniquePart1;
    MP_TAC ISPECL [α; f'; f; t; s] ConnectedDisjointUnionsOpenUniquePart1;
    fol pDISJf pDISJf' fConn f'Conn Uf_Uf' sf taExist SUBSET_ANTISYM taExist;
  qed;
`;;
let ConnectedFromClosedUnionAndInter = theorem `;
  âα s t.  s ⪠t â topspace α â§ closed_in α s â§ closed_in α t â§
    Connected (subtopology α (s ⪠t)) ⧠Connected (subtopology α (s ⩠t))
    â Connected (subtopology α s) â§ Connected (subtopology α t)
  proof
    MATCH_MP_TAC MESON [] [(âα s t. P α s t â P α t s) â§
    (âα s t. P α s t â Q α s) â âα s t. P α s t â Q α s â§ Q α t];
    conj_tac     [Left] by fol UNION_COMM INTER_COMM;
    ONCE_REWRITE_TAC TAUT
    [âa b c d e f.  a â§ b â§ c â§ d â§ e â f  â  a â§ b â§ c â§ e ⧠¬f â ¬d];
    intro_TAC âα s t, stUnionTop sClosed tClosed stInterConn  NOTsConn;
    s â topspace α â§ t â topspace α â§ s â© t â topspace α     [stTop] by fol stUnionTop UNION_SUBSET INTER_SUBSET SUBSET_TRANS;
    simplify stUnionTop ConnectedClosedSubtopology;
    consider u v such that closed_in α u â§ closed_in α v â§
    ¬(u = â
) ⧠¬(v = â
) â§ u ⪠v = s â§ u â© v = â
     [sDisConn]
    proof
      MP_TAC ISPECL [α; s] ConnectedClosedSet;
      simplify stTop sClosed NOTsConn;
    qed;
    s â© t â u ⪠v  â§  u â© v â© (s â© t) = â
     [stuvProps] by set sDisConn;
    u â© (s â© t) = â
  ⨠ v â© (s â© t) = â
     [] by fol stTop stInterConn sDisConn - ConnectedClosedSubtopology_ALT;
    case_split vstEmpty | ustEmpty by fol -;
    suppose v â© (s â© t) = â
;
      exists_TAC t ⪠u;     exists_TAC v;
      simplify tClosed sDisConn CLOSED_IN_UNION;
      set stuvProps sDisConn vstEmpty;
    end;
    suppose u â© (s â© t) = â
;
      exists_TAC t ⪠v;     exists_TAC u;
      simplify tClosed sDisConn CLOSED_IN_UNION;
      set stuvProps sDisConn ustEmpty;
    end;
  qed;
`;;
let ConnectedFromOpenUnionAndInter = theorem `;
  âα s t.  s ⪠t â topspace α â§ open_in α s â§ open_in α t â§
    Connected (subtopology α (s ⪠t)) ⧠Connected (subtopology α (s ⩠t))
    â Connected (subtopology α s) â§ Connected (subtopology α t)
  proof
    MATCH_MP_TAC MESON [] [(âα s t. P α s t â P α t s) â§
    (âα s t. P α s t â Q α s) â âα s t. P α s t â Q α s â§ Q α t];
    conj_tac     [Left] by fol UNION_COMM INTER_COMM;
    ONCE_REWRITE_TAC TAUT
    [âa b c d e f.  a â§ b â§ c â§ d â§ e â f  â  a â§ b â§ c â§ e ⧠¬f â ¬d];
    intro_TAC âα s t, stUnionTop sOpen tOpen stInterConn  NOTsConn;
    s â topspace α â§ t â topspace α â§ s â© t â topspace α     [stTop] by fol stUnionTop UNION_SUBSET INTER_SUBSET SUBSET_TRANS;
    simplify stUnionTop ConnectedSubtopology;
    consider u v such that open_in α u â§ open_in α v â§
    ¬(u = â
) ⧠¬(v = â
) â§ u ⪠v = s â§ u â© v = â
     [sDisConn]
    proof
      MP_TAC ISPECL [α; s] ConnectedOpenSet;
      simplify stTop sOpen NOTsConn;
    qed;
    s â© t â u ⪠v  â§  u â© v â© (s â© t) = â
     [stuvProps] by set sDisConn;
    u â© (s â© t) = â
  ⨠ v â© (s â© t) = â
     [] by fol stTop stInterConn sDisConn - ConnectedSubtopology_ALT;
    case_split vstEmpty | ustEmpty by fol -;
    suppose v â© (s â© t) = â
;
      exists_TAC t ⪠u;     exists_TAC v;
      simplify tOpen sDisConn OPEN_IN_UNION;
      set stuvProps sDisConn vstEmpty;
    end;
    suppose u â© (s â© t) = â
;
      exists_TAC t ⪠v;     exists_TAC u;
      simplify tOpen sDisConn OPEN_IN_UNION;
      set stuvProps sDisConn ustEmpty;
    end;
  qed;
`;;
let ConnectedInduction = theorem `;
  âα P Q s.  s â topspace α  â  Connected (subtopology α s) â§
    (ât a. open_in (subtopology α s) t â§ a â t  â  âz. z â t â§ P z) â§
    (âa. a â s  â  ât. open_in (subtopology α s) t â§ a â t â§
    âx y. x â t â§ y â t â§ P x â§ P y â§ Q x â Q y)
    â âa b. a â s â§ b â s â§ P a â§ P b â§ Q a â Q b
  proof
    intro_TAC âα P Q s, sTop, sConn atOpenImplies_ztPz asImplies_atOpen_xytPxPyQxasImpliesQy, âa b, aINs bINs Pa Pb Qa;
    assume ¬Q b     [NotQb] by fol;
    ¬Connected (subtopology α s)     []
    proof
      simplify sTop ConnectedOpenIn;
      exists_TAC
      {b | ât. open_in (subtopology α s) t â§ b â t â§ âx. x â t â§ P x â Q x};
      exists_TAC
      {b | ât. open_in (subtopology α s) t â§ b â t â§ âx. x â t â§ P x â ¬(Q x)};
      conj_tac     [Left]
      proof
        ONCE_REWRITE_TAC OPEN_IN_SUBOPEN;
        X_genl_TAC c;
        rewrite IN_ELIM_THM;
        MATCH_MP_TAC MONO_EXISTS;
        set atOpenImplies_ztPz;
      qed;
      conj_tac     [Left]
      proof
        ONCE_REWRITE_TAC OPEN_IN_SUBOPEN;
        X_genl_TAC c;
        rewrite IN_ELIM_THM;
        MATCH_MP_TAC MONO_EXISTS;
        set atOpenImplies_ztPz;
      qed;
      conj_tac     [Left]
      proof
        rewrite SUBSET IN_ELIM_THM IN_UNION;
        X_genl_TAC c;     intro_TAC cs;
        MP_TAC SPECL [c] asImplies_atOpen_xytPxPyQxasImpliesQy;
        set cs;
      qed;
      conj_tac     [Right] by set aINs bINs Qa NotQb asImplies_atOpen_xytPxPyQxasImpliesQy Pa Pb;
      rewrite EXTENSION IN_INTER NOT_IN_EMPTY IN_ELIM_THM;
      X_genl_TAC c;
      ONCE_REWRITE_TAC TAUT [âp. ¬p  â  p â F];
      intro_TAC Qx NotQx;
      consider t such that
      open_in (subtopology α s) t â§ c â t â§ (âx. x â t â§ P x â Q x)     [tExists] by fol Qx;
      consider u such that
      open_in (subtopology α s) u â§ c â u â§ (âx. x â u â§ P x â ¬Q x)     [uExists] by fol NotQx;
      MP_TAC SPECL [t â© u; c] atOpenImplies_ztPz;
      simplify tExists uExists OPEN_IN_INTER;
      set tExists uExists;
    qed;
    fol sConn -;
  qed;
`;;
let ConnectedEquivalenceRelationGen = theorem `;
  âα P R s.  s â topspace α  â  Connected (subtopology α s) â§
        (âx y z. R x y â§ R y z â R x z) â§
        (ât a. open_in (subtopology α s) t â§ a â t
               â âz. z â t â§ P z) â§
        (âa. a â s
             â ât. open_in (subtopology α s) t â§ a â t â§
                     âx y. x â t â§ y â t â§ P x â§ P y â R x y)
        â âa b. a â s â§ b â s â§ P a â§ P b â R a b
  proof
    intro_TAC âα P R s, sTop, sConn Rtrans atOpenImplies_ztPz asImplies_atOpen_xytPxPyImpliesRxy, âa b, aINs bINs Pa Pb;
    âa.  a â s â§ P a  â  âb c. b â s â§ c â s â§ P b â§ P c â§ R a b â R a c     []
    proof
      intro_TAC â[p/a], pINs Pp;
      MP_TAC ISPECL [α; P; λx. R p x; s] ConnectedInduction;
      rewrite sTop sConn atOpenImplies_ztPz;
      fol asImplies_atOpen_xytPxPyImpliesRxy Rtrans;
    qed;
    fol aINs Pa bINs Pb asImplies_atOpen_xytPxPyImpliesRxy -;
  qed;
`;;
let ConnectedInductionSimple = theorem `;
  âα P s.  s â topspace α  â
        Connected (subtopology α s) â§
        (âa. a â s
             â ât. open_in (subtopology α s) t â§ a â t â§
                     âx y. x â t â§ y â t â§ P x â P y)
        â âa b. a â s â§ b â s â§ P a â P b
  proof
    intro_TAC âα P s, sTop;
    MP_TAC ISPECL [α; (λx. T ⨠x â s); P; s] ConnectedInduction;
    fol sTop;
  qed;
`;;
let ConnectedEquivalenceRelation = theorem `;
  âα R s.  s â topspace α  â  Connected (subtopology α s)â§
    (âx y. R x y â R y x) â§ (âx y z. R x y â§ R y z â R x z) â§
    (âa. a â s â
    ât. open_in (subtopology α s) t â§ a â t â§ âx. x â t â R a x)
    â âa b. a â s â§ b â s â R a b
  proof
    intro_TAC âα R s, sTop, sConn Rcomm Rtrans asImplies_atOpen_xtImpliesRax;
    âa. a â s â âb c. b â s â§ c â s â§ R a b â R a c     []
    proof
      intro_TAC â[p/a], pINs;
      MP_TAC ISPECL [α; λx. R p x; s] ConnectedInductionSimple;
       rewrite sTop sConn;
      fol asImplies_atOpen_xtImpliesRax Rcomm Rtrans;
    qed;
    fol asImplies_atOpen_xtImpliesRax -;
  qed;
`;;
let LimitPointOf = NewDefinition `;
  âα s. LimitPointOf α s  =  {x | s â topspace α â§ x â topspace α â§
    ât. x â t â§ open_in α t  â  ây. ¬(y = x) â§ y â s â§ y â t}`;;
let IN_LimitPointOf = theorem `;
  âα s x.  s â topspace α  â
    (x â LimitPointOf α s  â  x â topspace α â§
    ât. x â t â§ open_in α t  â  ây. ¬(y = x) â§ y â s â§ y â t)
  by simplify IN_ELIM_THM LimitPointOf`;;
let NotLimitPointOf = theorem `;
  âα s x.  s â topspace α â§ x â topspace α  â
    (x â LimitPointOf α s  â
    ât. x â t  â§  open_in α t  â§  s â© (t â {x}) = â
)
  proof
    ONCE_REWRITE_TAC TAUT [âa b. (a â b)  â  (¬a  â ¬b)];
    simplify â NOT_EXISTS_THM IN_LimitPointOf
    TAUT [âa b. ¬(a â§ b â§ c)  â  a â§ b â ¬c] GSYM MEMBER_NOT_EMPTY IN_INTER  IN_DIFF IN_SING;
     fol;
  qed;
`;;
let LimptSubset = theorem `;
  âα s t.  t â topspace α  â
    s â t  â  LimitPointOf α s â LimitPointOf α t
  proof
    intro_TAC âα s t, tTop, st;
    s â topspace α     [sTop] by fol tTop st SUBSET_TRANS;
    simplify tTop sTop IN_LimitPointOf SUBSET;
    fol st SUBSET;
  qed;
`;;
let ClosedLimpt = theorem `;
  âα s.  s â topspace α  â
    (closed_in α s  â  LimitPointOf α s â s)
  proof
    intro_TAC âα s, H1;
    simplify H1 closed_in;
    ONCE_REWRITE_TAC OPEN_IN_SUBOPEN;
    simplify H1 IN_LimitPointOf SUBSET IN_DIFF;
    AP_TERM_TAC;
    ABS_TAC;
    fol OPEN_IN_SUBSET SUBSET;
  qed;
`;;
let LimptEmpty = theorem `;
  âα x.  x â topspace α  â  x â LimitPointOf α â
  by fol EMPTY_SUBSET IN_LimitPointOf OPEN_IN_TOPSPACE NOT_IN_EMPTY â`;;
let NoLimitPointImpClosed = theorem `;
  âα s.  s â topspace α  â  (âx. x â LimitPointOf α s)  â  closed_in α s
  by fol ClosedLimpt SUBSET â`;;
let LimitPointUnion = theorem `;
  âα s t.  s ⪠t â topspace α  â
    LimitPointOf α (s ⪠t)  =  LimitPointOf α s  ⪠ LimitPointOf α t
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α     [stTop] by fol H1 UNION_SUBSET;
    rewrite EXTENSION IN_UNION;
    intro_TAC âx;
    assume x â topspace α     [xTop] by fol H1 stTop IN_LimitPointOf;
    ONCE_REWRITE_TAC TAUT [âa b. (a â b)  â  (¬a  â ¬b)];
    simplify GSYM NOTIN DE_MORGAN_THM H1 stTop NotLimitPointOf xTop;
    eq_tac     [Left] by set;
    MATCH_MP_TAC ExistsTensorInter;
    simplify IN_INTER OPEN_IN_INTER;
    set;
  qed;
`;;
let Interior_DEF = NewDefinition `;
  âα s.  Interior α s =
    {x | s â topspace α  â§  ât. open_in α t â§ x â t â§ t â s}`;;
let Interior_THM = theorem `;
  âα s.  s â topspace α  â  Interior α s =
    {x | s â topspace α  â§  ât. open_in α t â§ x â t â§ t â s}
  by fol Interior_DEF`;;
let IN_Interior = theorem `;
  âα s x.  s â topspace α  â
    (x â Interior α s  â  ât. open_in α t â§ x â t â§ t â s)
  by simplify Interior_THM IN_ELIM_THM`;;
let InteriorEq = theorem `;
  âα s.  s â topspace α  â
    (open_in α s  â  s = Interior α s)
  proof
    intro_TAC âα s, H1;
    rewriteL OPEN_IN_SUBOPEN;
    simplify EXTENSION H1 IN_Interior;
    set;
  qed;
`;;
let InteriorOpen = theorem `;
  âα s.  open_in α s  â  Interior α s = s
  by fol OPEN_IN_SUBSET InteriorEq`;;
let InteriorEmpty = theorem `;
  âα. Interior α â
 = â
  by fol OPEN_IN_EMPTY EMPTY_SUBSET InteriorOpen`;;
let InteriorUniv = theorem `;
  âα. Interior α (topspace α) = topspace α
  by simplify OpenInTopspace InteriorOpen`;;
let OpenInterior = theorem `;
  âα s.  s â topspace α  â  open_in α (Interior α s)
  proof
    ONCE_REWRITE_TAC OPEN_IN_SUBOPEN;
    fol IN_Interior SUBSET;
  qed;
`;;
let InteriorInterior = theorem `;
  âα s.  s â topspace α  â
    Interior α  (Interior α s) = Interior α s
  by fol OpenInterior InteriorOpen`;;
let InteriorSubset = theorem `;
  âα s.  s â topspace α  â  Interior α s â s
  proof
    intro_TAC âα s, H1;
    simplify SUBSET Interior_DEF IN_ELIM_THM;
    fol H1 SUBSET;
  qed;
`;;
let InteriorTopspace = theorem `;
  âα s.  s â topspace α  â  Interior α s â topspace α
  by fol SUBSET_TRANS InteriorSubset`;;
let SubsetInterior = theorem `;
  âα s t.  t â topspace α  â  s â t  â
    Interior α s â Interior α t
  by fol SUBSET_TRANS SUBSET IN_Interior SUBSET`;;
let InteriorMaximal = theorem `;
  âα s t.  s â topspace α  â
    t â s â§ open_in α t  â  t â Interior α s
  by fol SUBSET IN_Interior SUBSET`;;
let InteriorMaximalEq = theorem `;
  âs t.  t â topspace α  â
    open_in α s  â  (s â Interior α t  â  s â t)
  by fol InteriorMaximal SUBSET_TRANS InteriorSubset`;;
let InteriorUnique = theorem `;
  âα s t.  s â topspace α  â
    t â s  â§  open_in α t â§  (ât'. t' â s â§ open_in α t' â t' â t)
    â Interior α s = t
  by fol SUBSET_ANTISYM InteriorSubset OpenInterior InteriorMaximal`;;
let OpenSubsetInterior = theorem `;
  âα s t.  t â topspace α  â
    open_in α s  â  (s â Interior α t  â  s â t)
  by fol InteriorMaximal InteriorSubset SUBSET_TRANS`;;
let InteriorInter = theorem `;
  âα s t.  s â topspace α  â§  t â topspace α  â
    Interior α (s ⩠t) = Interior α s ⩠Interior α t
  proof
    intro_TAC âα s t, sTop tTop;
    rewrite GSYM SUBSET_ANTISYM_EQ SUBSET_INTER;
    conj_tac     [Left] by fol sTop tTop SubsetInterior INTER_SUBSET;
    s â© t â topspace α     [] by fol sTop INTER_SUBSET SUBSET_TRANS;
    fol - sTop tTop OpenInterior OPEN_IN_INTER InteriorSubset InteriorMaximal INTER_TENSOR;
  qed;
`;;
let InteriorFiniteInters = theorem `;
  âα s.  FINITE s â ¬(s = â
) â (ât. t â s â t â topspace α) â
    Interior α (INTERS s) = INTERS (IMAGE (Interior α) s)
  proof
    intro_TAC âα;
    MATCH_MP_TAC FINITE_INDUCT;
    rewrite INTERS_INSERT IMAGE_CLAUSES IN_INSERT;
    intro_TAC âx s, sCase, xsNonempty, sSetOfSubsets;
    assume ¬(s = â
)     [sNonempty] by simplify INTERS_0 INTER_UNIV IMAGE_CLAUSES;
    simplify INTERS_SUBSET  sSetOfSubsets InteriorInter sNonempty sSetOfSubsets sCase;
  qed;
`;;
let InteriorIntersSubset = theorem `;
  âα f.  ¬(f = â
) â§ (ât. t â f â t â topspace α) â
    Interior α (INTERS f)  â  INTERS (IMAGE (Interior α) f)
  proof
    intro_TAC âα f, H1 H2;
    INTERS f â topspace α     [] by set H1 H2;
    simplify SUBSET IN_INTERS FORALL_IN_IMAGE - H2 IN_Interior;
    fol;
  qed;
`;;
let UnionInteriorSubset = theorem `;
  âα s t.  s â topspace α  â§  t â topspace α  â
    Interior α s ⪠Interior α t  â  Interior α (s ⪠t)
  proof
    intro_TAC âα s t, sTop tTop;
    s ⪠t â topspace α     [] by fol sTop tTop UNION_SUBSET;
    fol sTop tTop - OpenInterior OPEN_IN_UNION InteriorMaximal UNION_TENSOR InteriorSubset;
  qed;
`;;
let InteriorEqEmpty = theorem `;
  âα s.  s â topspace α  â
    (Interior α s = â
  â  ât. open_in α t â§ t â s  â  t = â
)
  by fol InteriorMaximal SUBSET_EMPTY OpenInterior SUBSET_REFL InteriorSubset`;;
let InteriorEqEmptyAlt = theorem `;
  âα s.  s â topspace α  â
    (Interior α s = â
  â  ât. open_in α t ⧠¬(t = â
) â ¬(t â s = â
))
  proof
    simplify InteriorEqEmpty;
    set;
  qed;
`;;
let InteriorUnionsOpenSubsets = theorem `;
  âα s.  s â topspace α  â  UNIONS {t | open_in α t â§ t â s} = Interior α s
  proof
    intro_TAC âα s, H1;
    consider t such that
    t = UNIONS {f | open_in α f â§ f â s}     [tDef] by fol;
    t â s  â§  âf. f â s â§ open_in α f â f â t     [] by set tDef;
    simplify H1 tDef - OPEN_IN_UNIONS IN_ELIM_THM InteriorUnique;
  qed;
`;;
let InteriorClosedUnionEmptyInterior = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    closed_in α s â§ Interior α t = â
  â
    Interior α (s ⪠t) = Interior α s
  proof
    intro_TAC âα s t, H1 H2, H3 H4;
    s ⪠t â topspace α     [stTop] by fol H1 H2 UNION_SUBSET;
    Interior α (s ⪠t) â s     []
    proof
      simplify SUBSET stTop IN_Interior LEFT_IMP_EXISTS_THM;
      X_genl_TAC y O;     intro_TAC openO yO Os_t;
      consider O' such that O' = (topspace α â s) â© O     [O'def] by fol -;
      O' â t     [O't] by set O'def Os_t;
      assume y â s     [yNOTs] by fol â;
      y â topspace α â s     [] by fol openO OPEN_IN_SUBSET yO SUBSET yNOTs IN_DIFF â;
      y â O'  â§  open_in α O'     [] by fol O'def - yO IN_INTER H3 closed_in openO OPEN_IN_INTER;
      fol O'def - O't H2 IN_Interior SUBSET MEMBER_NOT_EMPTY H4;
    qed;
    fol SUBSET_ANTISYM H1 stTop OpenInterior - InteriorMaximal SUBSET_UNION SubsetInterior;
  qed;
`;;
let InteriorUnionEqEmpty = theorem `;
  âα s t.  s ⪠t â topspace α  â
    closed_in α s ⨠closed_in α t
    â (Interior α (s ⪠t) = â
  â  Interior α s = â
 â§ Interior α t = â
)
  proof
    intro_TAC âα s t, H1, H2;
    s â topspace α â§ t â topspace α     [] by fol H1 UNION_SUBSET;
    eq_tac     [Left] by fol - H1 SUBSET_UNION SubsetInterior SUBSET_EMPTY;
    fol UNION_COMM - H2 InteriorClosedUnionEmptyInterior;
  qed;
`;;
let Closure_DEF = NewDefinition `;
  âα s.  Closure α s  =  s ⪠LimitPointOf α s`;;
let Closure_THM = theorem `;
  âα s.  s â topspace α  â  Closure α s  =  s ⪠LimitPointOf α s
  by fol Closure_DEF`;;
let IN_Closure = theorem `;
  âα s x.  s â topspace α  â
    (x â Closure α s  â  x â topspace α â§
    ât. x â t â§ open_in α t  â  ây. y â s â§ y â t)
  proof
    intro_TAC âα s x, H1;
    simplify H1 Closure_THM IN_UNION IN_LimitPointOf;
    fol H1 SUBSET;
  qed;
`;;
let ClosureSubset = theorem `;
  âα s.  s â topspace α  â  s â Closure α s
  by fol SUBSET IN_Closure`;;
let ClosureTopspace = theorem `;
  âα s.  s â topspace α  â  Closure α s â topspace α
  by fol SUBSET IN_Closure`;;
let ClosureInterior = theorem `;
  âα s.  s â topspace α  â
    Closure α s  =  topspace α â (Interior α (topspace α â s))
  proof
    intro_TAC âα s, H1;
    simplify H1 EXTENSION IN_Closure IN_DIFF IN_Interior SUBSET;
    fol OPEN_IN_SUBSET SUBSET;
  qed;
`;;
let InteriorClosure = theorem `;
  âα s.  s â topspace α  â
    Interior α s = topspace α â (Closure α (topspace α â s))
  by fol SUBSET_DIFF InteriorTopspace DIFF_REFL ClosureInterior`;;
let ClosedClosure = theorem `;
  âα s.  s â topspace α  â  closed_in α (Closure α s)
  by fol closed_in ClosureInterior DIFF_REFL SUBSET_DIFF InteriorTopspace OpenInterior`;;
let SubsetClosure = theorem `;
  âα s t.  t â topspace α  â  s â t  â  Closure α s â Closure α t
  proof
    intro_TAC âα s t, tSubset, st;
    s â topspace α     [] by fol tSubset st SUBSET_TRANS;
    simplify tSubset - Closure_THM st LimptSubset UNION_TENSOR;
  qed;
`;;
let ClosureHull = theorem `;
  âα s.  s â topspace α  â  Closure α s = (closed_in α) hull s
  proof
    intro_TAC âα s, H1;
    MATCH_MP_TAC GSYM HULL_UNIQUE;
    simplify H1 ClosureSubset ClosedClosure Closure_THM UNION_SUBSET;
    fol LimptSubset CLOSED_IN_SUBSET ClosedLimpt SUBSET_TRANS;
  qed;
`;;
let ClosureEq = theorem `;
  âα s.  s â topspace α  â  (Closure α s = s  â  closed_in α s)
  by fol ClosedClosure ClosedLimpt Closure_THM SUBSET_UNION_ABSORPTION UNION_COMM`;;
let ClosureClosed = theorem `;
  âα s.  closed_in α s  â  Closure α s = s
  by fol closed_in ClosureEq`;;
let ClosureClosure = theorem `;
  âα s.  s â topspace α  â  Closure α (Closure α s) = Closure α s
  by fol ClosureTopspace ClosureHull HULL_HULL`;;
let ClosureUnion = theorem `;
  âα s t.  s ⪠t â topspace α
    â Closure α (s ⪠t)  =  Closure α s ⪠Closure α t
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α     [stTop] by fol H1 UNION_SUBSET;
    simplify H1 stTop Closure_THM LimitPointUnion;
    set;
  qed;
`;;
let ClosureInterSubset = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    Closure α (s â© t)  â  Closure α s â© Closure α t
  by fol SUBSET_INTER INTER_SUBSET SubsetClosure`;;
let ClosureIntersSubset = theorem `;
  âα f.  (âs. s â f â s â topspace α)  â
    Closure α (INTERS f)  â  INTERS (IMAGE (Closure α) f)
  proof
    intro_TAC âα f, H1;
    rewrite SET_RULE [s â INTERS f â ât. t â f â s â t] FORALL_IN_IMAGE;
    X_genl_TAC s;
    intro_TAC sf;
    s â topspace α  â§  INTERS f â s  â§  INTERS f â topspace α     [] by set H1 sf;
    fol SubsetClosure -;
  qed;
`;;
let ClosureMinimal = theorem `;
  âα s t.  s â t â§ closed_in α t  â  Closure α s â t
  by fol closed_in SubsetClosure ClosureClosed`;;
let ClosureMinimalEq = theorem `;
  âα s t.  s â topspace α  â
    closed_in α t  â  (Closure α s â t â s â t)
  by fol closed_in SUBSET_TRANS ClosureSubset ClosureMinimal`;;
let ClosureUnique = theorem `;
  âα s t.  s â t â§ closed_in α t â§ (âu. s â u â§ closed_in α u  â  t â u)
    â Closure α s = t
  by fol closed_in SUBSET_ANTISYM_EQ ClosureMinimal SUBSET_TRANS ClosureSubset ClosedClosure`;;
let ClosureUniv = theorem `;
  âα.  Closure α (topspace α) =  topspace α
  by simplify SUBSET_REFL CLOSED_IN_TOPSPACE ClosureEq`;;
let ClosureEmpty = theorem `;
  Closure α â
 = â
  by fol EMPTY_SUBSET CLOSED_IN_EMPTY ClosureClosed`;;
let ClosureUnions = theorem `;
  âα f.  FINITE f  â  (â t. t â f â t â topspace α)  â
    Closure α (UNIONS f) = UNIONS {Closure α t | t â f}
  proof
    intro_TAC âα;
    MATCH_MP_TAC FINITE_INDUCT;
    rewrite UNIONS_0 SET_RULE [{f x | x â â
} = â
] ClosureEmpty UNIONS_INSERT
    SET_RULE [{f x | x â a INSERT t} = (f a) INSERT {f x | x â t}] IN_INSERT;
    fol UNION_SUBSET UNIONS_SUBSET IN_UNIONS ClosureUnion;
  qed;
`;;
let ClosureEqEmpty = theorem `;
  âα s.  s â topspace α  â  (Closure α s = â
  â  s = â
)
  by fol ClosureEmpty ClosureSubset SUBSET_EMPTY`;;
let ClosureSubsetEq = theorem `;
  âα s.  s â topspace α  â  (Closure α s â s  â  closed_in α s)
  by fol ClosureEq ClosureSubset SUBSET_ANTISYM`;;
let OpenInterClosureEqEmpty = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    open_in α s  â  (s â© Closure α t = â
  â  s â© t = â
)
  proof
    intro_TAC âα s t, H1 H2, H3;
    eq_tac     [Left] by fol H2 ClosureSubset INTER_TENSOR SUBSET_REFL SUBSET_EMPTY;
    intro_TAC stDisjoint;
    s â Interior α (topspace α â t)     [] by fol H2 SUBSET_DIFF H3 H1 H2 stDisjoint SUBSET_COMPLEMENT OpenSubsetInterior;
    fol H1 H2 InteriorTopspace - COMPLEMENT_DISJOINT H2 ClosureInterior;
  qed;
`;;
let OpenInterClosureSubset = theorem `;
  âα s t.  t â topspace α  â
    open_in α s  â  s â© Closure α t â Closure α (s â© t)
  proof
    intro_TAC âα s t, tTop, sOpen;
    s â topspace α     [sTop] by fol OPEN_IN_SUBSET sOpen;
    s â© t â topspace α     [stTop] by fol sTop sTop INTER_SUBSET SUBSET_TRANS;
    simplify tTop - Closure_THM UNION_OVER_INTER SUBSET_UNION SUBSET_UNION;
    s â© LimitPointOf α t  â  LimitPointOf α (s â© t)     []
    proof
      simplify SUBSET IN_INTER tTop stTop IN_LimitPointOf;
      X_genl_TAC x;     intro_TAC xs xTop xLIMt;
      X_genl_TAC O;     intro_TAC xO Oopen;
      x â O â© s  â§  open_in α (O â© s)     [xOsOpen] by fol xs xO IN_INTER Oopen sOpen OPEN_IN_INTER;
      fol xOsOpen xLIMt IN_INTER;
    qed;
    simplify - UNION_TENSOR SUBSET_REFL;
  qed;
`;;
let ClosureOpenInterSuperset = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    open_in α s â§ s â Closure α t  â  Closure α (s â© t) = Closure α s
  proof
    intro_TAC âα s t, sTop tTop, sOpen sSUBtC;
    s â© t â topspace α     [stTop] by fol INTER_SUBSET sTop SUBSET_TRANS;
    MATCH_MP_TAC SUBSET_ANTISYM;
    conj_tac     [Left] by fol sTop INTER_SUBSET SubsetClosure;
    s  â  Closure α (s â© t)     [] by fol tTop sOpen OpenInterClosureSubset SUBSET_REFL sSUBtC SUBSET_INTER SUBSET_TRANS;
    fol stTop - ClosedClosure ClosureMinimal;
  qed;
`;;
let ClosureComplement = theorem `;
  âα s.  s â topspace α  â
    Closure α (topspace α â s) = topspace α â Interior α s
  by fol InteriorClosure SUBSET_DIFF ClosureTopspace DIFF_REFL`;;
let InteriorComplement = theorem `;
  âα s.  s â topspace α  â
    Interior α (topspace α â s) = topspace α â Closure α s
  by fol SUBSET_DIFF InteriorTopspace DIFF_REFL ClosureInterior DIFF_REFL`;;
let ClosureInteriorComplement = theorem `;
  âα s.  s â topspace α  â
    topspace α â Closure α (Interior α s)
    = Interior α (Closure α (topspace α â s))
  by fol InteriorTopspace InteriorComplement ClosureComplement`;;
let InteriorClosureComplement = theorem `;
  âα s.  s â topspace α  â
    topspace α â Interior α (Closure α s)
    = Closure α (Interior α (topspace α â s))
  by fol ClosureTopspace SUBSET_TRANS InteriorComplement ClosureComplement`;;
let ConnectedIntermediateClosure = theorem `;
  âα s t.  s â topspace α  â
    Connected (subtopology α s) â§  s â t  â§  t â Closure α s
    â Connected (subtopology α t)
  proof
    intro_TAC âα s t, sTop, sCon st tCs;
    t â topspace α     [tTop] by fol tCs sTop ClosureTopspace SUBSET_TRANS;
    simplify tTop ConnectedSubtopology_ALT;
    X_genl_TAC u v;
    intro_TAC uOpen vOpen t_uv uvtEmpty;
    u â topspace α  â§  v â topspace α     [uvTop] by fol uOpen vOpen OPEN_IN_SUBSET;
    u â© s = â
  ⨠ v â© s = â
     [] by fol sTop uvTop uOpen vOpen st t_uv uvtEmpty SUBSET_TRANS SUBSET_REFL INTER_TENSOR SUBSET_EMPTY sCon ConnectedSubtopology_ALT;
    s â topspace α â u  ⨠ s â topspace α â v     [] by fol - sTop uvTop INTER_COMM SUBSET_COMPLEMENT;
    t â topspace α â u  ⨠ t â topspace α â v     [] by fol SUBSET_DIFF - uvTop uOpen vOpen OPEN_IN_CLOSED_IN ClosureMinimal tCs SUBSET_TRANS;
    fol tTop uvTop - SUBSET_COMPLEMENT INTER_COMM;
  qed;
`;;
let ConnectedClosure = theorem `;
  âα s.  s â topspace α  â  Connected (subtopology α s) â
    Connected (subtopology α (Closure α s))
  by fol ClosureTopspace ClosureSubset SUBSET_REFL ConnectedIntermediateClosure`;;
let ConnectedUnionStrong = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    Connected (subtopology α s)  â§  Connected (subtopology α t)  â§
    ¬(Closure α s â© t = â
)
    â Connected (subtopology α (s ⪠t))
  proof
    intro_TAC âα s t, sTop tTop, H2 H3 H4;
    consider p s' such that
    p â Closure α s  â§  p â t  â§  s' = p ⪠s     [pCst] by fol H4 MEMBER_NOT_EMPTY IN_INTER;
    s â s'  â§  s' â Closure α s     [s_ps_Cs] by fol IN_INSERT SUBSET pCst sTop ClosureSubset INSERT_SUBSET;
    Connected (subtopology α (s'))     [s'Con] by fol sTop H2 s_ps_Cs ConnectedIntermediateClosure;
    s ⪠t = s' ⪠t  â§  ¬(s' â© t = â
)     [] by fol pCst INSERT_UNION IN_INSERT IN_INTER MEMBER_NOT_EMPTY;
    fol s_ps_Cs sTop ClosureTopspace SUBSET_TRANS tTop - s'Con H3 ConnectedUnion;
  qed;
`;;
let InteriorDiff = theorem `;
  âα s t.   s â topspace α â§ t â topspace α  â
    Interior α (s â t) = Interior α s â Closure α t
  by fol ClosureTopspace InteriorTopspace COMPLEMENT_INTER_DIFF InteriorComplement SUBSET_DIFF InteriorInter`;;
let ClosedInLimpt = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    (closed_in (subtopology α t) s  â
    s â t  â§  LimitPointOf α s â© t â s)
  proof
    intro_TAC âα s t, H1 H2;
    simplify H2 ClosedInSubtopology;
    eq_tac     [Right]
    proof
      intro_TAC sSUBt LIMstSUBs;
      exists_TAC Closure α s;
      simplify H1 ClosedClosure Closure_THM INTER_COMM UNION_OVER_INTER;
      set sSUBt LIMstSUBs;
    qed;
    rewrite LEFT_IMP_EXISTS_THM;     X_genl_TAC D;     intro_TAC Dexists;
    LimitPointOf α (D â© t) â D     [] by fol Dexists CLOSED_IN_SUBSET INTER_SUBSET LimptSubset ClosedLimpt SUBSET_TRANS;
    fol Dexists INTER_SUBSET - SUBSET_REFL INTER_TENSOR;
  qed;
`;;
let ClosedInLimpt_ALT = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    (closed_in (subtopology α t) s  â
    s â t  â§  âx. x â LimitPointOf α s â§ x â t â x â s)
  by simplify SUBSET IN_INTER ClosedInLimpt`;;
let ClosedInInterClosure = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    (closed_in (subtopology α s) t  â  s â© Closure α t = t)
  proof     simplify Closure_THM ClosedInLimpt;     set;     qed;
`;;
let InteriorClosureIdemp = theorem `;
  âα s.  s â topspace α  â
    Interior α (Closure α (Interior α (Closure α s)))
    = Interior α (Closure α s)
  proof
    intro_TAC âα s, H1;
    consider IC CIC such that
    IC = Interior α (Closure α s)  ⧠ CIC = Closure α IC     [CICdef] by fol;
    Closure α s â topspace α     [Ctop] by fol H1 ClosureTopspace;
    IC â topspace α     [ICtop] by fol CICdef - H1 InteriorTopspace;
    CIC â topspace α     [CICtop] by fol CICdef - ClosureTopspace;
    IC â CIC     [ICsubCIC] by fol CICdef ICtop ClosureSubset;
    âu. u â CIC â§ open_in α u â u â IC     [] by fol CICdef Ctop InteriorSubset SubsetClosure H1 ClosureClosure SUBSET_TRANS OpenSubsetInterior;
    fol CICdef CICtop ICsubCIC Ctop OpenInterior - InteriorUnique;
  qed;
`;;
let InteriorClosureIdemp = theorem `;
  âα s.  s â topspace α  â
    Interior α (Closure α (Interior α (Closure α s)))
    = Interior α (Closure α s)
  proof
    intro_TAC âα s, H1;
    Closure α s â topspace α     [Ctop] by fol H1 ClosureTopspace;
    consider IC CIC such that
    IC = Interior α (Closure α s)  ⧠ CIC = Closure α IC     [ICdefs] by fol;
    IC â topspace α     [] by fol - Ctop H1 InteriorTopspace;
    CIC â topspace α  â§  IC â CIC  â§  âu. u â CIC â§ open_in α u â u â IC     [] by fol ICdefs Ctop - ClosureTopspace ClosureSubset InteriorSubset SubsetClosure H1 ClosureClosure SUBSET_TRANS OpenSubsetInterior;
    fol ICdefs - Ctop OpenInterior InteriorUnique;
  qed;
`;;
let ClosureInteriorIdemp = theorem `;
  âα s.  s â topspace α  â
    Closure α (Interior α (Closure α (Interior α s)))
    = Closure α (Interior α s)
  proof
    intro_TAC âα s, H1;
    consider t such that t = topspace α â s     [tDef] by fol;
    t â topspace α  â§  s = topspace α â t     [tProps] by fol - H1 SUBSET_DIFF DIFF_REFL;
    Interior α (Closure α t) â topspace α     [] by fol - ClosureTopspace InteriorTopspace;
    simplify tProps - GSYM InteriorClosureComplement InteriorClosureIdemp;
  qed;
`;;
let InteriorClosureDiffSpaceEmpty = theorem `;
  âα s.  s â topspace α  â  Interior α (Closure α s â s) = â
  proof
    intro_TAC âα s, H1;
    Closure α s â s â topspace α     [Cs_sTop] by fol H1 ClosureTopspace SUBSET_DIFF SUBSET_TRANS;
    assume ¬(Interior α (Closure α s â s) = â
)     [Contradiction] by fol;
    consider x such that
    x â (Interior α (Closure α s â s))     [xExists] by fol - MEMBER_NOT_EMPTY;
    consider t such that
    open_in α t â§ x â t â§ t â (s ⪠LimitPointOf α s) â s     [tProps] by fol - Cs_sTop IN_Interior Closure_DEF;
    t â LimitPointOf α s â§ s â© (t â {x}) = â
     [tSubLIMs] by set -;
    x â LimitPointOf α s â§ x â s     [xLims] by fol tProps - SUBSET IN_DIFF â;
    fol H1 xLims IN_LimitPointOf tProps tSubLIMs NotLimitPointOf â;
  qed;
`;;
let NowhereDenseUnion = theorem `;
  âα s t.  s ⪠t â topspace α  â
    (Interior α (Closure α (s ⪠t)) = â
  â
    Interior α (Closure α s) = â
  â§  Interior α (Closure α t) = â
)
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α     [] by fol H1 UNION_SUBSET;
    simplify H1 - ClosureUnion ClosureTopspace UNION_SUBSET ClosedClosure InteriorUnionEqEmpty;
  qed;
`;;
let NowhereDense = theorem `;
  âα s.  s â topspace α  â
    (Interior α (Closure α s) = â
 â
    ât. open_in α t ⧠¬(t = â
)  â
    âu. open_in α u ⧠¬(u = â
) â§ u â t â§ u â© s = â
)
  proof
    intro_TAC âα s, H1;
    simplify H1 ClosureTopspace InteriorEqEmptyAlt;
    eq_tac     [Left]
    proof
      intro_TAC H2;
      X_genl_TAC t;
      intro_TAC tOpen tNonempty;
      exists_TAC t â Closure α s;
      fol tOpen H1 ClosedClosure OPEN_IN_DIFF tOpen tNonempty H2 SUBSET_DIFF H1 ClosureSubset
      SET_RULE [âs t A.  s â t  â  (A â t) â© s = â
];
    qed;
    intro_TAC H2;
    X_genl_TAC t;
    intro_TAC tOpen tNonempty;
    consider u such that
    open_in α u ⧠¬(u = â
) â§ u â t â§ u â© s = â
     [uExists] by simplify tOpen tNonempty H2;
    MP_TAC ISPECL [α; u; s] OpenInterClosureEqEmpty;
    simplify uExists OPEN_IN_SUBSET H1;
    set uExists;
  qed;
`;;
let InteriorClosureInterOpen = theorem `;
  âα s t.  open_in α s â§ open_in α t  â
    Interior α (Closure α (s ⩠t)) =
    Interior α (Closure α s) ⩠Interior α (Closure α t)
  proof
    intro_TAC âα s t, sOpen tOpen;
    s â topspace α     [sTop] by fol sOpen OPEN_IN_SUBSET;
    t â topspace α     [tTop] by fol tOpen OPEN_IN_SUBSET;
    rewrite SET_RULE [âs t u. u = s â© t  â  s â© t â u â§ u â s â§ u â t];
    simplify sTop tTop INTER_SUBSET SubsetClosure ClosureTopspace SubsetInterior;
    s â© t â topspace α     [stTop] by fol INTER_SUBSET sTop SUBSET_TRANS;
    Closure α s â topspace α  â§  Closure α t â topspace α     [CsCtTop] by fol sTop tTop ClosureTopspace;
    Closure α s â© Closure α t â topspace α     [CsIntCtTop] by fol - INTER_SUBSET SUBSET_TRANS;
    Closure α s â s ⪠Closure α t â t  â  topspace α     [Cs_sUNIONCt_tTop] by fol CsCtTop SUBSET_DIFF UNION_SUBSET SUBSET_TRANS;
    simplify CsCtTop GSYM InteriorInter;
    Interior α (Closure α s â© Closure α t) â Closure α (s â© t)     []
    proof
      simplify CsIntCtTop InteriorTopspace ISPECL [topspace α] COMPLEMENT_DISJOINT stTop ClosureTopspace GSYM ClosureComplement GSYM InteriorComplement CsIntCtTop SUBSET_DIFF GSYM InteriorInter;
      closed_in α (Closure α s â s) â§ closed_in α (Closure α t â t)     [] by fol sTop tTop ClosedClosure sOpen tOpen CLOSED_IN_DIFF;
      Interior α (Closure α s â s ⪠Closure α t â t) = â
     [IntEmpty] by fol Cs_sUNIONCt_tTop - sTop tTop InteriorClosureDiffSpaceEmpty InteriorUnionEqEmpty;
      Closure α s â© Closure α t â© (topspace α â (s â© t))  â
      Closure α s â s ⪠Closure α t â t     [] by set;
      fol Cs_sUNIONCt_tTop - SubsetInterior IntEmpty INTER_ACI SUBSET_EMPTY;
    qed;
    fol stTop ClosureTopspace - CsIntCtTop OpenInterior InteriorMaximal;
  qed;
`;;
let ClosureInteriorUnionClosed = theorem `;
  âα s t.   closed_in α s â§ closed_in α t â
    Closure α (Interior α (s ⪠t))  =
    Closure α (Interior α s) ⪠Closure α (Interior α t)
  proof
    rewrite closed_in;
    intro_TAC âα s t, sClosed tClosed;
    simplify sClosed tClosed ClosureTopspace UNION_SUBSET InteriorTopspace ISPECL [topspace α] COMPLEMENT_DUALITY_UNION;
    simplify sClosed tClosed UNION_SUBSET ClosureTopspace InteriorTopspace ClosureInteriorComplement DIFF_UNION SUBSET_DIFF InteriorClosureInterOpen;
  qed;
`;;
let RegularOpenInter = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    Interior α (Closure α s) = s ⧠Interior α (Closure α t) = t
    â Interior α (Closure α (s â© t)) = s â© t
  by fol ClosureTopspace OpenInterior InteriorClosureInterOpen`;;
let RegularClosedUnion = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    Closure α (Interior α s) = s  ⧠ Closure α (Interior α t) = t
    â Closure α (Interior α (s ⪠t)) = s ⪠t
  by fol InteriorTopspace ClosureInteriorUnionClosed ClosedClosure`;;
let DiffClosureSubset = theorem `;
  âα s t.  s â topspace α â§ t â topspace α  â
    Closure α s â Closure α t â Closure α (s â t)
  proof
    intro_TAC âα s t, sTop tTop;
    Closure α s â Closure α t â Closure α (s â Closure α t)     [] by fol sTop ClosureTopspace tTop ClosedClosure tTop closed_in OpenInterClosureSubset INTER_COMM COMPLEMENT_INTER_DIFF;
    fol - tTop ClosureSubset SUBSET_DUALITY sTop SUBSET_DIFF SUBSET_TRANS SubsetClosure;
  qed;
`;;
let Frontier_DEF = NewDefinition `;
  âα s.  Frontier α s = Closure α s â Interior α s`;;
let Frontier_THM = theorem `;
  âα s.  s â topspace α  â  Frontier α s = Closure α s â Interior α s
  by fol Frontier_DEF`;;
let FrontierTopspace = theorem `;
  âα s.  s â topspace α  â  Frontier α s â topspace α
  by fol Frontier_THM SUBSET_DIFF ClosureTopspace SUBSET_TRANS`;;
let FrontierClosed = theorem `;
  âα s.  s â topspace α  â  closed_in α (Frontier α s)
  by simplify Frontier_THM ClosedClosure OpenInterior CLOSED_IN_DIFF`;;
let FrontierClosures = theorem `;
  âs.  s â topspace α  â
    Frontier α s  =  (Closure α s) â© (Closure α (topspace α â s))
  by simplify SET_RULE [âA s t.  s â A â§ t â A   â  s â (A â t) = s â© t] Frontier_THM InteriorClosure ClosureTopspace SUBSET_DIFF`;;
let FrontierStraddle = theorem `;
  âα a s.  s â topspace α  â  (a â Frontier α s  â
    a â topspace α  â§  ât. open_in α t â§ a â t  â
    (âx. x â s â§ x â t)  â§  (âx. ¬(x â s) â§ x â t))
  proof
    simplify SUBSET_DIFF FrontierClosures IN_INTER SUBSET_DIFF IN_Closure IN_DIFF;
    fol OPEN_IN_SUBSET SUBSET;
  qed;
`;;
let FrontierSubsetClosed = theorem `;
  âα s.  closed_in α s  â  (Frontier α s) â s
  by fol closed_in Frontier_THM ClosureClosed SUBSET_DIFF`;;
let FrontierEmpty = theorem `;
  âα.  Frontier α â
 = â
  by fol Frontier_THM EMPTY_SUBSET ClosureEmpty EMPTY_DIFF`;;
let FrontierUniv = theorem `;
  âα. Frontier α (topspace α) = â
  by fol Frontier_DEF ClosureUniv InteriorUniv DIFF_EQ_EMPTY`;;
let FrontierSubsetEq = theorem `;
  âα s.  s â topspace α  â  ((Frontier α s) â s â closed_in α s)
  proof
    intro_TAC âα s, sTop;
    eq_tac     [Right] by fol FrontierSubsetClosed;
    simplify sTop Frontier_THM ;
    fol sTop InteriorSubset SET_RULE [âs t u. s â t â u â§ t â u â s â u] ClosureSubsetEq;
  qed;
`;;
let FrontierComplement = theorem `;
  âα s.  s â topspace α  â  Frontier α (topspace α â s) = Frontier α s
  proof
    intro_TAC âα s, sTop;
    simplify sTop SUBSET_DIFF Frontier_THM ClosureComplement InteriorComplement;
    fol sTop InteriorTopspace ClosureTopspace SET_RULE [â Top Int Clo.
    Int â Top â§ Clo â Top  â  Top â Int â (Top â Clo) = Clo â Int];
  qed;
`;;
let FrontierComplement = theorem `;
  âα s.  s â topspace α  â  Frontier α (topspace α â s) = Frontier α s
  proof
    intro_TAC âα s, sTop;
    simplify sTop SUBSET_DIFF Frontier_THM ClosureComplement InteriorComplement;
    fol sTop InteriorTopspace ClosureTopspace SET_RULE [â Top Int Clo.
    Int â Top â§ Clo â Top  â  Top â Int â (Top â Clo) = Clo â Int];
  qed;
`;;
let FrontierDisjointEq = theorem `;
  âα s.  s â topspace α   â  ((Frontier α s) â© s = â
  â  open_in α s)
  proof
    intro_TAC âα s, sTop;
    topspace α â s â topspace α     [COMPsTop] by fol sTop SUBSET_DIFF;
    simplify sTop GSYM FrontierComplement OPEN_IN_CLOSED_IN;
    fol COMPsTop GSYM FrontierSubsetEq FrontierTopspace SUBSET_COMPLEMENT;
  qed;
`;;
let FrontierInterSubset = theorem `;
  âα s t.  s ⪠t â topspace α  â  Frontier α (s â© t)  â  Frontier α s ⪠Frontier α t
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α â§ s â© t â topspace α     [] by fol H1 SUBSET_UNION INTER_SUBSET SUBSET_TRANS;
    simplify - Frontier_THM InteriorInter DIFF_INTER INTER_SUBSET SubsetClosure DIFF_SUBSET UNION_TENSOR;
  qed;
`;;
let FrontierUnionSubset = theorem `;
  âα s t.  s ⪠t â topspace α  â
    Frontier α (s ⪠t)  â  Frontier α s ⪠Frontier α t
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α     [stTop] by fol H1 SUBSET_UNION SUBSET_TRANS;
    simplify H1 - GSYM FrontierComplement DIFF_UNION;
    topspace α â s ⪠topspace α â t â topspace α     [] by fol SUBSET_DIFF UNION_SUBSET SUBSET_TRANS;
    fol - FrontierInterSubset;
  qed;
`;;
let FrontierInteriors = theorem `;
  âα s.  s â topspace α  â
    Frontier α s = topspace α â Interior α s â Interior α (topspace α â s)
  by simplify Frontier_THM ClosureInterior DOUBLE_DIFF_UNION UNION_COMM`;;
let FrontierFrontierSubset = theorem `;
  âα s.  s â topspace α  â  Frontier α (Frontier α s) â Frontier α s
  by fol FrontierTopspace Frontier_THM FrontierClosed ClosureClosed SUBSET_DIFF`;;
let InteriorFrontier = theorem `;
  âα s.  s â topspace α  â  Interior α (Frontier α s)  =
    Interior α (Closure α s) â Closure α (Interior α s)
  proof
    intro_TAC âα s, sTop;
    Frontier α s = Closure α s â© (topspace α â Interior α s)     [] by fol sTop Frontier_THM ClosureTopspace COMPLEMENT_INTER_DIFF;
    Interior α (Frontier α s)  =
    Interior α (Closure α s) â© (topspace α â Closure α (Interior α s))     [] by fol - sTop ClosureTopspace InteriorTopspace SUBSET_DIFF InteriorInter InteriorComplement;
    fol - sTop ClosureTopspace InteriorTopspace COMPLEMENT_INTER_DIFF;
  qed;
`;;
let InteriorFrontierEmpty = theorem `;
  âα s.  open_in α s ⨠closed_in α s  â  Interior α (Frontier α s) = â
  by fol InteriorFrontier SET_RULE [âs t. s â t = â
 â s â t] OPEN_IN_SUBSET closed_in
  InteriorOpen ClosureTopspace InteriorSubset
  ClosureClosed InteriorTopspace ClosureSubset`;;
let FrontierFrontier = theorem `;
  âα s.  open_in α s ⨠closed_in α s  â
    Frontier α (Frontier α s) = Frontier α s
  proof
    intro_TAC âα s, openORclosed;
    s â topspace α     [sTop] by fol openORclosed OPEN_IN_SUBSET closed_in;
    Frontier α (Frontier α s) = Closure α (Frontier α s)     [] by fol sTop FrontierTopspace Frontier_THM openORclosed InteriorFrontierEmpty DIFF_EMPTY;
    fol - sTop FrontierClosed ClosureClosed;
  qed;
`;;
let UnionFrontierPart1 = theorem `;
  âα s t.  s ⪠t â topspace α  â
    Frontier α s â© Interior α t  â  Frontier  α (s â© t)
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α â§ s â© t â topspace α     [stTop] by fol H1 SUBSET_UNION INTER_SUBSET SUBSET_TRANS;
    rewrite SUBSET IN_INTER;
    X_genl_TAC a;     intro_TAC aFs aIt;
    consider O such that
    open_in α O â§ a â O â§ O â t     [aOs] by fol aIt stTop IN_Interior;
    a â topspace α     [] by fol stTop aFs FrontierTopspace SUBSET;
    simplify stTop FrontierStraddle -;
    X_genl_TAC P;     intro_TAC Popen aP;
    a â O â© P â§ open_in α (O â© P)     [aOPopen] by fol aOs aP IN_INTER Popen OPEN_IN_INTER;
    consider x y such that
    x â s â§ x â O â© P ⧠¬(y â s) â§ y â O â© P     [xExists] by fol aOs Popen OPEN_IN_INTER aOPopen stTop aFs FrontierStraddle;
    fol xExists aOs IN_INTER SUBSET;
  qed;
`;;
let UnionFrontierPart2 = theorem `;
  âα s t.  s ⪠t â topspace α  â
    Frontier α s â Frontier α t  â
    Frontier α (s ⩠t) ⪠Frontier α (s ⪠t)
  proof
    intro_TAC âα s t, stTop;
    s â topspace α â§ t â topspace α     [] by fol stTop SUBSET_UNION INTER_SUBSET SUBSET_TRANS;
    Frontier α s â Frontier α t = Frontier α s â© Interior α t  âª
    Frontier α (topspace α â s) â© Interior α (topspace α â t)     [] by fol - FrontierTopspace FrontierInteriors FrontierComplement
    SET_RULE [âA s t u. s â A  â  s â (A â t â u) = s â© t ⪠s â© u];
    Frontier α s â Frontier α t  â
    Frontier α (s â© t) ⪠ Frontier α (topspace α â (s ⪠t))     [] by simplify - stTop UnionFrontierPart1 UNION_TENSOR SUBSET_DIFF UNION_SUBSET DIFF_UNION;
    fol - stTop FrontierComplement;
  qed;
`;;
let UnionFrontierPart3 = theorem `;
  âα s t a.  s ⪠t â topspace α  â
    a â Frontier α s â§ a â Frontier α t  â
    a â Frontier α (s â© t)  ⨠ a â Frontier α (s ⪠t)
  proof
    intro_TAC âα s t a, H1;
    rewrite â GSYM IN_INTER GSYM IN_DIFF GSYM IN_UNION;
    fol H1 UnionFrontierPart2 SUBSET;
  qed;
`;;
let UnionFrontier = theorem `;
  âα s t.  s ⪠t â topspace α  â
    Frontier α s ⪠Frontier α t =
    Frontier α (s ⪠t) ⪠Frontier α (s ⩠t) ⪠Frontier α s ⩠Frontier α t
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α     [stTop] by fol H1 SUBSET_UNION INTER_SUBSET SUBSET_TRANS;
    rewrite GSYM SUBSET_ANTISYM_EQ;
    conj_tac     [Right] by fol SET_RULE [âs t. s â© t â s ⪠t] stTop FrontierUnionSubset UNION_SUBSET FrontierInterSubset;
    rewrite SUBSET IN_INTER IN_UNION;
    fol H1 UnionFrontierPart3 INTER_COMM UNION_COMM â;
  qed;
`;;
let ConnectedInterFrontier = theorem `;
  âα s t.  s ⪠t â topspace α  â
    Connected (subtopology α s) ⧠¬(s â© t = â
) ⧠¬(s â t = â
)
    â ¬(s â© Frontier α t = â
)
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α     [stTop] by fol H1 SUBSET_UNION SUBSET_TRANS;
    ONCE_REWRITE_TAC TAUT [âa b c d. a â§ b â§ c â ¬d  â  b â§ c â§ d â ¬a];
    intro_TAC sINTERtNonempty sDIFFtNonempty sInterFtEmpty;
    simplify stTop ConnectedOpenIn;
    exists_TAC s ⩠Interior α t;
    exists_TAC s â© Interior α (topspace α  â  t);
    simplify stTop SUBSET_DIFF OpenInterior OpenInOpenInter;
    Interior α t â t  â§  Interior α (topspace α â t) â topspace α â t     [IntSubs] by fol stTop SUBSET_DIFF InteriorSubset;
    s  â  Interior α t ⪠Interior α (topspace α â t)     [] by fol stTop sInterFtEmpty FrontierInteriors DOUBLE_DIFF_UNION COMPLEMENT_DISJOINT;
    set sDIFFtNonempty sINTERtNonempty IntSubs -;
  qed;
`;;
let InteriorClosedEqEmptyAsFrontier = theorem `;
  âα s.  s â topspace α  â
    (closed_in α s â§ Interior α s = â
  â  ât. open_in α t â§ s = Frontier α t)
  proof
    intro_TAC âα s, sTop;
    eq_tac     [Right] by fol OPEN_IN_SUBSET FrontierClosed InteriorFrontierEmpty;
    intro_TAC sClosed sEmptyInt;
    exists_TAC topspace α â s;
    fol sClosed closed_in sTop FrontierComplement Frontier_THM sEmptyInt DIFF_EMPTY ClosureClosed;
  qed;
`;;
let ClosureUnionFrontier = theorem `;
  âα s.  s â topspace α  â  Closure α s = s ⪠Frontier α s
  proof
    intro_TAC âα s, sTop;
    simplify sTop Frontier_THM;
    s â Closure α s â§ Interior α s â s     [] by fol sTop ClosureSubset InteriorSubset;
    set -;
  qed;
`;;
let FrontierInteriorSubset = theorem `;
  âα s.  s â topspace α  â  Frontier α (Interior α s) â Frontier α s
  by simplify InteriorTopspace Frontier_THM InteriorInterior InteriorSubset SubsetClosure DIFF_SUBSET`;;
let FrontierClosureSubset = theorem `;
  âα s.  s â topspace α  â  Frontier α (Closure α s) â Frontier α s
  by simplify ClosureTopspace Frontier_THM ClosureClosure ClosureTopspace ClosureSubset SubsetInterior SUBSET_DUALITY`;;
let SetDiffFrontier = theorem `;
  âα s.  s â topspace α  â  s â Frontier α s = Interior α s
  proof
    intro_TAC âα s, sTop;
    simplify sTop Frontier_THM;
    s â Closure α s â§ Interior α s â s     [] by fol sTop ClosureSubset InteriorSubset;
    set -;
  qed;
`;;
let FrontierInterSubsetInter = theorem `;
  âα s t.  s ⪠t â topspace α  â
    Frontier α (s â© t)  â
    Closure α s ⩠Frontier α t  ⪠ Frontier α s ⩠Closure α t
  proof
    intro_TAC âα s t, H1;
    s â topspace α â§ t â topspace α â§ s â© t â topspace α     [stTop] by fol H1 SUBSET_UNION INTER_SUBSET SUBSET_TRANS;
    simplify H1 stTop Frontier_THM InteriorInter;
    Closure α (s â© t) â Closure α s â© Closure α t     [] by fol stTop ClosureInterSubset;
    set -;
  qed;
`;;
let FrontierUnionPart1 = theorem `;
  âα s t.  s ⪠t â topspace α  â  Closure α s â© Closure α t = â
    â Frontier α s â© Interior α (s ⪠t) = â
  proof
    intro_TAC âα s t, H1, CsCtDisjoint;
    s â topspace α â§ t â topspace α â§ s â© t â topspace α     [stTop] by fol H1 SUBSET_UNION INTER_SUBSET SUBSET_TRANS;
    Frontier α s â© Interior α (s ⪠t)  â topspace α     [FIstTop] by fol stTop FrontierTopspace INTER_SUBSET SUBSET_TRANS;
    Frontier α s â© Interior α (s ⪠t) â© (topspace α â Closure α t) = â
     []
    proof
      simplify stTop GSYM InteriorComplement H1 SUBSET_DIFF InteriorInter Frontier_THM;
      Interior α (s ⪠t) â© Interior α (topspace α â t)  â Interior α s     [] by
      fol SET_RULE [âA s t. s â A  â  (s ⪠t) â© (A â t) = s â t] H1 SUBSET_DIFF InteriorInter stTop SubsetInterior;
      set -;
    qed;
    Frontier α s â© Interior α (s ⪠t)  â  Closure α t     [] by fol H1 CsCtDisjoint - FIstTop COMPLEMENT_DISJOINT INTER_ACI;
    fol SET_RULE [â s t F I. s â© t = â
 â§ F â s â§ F â© I â t  â  F â© I = â
] CsCtDisjoint stTop Frontier_THM SUBSET_DIFF  -;
  qed;
`;;
let FrontierUnion = theorem `;
  âα s t.  s ⪠t â topspace α  â  Closure α s â© Closure α t = â
    â Frontier α (s ⪠t) = Frontier α s ⪠Frontier α t
  proof
    intro_TAC âα s t, H1, CsCtDisjoint;
    s â topspace α â§ t â topspace α â§ s â© t â topspace α     [stTop] by fol H1 SUBSET_UNION INTER_SUBSET SUBSET_TRANS;
    MATCH_MP_TAC SUBSET_ANTISYM;
    simplify H1 FrontierUnionSubset Frontier_THM;
    Frontier α s â© Interior α (s ⪠t)  =  â
  â§
    Frontier α t â© Interior α (s ⪠t)  =  â
     [usePart1] by fol H1 CsCtDisjoint FrontierUnionPart1 INTER_COMM UNION_COMM;
    Frontier α s â Closure α (s ⪠t)  â§  Frontier α t â Closure α (s ⪠t)     [] by fol stTop Frontier_THM SUBSET_DIFF H1 SUBSET_UNION SubsetClosure SUBSET_TRANS;
    set usePart1 -;
  qed;
`;;
(* ------------------------------------------------------------------------- *)
(* The universal Euclidean versions are what we use most of the time.        *)
(* ------------------------------------------------------------------------- *)
let open_def = NewDefinition `;
  open s  â  âx. x â s â âe. &0 < e â§ âx'. dist(x',x) < e â x' â s`;;
let closed = NewDefinition `;
  closed s â open (UNIV â s)`;;
let OPEN_EMPTY = theorem `;
  open â
  by rewrite open_def NOT_IN_EMPTY`;;
let OPEN_UNIV = theorem `;
  open UNIV
  by fol open_def IN_UNIV REAL_LT_01`;;
let OPEN_INTER = theorem `;
  âs t. open s â§ open t â open (s â© t)
  proof
    intro_TAC âs t, sOpen tOpen;
    rewrite open_def IN_INTER;
    intro_TAC âx, xs xt;
    consider d1 such that
    &0 < d1 â§ âx'. dist (x',x) < d1 â x' â s     [d1Exists] by fol sOpen xs open_def;
    consider d2 such that
    &0 < d2 â§ âx'. dist (x',x) < d2 â x' â t     [d2Exists] by fol tOpen xt open_def;
    consider e such that &0 < e /\ e < d1 /\ e < d2     [eExists] by fol d1Exists d2Exists REAL_DOWN2;
    fol - d1Exists d2Exists REAL_LT_TRANS;
  qed;
`;;
let OPEN_UNIONS = theorem `;
  (âs. s â f â open s)  â  open (UNIONS f)
  by fol open_def IN_UNIONS`;;
let IstopologyEuclidean = theorem `;
    istopology (UNIV, open)
    by simplify istopology IN IN_UNIV SUBSET OPEN_EMPTY OPEN_UNIV OPEN_INTER OPEN_UNIONS`;;
let OPEN_IN = theorem `;
  open  =  open_in euclidean
  by fol euclidean topology_tybij IstopologyEuclidean TopologyPAIR PAIR_EQ`;;
let TOPSPACE_EUCLIDEAN = theorem `;
  topspace euclidean = UNIV
  by fol euclidean IstopologyEuclidean topology_tybij TopologyPAIR PAIR_EQ`;;
let OPEN_EXISTS_IN = theorem `;
  âP Q.  (âa. P a â open {x | Q a x})  â  open {x | âa. P a â§ Q a x}
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN OPEN_IN_EXISTS_IN`;;
let OPEN_EXISTS = theorem `;
  âQ.  (âa. open {x | Q a x})  â  open {x | âa. Q a x}
  proof
    intro_TAC âQ;
    (âa. T â open {x | Q a x}) â open {x | âa. T â§ Q a x}     [] by simplify OPEN_EXISTS_IN;
    MP_TAC -;
    fol;
  qed;
`;;
let TOPSPACE_EUCLIDEAN_SUBTOPOLOGY = theorem `;
 âs. topspace (subtopology euclidean s) = s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN TopspaceSubtopology`;;
let OPEN_IN_REFL = theorem `;
  âs. open_in (subtopology euclidean s) s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN OpenInRefl`;;
let CLOSED_IN_REFL = theorem `;
  âs. closed_in (subtopology euclidean s) s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN ClosedInRefl`;;
let CLOSED_IN = theorem `;
  âs. closed  =  closed_in euclidean
  by fol closed closed_in TOPSPACE_EUCLIDEAN OPEN_IN SUBSET_UNIV EXTENSION IN`;;
let OPEN_UNION = theorem `;
  âs t.  open s â§ open t  â  open(s ⪠t)
  by fol OPEN_IN OPEN_IN_UNION`;;
let OPEN_SUBOPEN = theorem `;
  âs. open s â âx. x â s â ât. open t â§ x â t â§ t â s
  by fol OPEN_IN OPEN_IN_SUBOPEN`;;
let CLOSED_EMPTY = theorem `;
  closed â
  by fol CLOSED_IN CLOSED_IN_EMPTY`;;
let CLOSED_UNIV = theorem `;
  closed UNIV
  by fol CLOSED_IN TOPSPACE_EUCLIDEAN CLOSED_IN_TOPSPACE`;;
let CLOSED_UNION = theorem `;
  âs t.  closed s â§ closed t  â  closed(s ⪠t)
  by fol CLOSED_IN CLOSED_IN_UNION`;;
let CLOSED_INTER = theorem `;
  âs t.  closed s â§ closed t  â  closed(s â© t)
  by fol CLOSED_IN CLOSED_IN_INTER`;;
let CLOSED_INTERS = theorem `;
  âf. (âs. s â f â closed s)  â  closed (INTERS f)
  by fol CLOSED_IN CLOSED_IN_INTERS INTERS_0 CLOSED_UNIV`;;
let CLOSED_FORALL_IN = theorem `;
  âP Q.  (âa. P a â closed {x | Q a x})
    â  closed {x | âa. P a â Q a x}
  proof
    intro_TAC âP Q;
    case_split Pnonempty | Pempty by fol;
    suppose ¬(P = â
);
      simplify CLOSED_IN Pnonempty CLOSED_IN_FORALL_IN;
    end;
    suppose P = â
;
      {x | âa. P a â Q a x} = UNIV     [] by set Pempty;
      simplify - CLOSED_UNIV;
    end;
  qed;
`;;
let CLOSED_FORALL = theorem `;
  âQ. (âa. closed {x | Q a x}) â closed {x | âa. Q a x}
  proof
    intro_TAC âQ;
    (âa. T â closed {x | Q a x}) â closed {x | âa. T â Q a x}     [] by simplify CLOSED_FORALL_IN;
    MP_TAC -;
    fol;
  qed;
`;;
let OPEN_CLOSED = theorem `;
  âs.  open s  â  closed(UNIV â s)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN CLOSED_IN OPEN_IN_CLOSED_IN`;;
let OPEN_DIFF = theorem `;
  âs t.  open s â§ closed t  â  open(s â t)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN CLOSED_IN OPEN_IN_DIFF`;;
let CLOSED_DIFF = theorem `;
  âs t.  closed s â§ open t  â  closed (s â t)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN CLOSED_IN CLOSED_IN_DIFF`;;
let OPEN_INTERS = theorem `;
  âs.  FINITE s â§ (ât. t â s â open t)  â  open (INTERS s)
  by fol OPEN_IN OPEN_IN_INTERS INTERS_0 OPEN_UNIV`;;
let CLOSED_UNIONS = theorem `;
  âs.  FINITE s â§ (ât. t â s â closed t)  â  closed (UNIONS s)
  by fol CLOSED_IN CLOSED_IN_UNIONS`;;
(* ------------------------------------------------------------------------- *)
(* Open and closed balls and spheres.                                        *)
(* ------------------------------------------------------------------------- *)
let IN_BALL = theorem `;
 âx y e. y â ball(x,e)  â  dist(x,y) < e
  by rewrite ball IN_ELIM_THM`;;
let IN_CBALL = theorem `;
  âx y e. y â cball(x, e)  â  dist(x, y) <= e
  by rewrite cball IN_ELIM_THM`;;
let BALL_SUBSET_CBALL = theorem `;
  âx e. ball (x,e) â cball (x, e)
  proof
     rewrite IN_BALL IN_CBALL SUBSET;
     real_arithmetic;
  qed;
`;;
let OPEN_BALL = theorem `;
  âx e. open (ball (x,e))
  proof
    rewrite open_def ball IN_ELIM_THM;
    fol DIST_SYM REAL_SUB_LT REAL_LT_SUB_LADD REAL_ADD_SYM REAL_LET_TRANS DIST_TRIANGLE;
  qed;
`;;
let CENTRE_IN_BALL = theorem `;
  âx e. x â ball(x,e)  â  &0 < e
  by fol IN_BALL DIST_REFL`;;
let OPEN_CONTAINS_BALL = theorem `;
  âs. open s  â  âx. x â s â âe. &0 < e â§ ball(x,e) â s
  by rewrite open_def SUBSET IN_BALL DIST_SYM`;;
let HALF_CBALL_IN_BALL = theorem `;
  âe. &0 < e  â  &0 < e/ &2 â§ e / &2 < e â§ cball (x, e/ &2) â ball (x, e)
  proof
    intro_TAC âe, H1;
     &0 < e/ &2  â§  e / &2 < e     [] by real_arithmetic H1;
     fol - SUBSET IN_CBALL IN_BALL REAL_LET_TRANS;
  qed;
`;;
let OPEN_IN_CONTAINS_CBALL_LEMMA = theorem `;
  ât s x.  x â s  â
    ((âe. &0 < e â§ ball (x, e) â© t â s) â
    (âe. &0 < e â§ cball (x, e) â© t â s))
  by fol BALL_SUBSET_CBALL HALF_CBALL_IN_BALL INTER_TENSOR SUBSET_REFL SUBSET_TRANS`;;
(* ------------------------------------------------------------------------- *)
(* Basic "localization" results are handy for connectedness.                 *)
(* ------------------------------------------------------------------------- *)
let OPEN_IN_OPEN = theorem `;
  âs u.  open_in (subtopology euclidean u) s  â  ât. open t â§ (s = u â© t)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN OpenInSubtopology INTER_COMM`;;
let OPEN_IN_INTER_OPEN = theorem `;
  âs t u.  open_in (subtopology euclidean u) s  â§  open t
    â open_in (subtopology euclidean u) (s â© t)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN OpenInSubtopologyInterOpen`;;
let OPEN_IN_OPEN_INTER = theorem `;
  âu s.  open s  â  open_in (subtopology euclidean u) (u â© s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN OpenInOpenInter`;;
let OPEN_OPEN_IN_TRANS = theorem `;
  âs t.  open s  â§  open t  â§  t â s
    â open_in (subtopology euclidean s) t
  by fol OPEN_IN OpenOpenInTrans`;;
let OPEN_SUBSET = theorem `;
  âs t.  s â t  â§  open s  â  open_in (subtopology euclidean t) s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN OpenSubset`;;
let CLOSED_IN_CLOSED = theorem `;
  âs u.
    closed_in (subtopology euclidean u) s  â  ât. closed t â§ (s = u â© t)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN ClosedInSubtopology INTER_COMM`;;
let CLOSED_SUBSET_EQ = theorem `;
  âu s.  closed s  â  (closed_in (subtopology euclidean u) s  â  s â u)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN ClosedSubsetEq`;;
let CLOSED_IN_INTER_CLOSED = theorem `;
  âs t u.  closed_in (subtopology euclidean u) s  â§  closed t
    â closed_in (subtopology euclidean u) (s â© t)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN ClosedInInterClosed`;;
let CLOSED_IN_CLOSED_INTER = theorem `;
  âu s. closed s  â  closed_in (subtopology euclidean u) (u â© s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN ClosedInClosedInter`;;
let CLOSED_SUBSET = theorem `;
  âs t.  s â t â§ closed s  â  closed_in (subtopology euclidean t) s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN ClosedSubset`;;
let OPEN_IN_SUBSET_TRANS = theorem `;
  âs t u.  open_in (subtopology euclidean u) s  â§  s â t  â§  t â u
    â open_in (subtopology euclidean t) s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN OpenInSubsetTrans`;;
let CLOSED_IN_SUBSET_TRANS = theorem `;
  âs t u.  closed_in (subtopology euclidean u) s  â§  s â t  â§  t â u
    â closed_in (subtopology euclidean t) s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN ClosedInSubsetTrans`;;
let OPEN_IN_CONTAINS_BALL_LEMMA = theorem `;
  ât s x.  x â s  â
    ((âE. open E  â§  x â E  â§  E â© t â s)  â
    (âe. &0 < e  â§  ball (x,e) â© t â s))
  proof
    intro_TAC â t s x, xs;
    eq_tac     [Right] by fol CENTRE_IN_BALL OPEN_BALL;
    intro_TAC H2;
    consider a such that
    open a â§ x â a â§ a â© t â s     [aExists] by fol H2;
    consider e such that
    &0 < e â§ ball(x,e) â a     [eExists] by fol - OPEN_CONTAINS_BALL;
    fol aExists - INTER_SUBSET GSYM SUBSET_INTER SUBSET_TRANS;
  qed;
`;;
let OPEN_IN_CONTAINS_BALL = theorem `;
  âs t.  open_in (subtopology euclidean t) s  â
    s â t  â§  âx. x â s â âe. &0 < e â§ ball(x,e) â© t â s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN SubtopologyOpenInSubopen GSYM OPEN_IN GSYM OPEN_IN_CONTAINS_BALL_LEMMA`;;
let OPEN_IN_CONTAINS_CBALL = theorem `;
  âs t.  open_in (subtopology euclidean t) s  â
    s â t  â§  âx. x â s â âe. &0 < e â§ cball(x,e) â© t â s
  by fol OPEN_IN_CONTAINS_BALL OPEN_IN_CONTAINS_CBALL_LEMMA`;;
let open_in = theorem `;
  âu s.  open_in (subtopology euclidean u) s   â
    s â u  â§
    âx. x â s â âe. &0 < e â§
    âx'. x' â u â§ dist(x',x) < e â x' â s
  by rewrite OPEN_IN_CONTAINS_BALL IN_INTER SUBSET IN_BALL CONJ_SYM DIST_SYM`;;
(* ------------------------------------------------------------------------- *)
(* These "transitivity" results are handy too.                               *)
(* ------------------------------------------------------------------------- *)
let OPEN_IN_TRANS = theorem `;
  âs t u. open_in (subtopology euclidean t) s  â§
    open_in (subtopology euclidean u) t
    â open_in (subtopology euclidean u) s
  proof
    intro_TAC âs t u;
    t â topspace euclidean  â§  u â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol - OPEN_IN OpenInTrans;
  qed;
`;;
let OPEN_IN_TRANS_EQ = theorem `;
  âs t.  (âu. open_in (subtopology euclidean t) u
    â  open_in (subtopology euclidean s) t)
    â  open_in (subtopology euclidean s) t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN OpenInTransEq`;;
let OPEN_IN_OPEN_TRANS = theorem `;
  âu s.  open_in (subtopology euclidean u) s â§ open u  â  open s
  proof
    intro_TAC âu s, H1;
    u â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol - H1 OPEN_IN OpenInOpenTrans;
  qed;
`;;
let CLOSED_IN_TRANS = theorem `;
  âs t u.  closed_in (subtopology euclidean t) s  â§
    closed_in (subtopology euclidean u) t
    â closed_in (subtopology euclidean u) s
  proof
    intro_TAC âs t u;
    t â topspace euclidean â§ u â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol - ClosedInSubtopologyTrans;
  qed;
`;;
let CLOSED_IN_TRANS_EQ = theorem `;
  âs t.
    (âu. closed_in (subtopology euclidean t) u â closed_in (subtopology euclidean s) t)
    â closed_in (subtopology euclidean s) t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN ClosedInSubtopologyTransEq`;;
let CLOSED_IN_CLOSED_TRANS = theorem `;
  âs u. closed_in (subtopology euclidean u) s â§ closed u â closed s
  proof
    intro_TAC âu s;
    u â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol - CLOSED_IN ClosedInClosedTrans;
  qed;
`;;
let OPEN_IN_SUBTOPOLOGY_INTER_SUBSET = theorem `;
  âs u v. open_in (subtopology euclidean u) (u â© s)  â§  v â u
    â open_in (subtopology euclidean v) (v â© s)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN OpenInSubtopologyInterSubset`;;
let OPEN_IN_OPEN_EQ = theorem `;
  âs t.  open s  â  (open_in (subtopology euclidean s) t â open t â§ t â s)
  by fol OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN OpenInOpenEq`;;
let CLOSED_IN_CLOSED_EQ = theorem `;
  âs t.  closed s  â
    (closed_in (subtopology euclidean s) t â closed t â§ t â s)
  by fol CLOSED_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN ClosedInClosedEq`;;
(* ------------------------------------------------------------------------- *)
(* Also some invariance theorems for relative topology.                      *)
(* ------------------------------------------------------------------------- *)
let OPEN_IN_INJECTIVE_LINEAR_IMAGE = theorem `;
  âf s t.  linear f â§ (âx y. f x = f y â x = y) â
    (open_in (subtopology euclidean (IMAGE f t)) (IMAGE f s) â
    open_in (subtopology euclidean t) s)
  proof
    rewrite open_in FORALL_IN_IMAGE IMP_CONJ SUBSET;
    intro_TAC âf s t, H1, H2;
    âx s. f x â IMAGE f s â x â s     [fInjMap] by set H2;
    rewrite -;
    âx y. f x - f y = f (x - y)     [fSubLinear] by fol H1 LINEAR_SUB;
    consider B1 such that
    &0 < B1  â§  âx. norm (f x) <= B1 * norm x     [B1exists] by fol H1 LINEAR_BOUNDED_POS;
    consider B2 such that
    &0 < B2  â§  âx. norm x * B2 <= norm (f x)     [B2exists] by fol H1 H2 LINEAR_INJECTIVE_BOUNDED_BELOW_POS;
    AP_TERM_TAC;
    eq_tac     [Left]
    proof
      intro_TAC H3, âx, xs;
      consider e such that
      &0 < e  â§  âx'. x' â t â dist (f x',f x) < e â x' â s     [eExists] by fol H3 xs;
      exists_TAC e / B1;
      simplify REAL_LT_DIV eExists B1exists;
      intro_TAC âx', x't;
      âx. norm(f x) <= B1 * norm(x)  â§ norm(x) * B1 < e  â  norm(f x) < e     [normB1] by real_arithmetic;
      simplify fSubLinear B1exists H3 eExists x't normB1 dist REAL_LT_RDIV_EQ;
    qed;
    intro_TAC H3, âx, xs;
    consider e such that
    &0 < e  â§  âx'. x' â t â dist (x',x) < e â x' â s     [eExists] by fol H3 xs;
    exists_TAC e * B2;
    simplify REAL_LT_MUL eExists B2exists;
    intro_TAC âx', x't;
    âx. norm x <= norm (f x) / B2 â§ norm(f x) / B2 < e  â  norm x < e     [normB2] by real_arithmetic;
    simplify fSubLinear B2exists H3 eExists x't normB2 dist REAL_LE_RDIV_EQ REAL_LT_LDIV_EQ;
  qed;
`;;
add_linear_invariants [OPEN_IN_INJECTIVE_LINEAR_IMAGE];;
let CLOSED_IN_INJECTIVE_LINEAR_IMAGE = theorem `;
  âf s t. linear f â§ (âx y. f x = f y â x = y)  â
    (closed_in (subtopology euclidean (IMAGE f t)) (IMAGE f s)  â
    closed_in (subtopology euclidean t) s)
  proof
    rewrite closed_in TOPSPACE_EUCLIDEAN_SUBTOPOLOGY;
    GEOM_TRANSFORM_TAC[];
  qed;
`;;
add_linear_invariants [CLOSED_IN_INJECTIVE_LINEAR_IMAGE];;
(* ------------------------------------------------------------------------- *)
(* Subspace topology results only proved for Euclidean space.                *)
(* ------------------------------------------------------------------------- *)
(* ISTOPLOGY_SUBTOPOLOGY can not be proved, as the definition of topology    *)
(* there is different from the one here.                                     *)
let OPEN_IN_SUBTOPOLOGY = theorem `;
  âu s.  open_in (subtopology euclidean u) s  â
    ât. open_in euclidean t â§ s = t â© u
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN OpenInSubtopology`;;
let TOPSPACE_SUBTOPOLOGY = theorem `;
  âu.  topspace(subtopology euclidean u) = topspace euclidean â© u
  proof
    intro_TAC âu;
    u â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol - TopspaceSubtopology INTER_COMM SUBSET_INTER_ABSORPTION;
  qed;
`;;
let CLOSED_IN_SUBTOPOLOGY = theorem `;
  âu s. closed_in (subtopology euclidean u) s  â
  ât. closed_in euclidean t â§ s = t â© u
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closed_in ClosedInSubtopology`;;
let OPEN_IN_SUBTOPOLOGY_REFL = theorem `;
  âu. open_in (subtopology euclidean u) u  â  u â topspace euclidean
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN OPEN_IN_REFL`;;
let CLOSED_IN_SUBTOPOLOGY_REFL = theorem `;
  âu. closed_in (subtopology euclidean u) u  â  u â topspace euclidean
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN_REFL`;;
let SUBTOPOLOGY_UNIV = theorem `;
  subtopology euclidean UNIV = euclidean
  proof
    rewrite GSYM Topology_Eq;
    conj_tac     [Left] by fol TOPSPACE_EUCLIDEAN TOPSPACE_EUCLIDEAN_SUBTOPOLOGY;
    rewrite GSYM OPEN_IN OPEN_IN_OPEN INTER_UNIV;
    fol;
  qed;
`;;
let SUBTOPOLOGY_SUPERSET = theorem `;
  âs.  topspace euclidean â s  â  subtopology euclidean s = euclidean
  by simplify TOPSPACE_EUCLIDEAN UNIV_SUBSET SUBTOPOLOGY_UNIV`;;
let OPEN_IN_IMP_SUBSET = theorem `;
  âs t.  open_in (subtopology euclidean s) t  â  t â s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN OpenInImpSubset`;;
let CLOSED_IN_IMP_SUBSET = theorem `;
  âs t.  closed_in (subtopology euclidean s) t  â  t â s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN ClosedInImpSubset`;;
let OPEN_IN_SUBTOPOLOGY_UNION = theorem `;
  âs t u.  open_in (subtopology euclidean t) s  â§
    open_in (subtopology euclidean u) s
    â  open_in (subtopology euclidean (t ⪠u)) s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN OpenInSubtopologyUnion`;;
let CLOSED_IN_SUBTOPOLOGY_UNION = theorem `;
  âs t u.  closed_in (subtopology euclidean t) s  â§
    closed_in (subtopology euclidean u) s
    â  closed_in (subtopology euclidean (t ⪠u)) s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN ClosedInSubtopologyUnion`;;
(* ------------------------------------------------------------------------- *)
(* Connectedness.                                                            *)
(* ------------------------------------------------------------------------- *)
let connected_DEF = NewDefinition `;
  connected s  â  Connected (subtopology euclidean s)`;;
let connected = theorem `;
  âs.  connected s  â  Â¬(âe1 e2.
    open e1  â§  open e2  â§  s â e1 ⪠e2  â§
    e1 â© e2 â© s = â
  â§  ¬(e1 â© s = â
)  â§  ¬(e2 â© s = â
))
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN connected_DEF OPEN_IN ConnectedSubtopology`;;
let CONNECTED_CLOSED = theorem `;
  âs.  connected s â
    ¬(âe1 e2. closed e1  â§  closed e2  â§  s â e1 ⪠e2  â§
    e1 â© e2 â© s = â
  â§  ¬(e1 â© s = â
)  â§  ¬(e2 â© s = â
))
  by simplify connected_DEF CLOSED_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN connected_DEF CLOSED_IN ConnectedClosedSubtopology`;;
let CONNECTED_OPEN_IN = theorem `;
  âs. connected s  â  Â¬(âe1 e2.
    open_in (subtopology euclidean s) e1 â§
    open_in (subtopology euclidean s) e2 â§
    s â e1 ⪠e2  â§  e1 â© e2 = â
  â§  ¬(e1 = â
)  â§  ¬(e2 = â
))
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN connected_DEF OPEN_IN ConnectedOpenIn`;;
let CONNECTED_OPEN_IN_EQ = theorem `;
  âs. connected s  â  Â¬(âe1 e2.
    open_in (subtopology euclidean s) e1 â§
    open_in (subtopology euclidean s) e2 â§
    e1 ⪠e2 = s â§ e1 â© e2 = â
 â§
    ¬(e1 = â
) ⧠¬(e2 = â
))
  by simplify connected_DEF Connected_DEF SUBSET_UNIV TOPSPACE_EUCLIDEAN TopspaceSubtopology EQ_SYM_EQ`;;
let CONNECTED_CLOSED_IN = theorem `;
  âs. connected s  â  Â¬(âe1 e2.
    closed_in (subtopology euclidean s) e1 â§
    closed_in (subtopology euclidean s) e2 â§
    s â e1 ⪠e2  â§  e1 â© e2 = â
  â§  ¬(e1 = â
)  â§  ¬(e2 = â
))
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN connected_DEF CLOSED_IN ConnectedClosedIn`;;
let CONNECTED_CLOSED_IN_EQ = theorem `;
  âs. connected s  â  Â¬(âe1 e2.
    closed_in (subtopology euclidean s) e1  â§
    closed_in (subtopology euclidean s) e2  â§
    e1 ⪠e2 = s  â§  e1 â© e2 = â
  â§  ¬(e1 = â
)  â§  ¬(e2 = â
))
  by simplify connected_DEF ConnectedClosed SUBSET_UNIV TOPSPACE_EUCLIDEAN TopspaceSubtopology EQ_SYM_EQ`;;
let CONNECTED_CLOPEN = theorem `;
  âs. connected s  â
    ât. open_in (subtopology euclidean s) t  â§
      closed_in (subtopology euclidean s) t â t = â
 ⨠t = s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN connected_DEF ConnectedClopen TopspaceSubtopology`;;
let CONNECTED_CLOSED_SET = theorem `;
  âs.  closed s â
    (connected s  â
    ¬(âe1 e2. closed e1 â§ closed e2 â§
    ¬(e1 = â
)  â§  ¬(e2 = â
)  â§  e1 ⪠e2 = s  â§  e1 â© e2 = â
))
  by simplify connected_DEF CLOSED_IN  closed_in ConnectedClosedSet`;;
let CONNECTED_OPEN_SET = theorem `;
  âs.  open s  â
    (connected s â
    ¬(âe1 e2.  open e1  â§  open e2  â§
    ¬(e1 = â
)  â§  ¬(e2 = â
)  â§  e1 ⪠e2 = s  â§  e1 â© e2 = â
))
  by simplify connected_DEF OPEN_IN ConnectedOpenSet`;;
let CONNECTED_EMPTY = theorem `;
  connected â
  by rewrite connected_DEF ConnectedEmpty`;;
let CONNECTED_SING = theorem `;
  âa. connected {a}
  proof
    intro_TAC âa;
    a â topspace euclidean     [] by fol IN_UNIV TOPSPACE_EUCLIDEAN;
    fol - ConnectedSing connected_DEF;
  qed;
`;;
let CONNECTED_UNIONS = theorem `;
  âP.  (âs. s â P â connected s) ⧠¬(INTERS P = â
)
    â connected(UNIONS P)
  proof
    intro_TAC âP;
    âs. s â P â s â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol - connected_DEF ConnectedUnions;
  qed;
`;;
let CONNECTED_UNION = theorem `;
  âs t.  connected s  â§  connected t  â§  ¬(s â© t = â
)
    â connected (s ⪠t)
  proof
    intro_TAC âs t;
    s â topspace euclidean  â§  t â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol - connected_DEF ConnectedUnion;
  qed;
`;;
let CONNECTED_DIFF_OPEN_FROM_CLOSED = theorem `;
  âs t u.  s â t  â§  t â u  â§  open s  â§  closed t  â§
    connected u â§ connected(t â s)
    â  connected(u â s)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN connected_DEF OPEN_IN CLOSED_IN ConnectedDiffOpenFromClosed`;;
let CONNECTED_DISJOINT_UNIONS_OPEN_UNIQUE = theorem `;
  âf f'.  pairwise DISJOINT f â§ pairwise DISJOINT f' â§
    (âs. s â f â open s â§ connected s ⧠¬(s = â
)) â§
    (âs. s â f' â open s â§ connected s ⧠¬(s = â
)) â§
    UNIONS f = UNIONS f'
    â f = f'
  by rewrite connected_DEF OPEN_IN ConnectedDisjointUnionsOpenUnique`;;
let CONNECTED_FROM_CLOSED_UNION_AND_INTER = theorem `;
  âs t.  closed s â§ closed t â§ connected (s ⪠t) â§ connected (s â© t)
    â connected s â§ connected t
  proof
    intro_TAC âs t;
    s ⪠t â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol -  connected_DEF CLOSED_IN ConnectedFromClosedUnionAndInter;
  qed;
`;;
let CONNECTED_FROM_OPEN_UNION_AND_INTER = theorem `;
  âs t.  open s â§ open t â§ connected (s ⪠t) â§ connected (s â© t)
    â connected s â§ connected t
  proof
    intro_TAC âs t;
    s ⪠t â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    fol -  connected_DEF OPEN_IN ConnectedFromOpenUnionAndInter;
  qed;
`;;
(* ------------------------------------------------------------------------- *)
(* Sort of induction principle for connected sets.                           *)
(* ------------------------------------------------------------------------- *)
let CONNECTED_INDUCTION = theorem `;
  âP Q s.  connected s â§
    (ât a. open_in (subtopology euclidean s) t â§ a â t  â  âz. z â t â§ P z) â§
    (âa. a â s  â  ât. open_in (subtopology euclidean s) t â§ a â t â§
    âx y. x â t â§ y â t â§ P x â§ P y â§ Q x â Q y)
    â âa b. a â s â§ b â s â§ P a â§ P b â§ Q a â Q b
  proof
    intro_TAC âP Q s;
    s â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    MP_TAC -;
    rewrite connected_DEF ConnectedInduction;
  qed;
`;;
let CONNECTED_EQUIVALENCE_RELATION_GEN_LEMMA = theorem `;
  âP R s.
        connected s â§
        (âx y z. R x y â§ R y z â R x z) â§
        (ât a. open_in (subtopology euclidean s) t â§ a â t
               â âz. z â t â§ P z) â§
        (âa. a â s
             â ât. open_in (subtopology euclidean s) t â§ a â t â§
                     âx y. x â t â§ y â t â§ P x â§ P y â R x y)
        â âa b. a â s â§ b â s â§ P a â§ P b â R a b
  proof
    intro_TAC âP R s;
    s â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    MP_TAC -;
    rewrite connected_DEF ConnectedEquivalenceRelationGen;
  qed;
`;;
let CONNECTED_EQUIVALENCE_RELATION_GEN = theorem `;
  âP R s.
        connected s â§
        (âx y. R x y â R y x) â§
        (âx y z. R x y â§ R y z â R x z) â§
        (ât a. open_in (subtopology euclidean s) t â§ a â t
               â âz. z â t â§ P z) â§
        (âa. a â s
             â ât. open_in (subtopology euclidean s) t â§ a â t â§
                     âx y. x â t â§ y â t â§ P x â§ P y â R x y)
        â âa b. a â s â§ b â s â§ P a â§ P b â R a b
  proof
    intro_TAC âP R s;
    MP_TAC ISPECL [P; R; s] CONNECTED_EQUIVALENCE_RELATION_GEN_LEMMA;
    fol;
  qed;
`;;
let CONNECTED_INDUCTION_SIMPLE = theorem `;
  âP s.  connected s â§ (âa. a â s
    â ât. open_in (subtopology euclidean s) t â§ a â t â§
    âx y. x â t â§ y â t â§ P x â P y)
    â âa b. a â s â§ b â s â§ P a â P b
  proof
    intro_TAC âP s;
    s â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    MP_TAC -;
    rewrite connected_DEF ConnectedInductionSimple;
  qed;
`;;
let CONNECTED_EQUIVALENCE_RELATION = theorem `;
  âR s.  connected s â§
    (âx y. R x y â R y x) â§ (âx y z. R x y â§ R y z â R x z) â§
    (âa. a â s
    â ât. open_in (subtopology euclidean s) t â§ a â t â§ âx. x â t â R a x)
    â âa b. a â s â§ b â s â R a b
  proof
    intro_TAC âR s;
    s â topspace euclidean     [] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN;
    MP_TAC -;
    rewrite connected_DEF ConnectedEquivalenceRelation;
  qed;
`;;
(* ------------------------------------------------------------------------- *)
(* Limit points.                                                             *)
(* ------------------------------------------------------------------------- *)
parse_as_infix ("limit_point_of",(12,"right"));;
let limit_point_of_DEF = NewDefinition `;
  x limit_point_of s  â  x â LimitPointOf euclidean s`;;
let limit_point_of = theorem `;
  x limit_point_of s  â
    ât. x â t â§ open t  â  ây. ¬(y = x) â§ y â s â§ y â t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN IN_UNIV IN_LimitPointOf limit_point_of_DEF OPEN_IN`;;
let LIMPT_SUBSET = theorem `;
  âx s t.  x limit_point_of s â§ s â t  â  x limit_point_of t
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN limit_point_of_DEF LimptSubset SUBSET`;;
let CLOSED_LIMPT = theorem `;
  âs.  closed s  â  âx. x limit_point_of s â x â s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN IN_UNIV limit_point_of_DEF CLOSED_IN ClosedLimpt SUBSET`;;
let LIMPT_EMPTY = theorem `;
  âx.  ¬(x limit_point_of â
)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN IN_UNIV limit_point_of_DEF GSYM â LimptEmpty`;;
let NO_LIMIT_POINT_IMP_CLOSED = theorem `;
  âs. ¬(âx. x limit_point_of s) â closed s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN IN_UNIV limit_point_of_DEF CLOSED_IN NoLimitPointImpClosed NOT_EXISTS_THM â`;;
let LIMIT_POINT_UNION = theorem `;
  âs t x.  x limit_point_of (s ⪠t)  â
    x limit_point_of s  ⨠ x limit_point_of t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN IN_UNIV limit_point_of_DEF LimitPointUnion EXTENSION IN_UNION`;;
let LimitPointOf_euclidean = theorem `;
  âs.  LimitPointOf euclidean s = {x | x limit_point_of s}
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN IN_UNIV limit_point_of_DEF LimitPointOf IN_ELIM_THM EXTENSION`;;
(* ------------------------------------------------------------------------- *)
(* Interior of a set.                                                        *)
(* ------------------------------------------------------------------------- *)
let interior_DEF = NewDefinition `;
  interior = Interior euclidean`;;
let interior = theorem `;
  âs. interior s = {x | ât. open t â§ x â t â§ t â s}
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF Interior_DEF OPEN_IN`;;
let INTERIOR_EQ = theorem `;
  âs.  interior s = s  â  open s
  by simplify interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN InteriorEq EQ_SYM_EQ`;;
let INTERIOR_OPEN = theorem `;
  âs.  open s  â  interior s = s
  by fol interior_DEF OPEN_IN InteriorOpen`;;
let INTERIOR_EMPTY = theorem `;
  interior â
 = â
  by fol interior_DEF OPEN_IN InteriorEmpty`;;
let INTERIOR_UNIV = theorem `;
  interior UNIV = UNIV
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF InteriorUniv`;;
let OPEN_INTERIOR = theorem `;
  âs. open (interior s)
  by simplify interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN  OpenInterior`;;
let INTERIOR_INTERIOR = theorem `;
  âs. interior (interior s) = interior s
  by simplify interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN  InteriorInterior`;;
let INTERIOR_SUBSET = theorem `;
  âs. interior s â s
  by simplify interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN  InteriorSubset`;;
let SUBSET_INTERIOR = theorem `;
  âs t.  s â t  â  interior s â interior t
  by simplify interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN SubsetInterior`;;
let INTERIOR_MAXIMAL = theorem `;
  âs t.  t â s â§ open t  â  t â interior s
  by simplify interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN InteriorMaximal`;;
let INTERIOR_MAXIMAL_EQ = theorem `;
  âs t.  open s  â  (s â interior t â s â t)
  by simplify interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN InteriorMaximalEq`;;
let INTERIOR_UNIQUE = theorem `;
  âs t.  t â s  â§  open t â§  (ât'. t' â s â§ open t' â t' â t)
    â interior s = t
  by simplify interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN InteriorUnique`;;
let IN_INTERIOR = theorem `;
  âx s.  x â interior s  â  âe. &0 < e â§ ball(x,e) â s
  proof
    simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF IN_Interior GSYM OPEN_IN;
    fol OPEN_CONTAINS_BALL SUBSET_TRANS CENTRE_IN_BALL OPEN_BALL;
  qed;
`;;
let OPEN_SUBSET_INTERIOR = theorem `;
  âs t.  open s  â  (s â interior t  â  s â t)
  by fol interior_DEF OPEN_IN SUBSET_UNIV TOPSPACE_EUCLIDEAN OpenSubsetInterior`;;
let INTERIOR_INTER = theorem `;
  âs t. interior (s â© t) = interior s â© interior t
  by simplify interior_DEF SUBSET_UNIV TOPSPACE_EUCLIDEAN InteriorInter`;;
let INTERIOR_FINITE_INTERS = theorem `;
  âs.  FINITE s  â  interior (INTERS s) = INTERS (IMAGE interior s)
  proof
  intro_TAC âs, H1;
  assume ¬(s = â
)     [sNonempty] by simplify INTERS_0 IMAGE_CLAUSES INTERIOR_UNIV;
      simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN H1 sNonempty interior_DEF InteriorFiniteInters;
  qed;
`;;
let INTERIOR_FINITE_INTERS = theorem `;
  âs.  FINITE s  â  interior (INTERS s) = INTERS (IMAGE interior s)
  proof
  intro_TAC âs, H1;
  assume s = â
     [sEmpty] by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN H1 interior_DEF InteriorFiniteInters;
  rewrite INTERS_0 IMAGE_CLAUSES sEmpty INTERIOR_UNIV;
  qed;
`;;
let INTERIOR_INTERS_SUBSET = theorem `;
  âf.  interior (INTERS f) â INTERS (IMAGE interior f)
  proof
    intro_TAC âf;
    assume f = â
     [fEmpty] by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF InteriorIntersSubset;
    rewrite INTERS_0 IMAGE_CLAUSES - INTERIOR_UNIV SUBSET_REFL;
  qed;
`;;
let UNION_INTERIOR_SUBSET = theorem `;
  âs t.  interior s ⪠interior t  â  interior(s ⪠t)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF UnionInteriorSubset`;;
let INTERIOR_EQ_EMPTY = theorem `;
  âs.  interior s = â
  â  ât. open t â§ t â s â t = â
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF OPEN_IN InteriorEqEmpty`;;
let INTERIOR_EQ_EMPTY_ALT = theorem `;
  âs.  interior s = â
  â  ât. open t ⧠¬(t = â
) â ¬(t â s = â
)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF OPEN_IN InteriorEqEmptyAlt`;;
let INTERIOR_UNIONS_OPEN_SUBSETS = theorem `;
  âs.  UNIONS {t | open t â§ t â s} = interior s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF OPEN_IN InteriorUnionsOpenSubsets`;;
(* ------------------------------------------------------------------------- *)
(* Closure of a set.                                                         *)
(* ------------------------------------------------------------------------- *)
let closure_DEF = NewDefinition `;
  closure = Closure euclidean`;;
let closure = theorem `;
  âs.  closure s = s UNION {x | x limit_point_of s}
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF LimitPointOf_euclidean Closure_THM`;;
let CLOSURE_INTERIOR = theorem `;
  âs. closure s = UNIV â interior (UNIV â s)
  proof
    rewrite closure_DEF GSYM TOPSPACE_EUCLIDEAN interior_DEF;
    simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN ClosureInterior;
  qed;
`;;
let INTERIOR_CLOSURE = theorem `;
  âs.  interior s = UNIV â (closure (UNIV â s))
  proof
    rewrite closure_DEF GSYM TOPSPACE_EUCLIDEAN  interior_DEF;
    simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN InteriorClosure;
  qed;
`;;
let CLOSED_CLOSURE = theorem `;
  âs.  closed (closure s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosedClosure`;;
let CLOSURE_SUBSET = theorem `;
  âs.  s â closure s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosureSubset`;;
let SUBSET_CLOSURE = theorem `;
  âs t.  s â t  â  closure s â closure t
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF SubsetClosure`;;
let CLOSURE_HULL = theorem `;
  âs. closure s = closed hull s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosureHull`;;
let CLOSURE_EQ = theorem `;
  âs.  closure s = s  â  closed s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosureEq`;;
let CLOSURE_CLOSED = theorem `;
  âs.  closed s  â  closure s = s
  by fol CLOSED_IN closure_DEF ClosureClosed`;;
let CLOSURE_CLOSURE = theorem `;
  âs.  closure (closure s) = closure s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosureClosure`;;
let CLOSURE_UNION = theorem `;
  âs t.  closure (s ⪠t)  =  closure s ⪠closure t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosureUnion`;;
let CLOSURE_INTER_SUBSET = theorem `;
  âs t.  closure (s â© t)  â  closure s â© closure t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosureInterSubset`;;
let CLOSURE_INTERS_SUBSET = theorem `;
  âf.  closure (INTERS f)  â  INTERS (IMAGE closure f)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosureIntersSubset`;;
let CLOSURE_MINIMAL = theorem `;
  âs t.  s â t â§ closed t  â  closure s â t
  by fol CLOSED_IN closure_DEF ClosureMinimal`;;
let CLOSURE_MINIMAL_EQ = theorem `;
  âs t.  closed t  â  (closure s â t â s â t)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN closure_DEF ClosureMinimalEq`;;
let CLOSURE_UNIQUE = theorem `;
  âs t.  s â t â§ closed t â§ (ât'. s â t' â§ closed t' â t â t')
    â closure s = t
  by fol CLOSED_IN closure_DEF ClosureUnique`;;
let CLOSURE_EMPTY = theorem `;
  closure â
 = â
  by fol closure_DEF ClosureEmpty`;;
let CLOSURE_UNIV = theorem `;
  closure UNIV = UNIV
  by fol TOPSPACE_EUCLIDEAN closure_DEF ClosureUniv`;;
let CLOSURE_UNIONS = theorem `;
  âf.  FINITE f  â  closure (UNIONS f) = UNIONS {closure s | s â f}
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF ClosureUnions`;;
let CLOSURE_EQ_EMPTY = theorem `;
  âs.  closure s = â
  â  s = â
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF ClosureEqEmpty`;;
let CLOSURE_SUBSET_EQ = theorem `;
  âs.  closure s â s  â  closed s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF CLOSED_IN ClosureSubsetEq`;;
let OPEN_INTER_CLOSURE_EQ_EMPTY = theorem `;
  âs t.  open s  â  (s â© closure t = â
  â  s â© t = â
)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF OPEN_IN OpenInterClosureEqEmpty`;;
let OPEN_INTER_CLOSURE_SUBSET = theorem `;
  âs t.  open s  â  s â© closure t â closure (s â© t)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF OPEN_IN OpenInterClosureSubset`;;
let CLOSURE_OPEN_INTER_SUPERSET = theorem `;
  âs t.  open s â§ s â closure t  â  closure (s â© t) = closure s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF OPEN_IN ClosureOpenInterSuperset`;;
let CLOSURE_COMPLEMENT = theorem `;
  âs.  closure (UNIV â s) = UNIV â interior s
  proof
    rewrite closure_DEF GSYM TOPSPACE_EUCLIDEAN  interior_DEF;
    simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN ClosureComplement;
  qed;
`;;
let INTERIOR_COMPLEMENT = theorem `;
  âs.  interior (UNIV â s) = UNIV â closure s
  proof
    rewrite closure_DEF GSYM TOPSPACE_EUCLIDEAN  interior_DEF;
    simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN InteriorComplement;
  qed;
`;;
let CONNECTED_INTERMEDIATE_CLOSURE = theorem `;
  âs t.  connected s â§ s â t â§ t â closure s  â  connected t
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF connected_DEF ConnectedIntermediateClosure`;;
let CONNECTED_CLOSURE = theorem `;
  âs.  connected s  â  connected (closure s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF connected_DEF ConnectedClosure`;;
let CONNECTED_UNION_STRONG = theorem `;
  âs t.  connected s â§ connected t ⧠¬(closure s â© t = â
)
        â connected (s ⪠t)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF connected_DEF ConnectedUnionStrong`;;
let INTERIOR_DIFF = theorem `;
  âs t.  interior (s â t) = interior s â closure t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF interior_DEF InteriorDiff`;;
let CLOSED_IN_LIMPT = theorem `;
  âs t.  closed_in (subtopology euclidean t) s  â
    s â t  â§  âx. x limit_point_of s â§ x â t â x â s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF limit_point_of_DEF ClosedInLimpt_ALT`;;
let CLOSED_IN_INTER_CLOSURE = theorem `;
  âs t.  closed_in (subtopology euclidean s) t  â  s â© closure t = t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF limit_point_of_DEF ClosedInInterClosure`;;
let INTERIOR_CLOSURE_IDEMP = theorem `;
  âs. interior (closure (interior (closure s))) = interior (closure s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF interior_DEF InteriorClosureIdemp`;;
let CLOSURE_INTERIOR_IDEMP = theorem `;
  âs.  closure (interior (closure (interior s))) = closure (interior s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF interior_DEF ClosureInteriorIdemp`;;
let INTERIOR_CLOSED_UNION_EMPTY_INTERIOR = theorem `;
  âs t.  closed s â§ interior t = â
  â  interior (s ⪠t) = interior s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN interior_DEF InteriorClosedUnionEmptyInterior`;;
let INTERIOR_UNION_EQ_EMPTY = theorem `;
  âs t.  closed s ⨠closed t
        â (interior (s ⪠t) = â
  â  interior s = â
 â§ interior t = â
)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN interior_DEF InteriorUnionEqEmpty`;;
let NOWHERE_DENSE_UNION = theorem `;
  âs t.  interior (closure (s ⪠t)) = â
  â
        interior (closure s) = â
  â§  interior (closure t) = â
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF interior_DEF NowhereDenseUnion`;;
let NOWHERE_DENSE = theorem `;
  âs.  interior (closure s) = â
 â
    ât. open t ⧠¬(t = â
)  â  âu. open u ⧠¬(u = â
) â§ u â t â§ u â© s = â
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF closure_DEF OPEN_IN NowhereDense`;;
let INTERIOR_CLOSURE_INTER_OPEN = theorem `;
  âs t.  open s â§ open t â
    interior (closure (s â© t))  =  interior(closure s) â© interior (closure t)
  by simplify interior_DEF closure_DEF OPEN_IN InteriorClosureInterOpen`;;
let CLOSURE_INTERIOR_UNION_CLOSED = theorem `;
  âs t.  closed s â§ closed t  â
    closure (interior (s ⪠t))  = closure (interior s) ⪠closure (interior t)
  by simplify interior_DEF closure_DEF CLOSED_IN ClosureInteriorUnionClosed`;;
let REGULAR_OPEN_INTER = theorem `;
  âs t.  interior (closure s) = s â§ interior (closure t) = t
    â interior (closure (s â© t)) = s â© t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF closure_DEF RegularOpenInter`;;
let REGULAR_CLOSED_UNION = theorem `;
  âs t.  closure (interior s) = s  â§  closure (interior t) = t
    â  closure (interior (s ⪠t)) = s ⪠t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF closure_DEF RegularClosedUnion`;;
let DIFF_CLOSURE_SUBSET = theorem `;
  âs t.  closure s â closure t â closure (s â t)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF DiffClosureSubset`;;
(* ------------------------------------------------------------------------- *)
(* Frontier (aka boundary).                                                  *)
(* ------------------------------------------------------------------------- *)
let frontier_DEF = NewDefinition `;
  frontier = Frontier euclidean`;;
let frontier = theorem `;
  âs.  frontier s = (closure s) DIFF (interior s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF closure_DEF interior_DEF Frontier_THM`;;
let FRONTIER_CLOSED = theorem `;
  âs. closed (frontier s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF CLOSED_IN FrontierClosed`;;
let FRONTIER_CLOSURES = theorem `;
  âs.  frontier s  =  (closure s) â© (closure (UNIV â s))
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF closure_DEF FrontierClosures`;;
let FRONTIER_STRADDLE = theorem `;
  âa s.  a â frontier s â  âe. &0 < e â
    (âx. x â s â§ dist(a,x) < e)  â§  (âx. ¬(x â s) â§ dist(a,x) < e)
  proof
    simplify SUBSET_UNIV IN_UNIV TOPSPACE_EUCLIDEAN frontier_DEF closure_DEF FrontierStraddle GSYM OPEN_IN;
    fol IN_BALL SUBSET OPEN_CONTAINS_BALL CENTRE_IN_BALL OPEN_BALL;
  qed;
`;;
let FRONTIER_SUBSET_CLOSED = theorem `;
  âs.  closed s  â  (frontier s) â s
  by fol frontier_DEF CLOSED_IN FrontierSubsetClosed`;;
let FRONTIER_EMPTY = theorem `;
  frontier â
 = â
  by fol frontier_DEF FrontierEmpty`;;
let FRONTIER_UNIV = theorem `;
  frontier UNIV = â
  by fol frontier_DEF TOPSPACE_EUCLIDEAN FrontierUniv`;;
let FRONTIER_SUBSET_EQ = theorem `;
  âs. (frontier s) â s â closed s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF CLOSED_IN FrontierSubsetEq`;;
let FRONTIER_COMPLEMENT = theorem `;
  âs. frontier (UNIV â s) = frontier s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF FrontierComplement`;;
let FRONTIER_DISJOINT_EQ = theorem `;
  âs.  (frontier s) â© s = â
  â  open s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF OPEN_IN FrontierDisjointEq`;;
let FRONTIER_INTER_SUBSET = theorem `;
  âs t.  frontier (s â© t)  â  frontier s ⪠frontier t
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF FrontierInterSubset`;;
let FRONTIER_UNION_SUBSET = theorem `;
  âs t.  frontier (s ⪠t)  â  frontier s ⪠frontier t
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF FrontierUnionSubset`;;
let FRONTIER_INTERIORS = theorem `;
  frontier s = UNIV â interior(s) â interior(UNIV â s)
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF interior_DEF FrontierInteriors`;;
let FRONTIER_FRONTIER_SUBSET = theorem `;
  âs.  frontier (frontier s) â frontier s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF FrontierFrontierSubset`;;
let INTERIOR_FRONTIER = theorem `;
  âs.  interior (frontier s)  =  interior (closure s) â closure (interior s)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN interior_DEF frontier_DEF closure_DEF InteriorFrontier`;;
let INTERIOR_FRONTIER_EMPTY = theorem `;
  âs.  open s ⨠closed s  â  interior (frontier s) = â
  by fol OPEN_IN CLOSED_IN interior_DEF frontier_DEF InteriorFrontierEmpty`;;
let UNION_FRONTIER = theorem `;
  âs t.  frontier s ⪠frontier t =
    frontier (s ⪠t) ⪠frontier (s ⩠t) ⪠frontier s ⩠frontier t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF UnionFrontier`;;
let CONNECTED_INTER_FRONTIER = theorem `;
  âs t.  connected s ⧠¬(s â© t = â
) ⧠¬(s â t = â
)
    â  Â¬(s â© frontier t = â
)
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN connected_DEF frontier_DEF ConnectedInterFrontier`;;
let INTERIOR_CLOSED_EQ_EMPTY_AS_FRONTIER = theorem `;
  âs. closed s â§ interior s = â
  â  ât. open t â§ s = frontier t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN CLOSED_IN interior_DEF OPEN_IN frontier_DEF InteriorClosedEqEmptyAsFrontier`;;
let FRONTIER_UNION = theorem `;
  âs t.  closure s â© closure t = â
    â frontier (s ⪠t) = frontier s ⪠frontier t
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF closure_DEF FrontierUnion`;;
let CLOSURE_UNION_FRONTIER = theorem `;
  âs. closure s = s ⪠frontier s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN closure_DEF frontier_DEF ClosureUnionFrontier`;;
let FRONTIER_INTERIOR_SUBSET = theorem `;
  âs.  frontier (interior s) â frontier s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF interior_DEF FrontierInteriorSubset`;;
let FRONTIER_CLOSURE_SUBSET = theorem `;
  âs.  frontier (closure s) â frontier s
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF closure_DEF FrontierClosureSubset`;;
let SET_DIFF_FRONTIER = theorem `;
  âs.  s â frontier s = interior s
  by simplify SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF interior_DEF SetDiffFrontier`;;
let FRONTIER_INTER_SUBSET_INTER = theorem `;
  âs t.  frontier (s â© t)  â  closure s â© frontier t ⪠frontier s â© closure t
  by fol SUBSET_UNIV TOPSPACE_EUCLIDEAN frontier_DEF closure_DEF FrontierInterSubsetInter`;;