src/HOL/Analysis/Abstract_Topology.thy
changeset 69922 4a9167f377b0
parent 69918 eddcc7c726f3
child 69939 812ce526da33
equal deleted inserted replaced
69918:eddcc7c726f3 69922:4a9167f377b0
     6 theory Abstract_Topology
     6 theory Abstract_Topology
     7   imports
     7   imports
     8     Complex_Main
     8     Complex_Main
     9     "HOL-Library.Set_Idioms"
     9     "HOL-Library.Set_Idioms"
    10     "HOL-Library.FuncSet"
    10     "HOL-Library.FuncSet"
    11     (* Path_Connected *)
       
    12 begin
    11 begin
    13 
    12 
    14 subsection \<open>General notion of a topology as a value\<close>
    13 subsection \<open>General notion of a topology as a value\<close>
    15 
    14 
    16 definition%important istopology :: "('a set \<Rightarrow> bool) \<Rightarrow> bool" where
    15 definition%important istopology :: "('a set \<Rightarrow> bool) \<Rightarrow> bool" where
   425 declare open_openin [symmetric, simp]
   424 declare open_openin [symmetric, simp]
   426 
   425 
   427 lemma topspace_euclidean [simp]: "topspace euclidean = UNIV"
   426 lemma topspace_euclidean [simp]: "topspace euclidean = UNIV"
   428   by (force simp: topspace_def)
   427   by (force simp: topspace_def)
   429 
   428 
   430 lemma topspace_euclidean_subtopology[simp]: "topspace (subtopology euclidean S) = S"
   429 lemma topspace_euclidean_subtopology[simp]: "topspace (top_of_set S) = S"
   431   by (simp add: topspace_subtopology)
   430   by (simp add: topspace_subtopology)
   432 
   431 
   433 lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S"
   432 lemma closed_closedin: "closed S \<longleftrightarrow> closedin euclidean S"
   434   by (simp add: closed_def closedin_def Compl_eq_Diff_UNIV)
   433   by (simp add: closed_def closedin_def Compl_eq_Diff_UNIV)
   435 
   434 
   436 declare closed_closedin [symmetric, simp]
   435 declare closed_closedin [symmetric, simp]
   437 
   436 
   438 lemma openin_subtopology_self [simp]: "openin (subtopology euclidean S) S"
   437 lemma openin_subtopology_self [simp]: "openin (top_of_set S) S"
   439   by (metis openin_topspace topspace_euclidean_subtopology)
   438   by (metis openin_topspace topspace_euclidean_subtopology)
   440 
   439 
   441 subsubsection\<open>The most basic facts about the usual topology and metric on R\<close>
   440 subsubsection\<open>The most basic facts about the usual topology and metric on R\<close>
   442 
   441 
   443 abbreviation euclideanreal :: "real topology"
   442 abbreviation euclideanreal :: "real topology"
   444   where "euclideanreal \<equiv> topology open"
   443   where "euclideanreal \<equiv> topology open"
   445 
   444 
   446 subsection \<open>Basic "localization" results are handy for connectedness.\<close>
   445 subsection \<open>Basic "localization" results are handy for connectedness.\<close>
   447 
   446 
   448 lemma openin_open: "openin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))"
   447 lemma openin_open: "openin (top_of_set U) S \<longleftrightarrow> (\<exists>T. open T \<and> (S = U \<inter> T))"
   449   by (auto simp: openin_subtopology)
   448   by (auto simp: openin_subtopology)
   450 
   449 
   451 lemma openin_Int_open:
   450 lemma openin_Int_open:
   452    "\<lbrakk>openin (subtopology euclidean U) S; open T\<rbrakk>
   451    "\<lbrakk>openin (top_of_set U) S; open T\<rbrakk>
   453         \<Longrightarrow> openin (subtopology euclidean U) (S \<inter> T)"
   452         \<Longrightarrow> openin (top_of_set U) (S \<inter> T)"
   454 by (metis open_Int Int_assoc openin_open)
   453 by (metis open_Int Int_assoc openin_open)
   455 
   454 
   456 lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (subtopology euclidean U) (U \<inter> S)"
   455 lemma openin_open_Int[intro]: "open S \<Longrightarrow> openin (top_of_set U) (U \<inter> S)"
   457   by (auto simp: openin_open)
   456   by (auto simp: openin_open)
   458 
   457 
   459 lemma open_openin_trans[trans]:
   458 lemma open_openin_trans[trans]:
   460   "open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (subtopology euclidean S) T"
   459   "open S \<Longrightarrow> open T \<Longrightarrow> T \<subseteq> S \<Longrightarrow> openin (top_of_set S) T"
   461   by (metis Int_absorb1  openin_open_Int)
   460   by (metis Int_absorb1  openin_open_Int)
   462 
   461 
   463 lemma open_subset: "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (subtopology euclidean T) S"
   462 lemma open_subset: "S \<subseteq> T \<Longrightarrow> open S \<Longrightarrow> openin (top_of_set T) S"
   464   by (auto simp: openin_open)
   463   by (auto simp: openin_open)
   465 
   464 
   466 lemma closedin_closed: "closedin (subtopology euclidean U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)"
   465 lemma closedin_closed: "closedin (top_of_set U) S \<longleftrightarrow> (\<exists>T. closed T \<and> S = U \<inter> T)"
   467   by (simp add: closedin_subtopology Int_ac)
   466   by (simp add: closedin_subtopology Int_ac)
   468 
   467 
   469 lemma closedin_closed_Int: "closed S \<Longrightarrow> closedin (subtopology euclidean U) (U \<inter> S)"
   468 lemma closedin_closed_Int: "closed S \<Longrightarrow> closedin (top_of_set U) (U \<inter> S)"
   470   by (metis closedin_closed)
   469   by (metis closedin_closed)
   471 
   470 
   472 lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (subtopology euclidean T) S"
   471 lemma closed_subset: "S \<subseteq> T \<Longrightarrow> closed S \<Longrightarrow> closedin (top_of_set T) S"
   473   by (auto simp: closedin_closed)
   472   by (auto simp: closedin_closed)
   474 
   473 
   475 lemma closedin_closed_subset:
   474 lemma closedin_closed_subset:
   476  "\<lbrakk>closedin (subtopology euclidean U) V; T \<subseteq> U; S = V \<inter> T\<rbrakk>
   475  "\<lbrakk>closedin (top_of_set U) V; T \<subseteq> U; S = V \<inter> T\<rbrakk>
   477              \<Longrightarrow> closedin (subtopology euclidean T) S"
   476              \<Longrightarrow> closedin (top_of_set T) S"
   478   by (metis (no_types, lifting) Int_assoc Int_commute closedin_closed inf.orderE)
   477   by (metis (no_types, lifting) Int_assoc Int_commute closedin_closed inf.orderE)
   479 
   478 
   480 lemma finite_imp_closedin:
   479 lemma finite_imp_closedin:
   481   fixes S :: "'a::t1_space set"
   480   fixes S :: "'a::t1_space set"
   482   shows "\<lbrakk>finite S; S \<subseteq> T\<rbrakk> \<Longrightarrow> closedin (subtopology euclidean T) S"
   481   shows "\<lbrakk>finite S; S \<subseteq> T\<rbrakk> \<Longrightarrow> closedin (top_of_set T) S"
   483     by (simp add: finite_imp_closed closed_subset)
   482     by (simp add: finite_imp_closed closed_subset)
   484 
   483 
   485 lemma closedin_singleton [simp]:
   484 lemma closedin_singleton [simp]:
   486   fixes a :: "'a::t1_space"
   485   fixes a :: "'a::t1_space"
   487   shows "closedin (subtopology euclidean U) {a} \<longleftrightarrow> a \<in> U"
   486   shows "closedin (top_of_set U) {a} \<longleftrightarrow> a \<in> U"
   488 using closedin_subset  by (force intro: closed_subset)
   487 using closedin_subset  by (force intro: closed_subset)
   489 
   488 
   490 lemma openin_euclidean_subtopology_iff:
   489 lemma openin_euclidean_subtopology_iff:
   491   fixes S U :: "'a::metric_space set"
   490   fixes S U :: "'a::metric_space set"
   492   shows "openin (subtopology euclidean U) S \<longleftrightarrow>
   491   shows "openin (top_of_set U) S \<longleftrightarrow>
   493     S \<subseteq> U \<and> (\<forall>x\<in>S. \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x'\<in> S)"
   492     S \<subseteq> U \<and> (\<forall>x\<in>S. \<exists>e>0. \<forall>x'\<in>U. dist x' x < e \<longrightarrow> x'\<in> S)"
   494   (is "?lhs \<longleftrightarrow> ?rhs")
   493   (is "?lhs \<longleftrightarrow> ?rhs")
   495 proof
   494 proof
   496   assume ?lhs
   495   assume ?lhs
   497   then show ?rhs
   496   then show ?rhs
   511     unfolding openin_open open_dist by fast
   510     unfolding openin_open open_dist by fast
   512 qed
   511 qed
   513 
   512 
   514 lemma connected_openin:
   513 lemma connected_openin:
   515       "connected S \<longleftrightarrow>
   514       "connected S \<longleftrightarrow>
   516        \<not>(\<exists>E1 E2. openin (subtopology euclidean S) E1 \<and>
   515        \<not>(\<exists>E1 E2. openin (top_of_set S) E1 \<and>
   517                  openin (subtopology euclidean S) E2 \<and>
   516                  openin (top_of_set S) E2 \<and>
   518                  S \<subseteq> E1 \<union> E2 \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})"
   517                  S \<subseteq> E1 \<union> E2 \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})"
   519   apply (simp add: connected_def openin_open disjoint_iff_not_equal, safe)
   518   apply (simp add: connected_def openin_open disjoint_iff_not_equal, safe)
   520   by (simp_all, blast+)  (* SLOW *)
   519   by (simp_all, blast+)  (* SLOW *)
   521 
   520 
   522 lemma connected_openin_eq:
   521 lemma connected_openin_eq:
   523       "connected S \<longleftrightarrow>
   522       "connected S \<longleftrightarrow>
   524        \<not>(\<exists>E1 E2. openin (subtopology euclidean S) E1 \<and>
   523        \<not>(\<exists>E1 E2. openin (top_of_set S) E1 \<and>
   525                  openin (subtopology euclidean S) E2 \<and>
   524                  openin (top_of_set S) E2 \<and>
   526                  E1 \<union> E2 = S \<and> E1 \<inter> E2 = {} \<and>
   525                  E1 \<union> E2 = S \<and> E1 \<inter> E2 = {} \<and>
   527                  E1 \<noteq> {} \<and> E2 \<noteq> {})"
   526                  E1 \<noteq> {} \<and> E2 \<noteq> {})"
   528   apply (simp add: connected_openin, safe, blast)
   527   apply (simp add: connected_openin, safe, blast)
   529   by (metis Int_lower1 Un_subset_iff openin_open subset_antisym)
   528   by (metis Int_lower1 Un_subset_iff openin_open subset_antisym)
   530 
   529 
   531 lemma connected_closedin:
   530 lemma connected_closedin:
   532       "connected S \<longleftrightarrow>
   531       "connected S \<longleftrightarrow>
   533        (\<nexists>E1 E2.
   532        (\<nexists>E1 E2.
   534         closedin (subtopology euclidean S) E1 \<and>
   533         closedin (top_of_set S) E1 \<and>
   535         closedin (subtopology euclidean S) E2 \<and>
   534         closedin (top_of_set S) E2 \<and>
   536         S \<subseteq> E1 \<union> E2 \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})"
   535         S \<subseteq> E1 \<union> E2 \<and> E1 \<inter> E2 = {} \<and> E1 \<noteq> {} \<and> E2 \<noteq> {})"
   537        (is "?lhs = ?rhs")
   536        (is "?lhs = ?rhs")
   538 proof
   537 proof
   539   assume ?lhs
   538   assume ?lhs
   540   then show ?rhs 
   539   then show ?rhs 
   559 qed
   558 qed
   560 
   559 
   561 lemma connected_closedin_eq:
   560 lemma connected_closedin_eq:
   562       "connected S \<longleftrightarrow>
   561       "connected S \<longleftrightarrow>
   563            \<not>(\<exists>E1 E2.
   562            \<not>(\<exists>E1 E2.
   564                  closedin (subtopology euclidean S) E1 \<and>
   563                  closedin (top_of_set S) E1 \<and>
   565                  closedin (subtopology euclidean S) E2 \<and>
   564                  closedin (top_of_set S) E2 \<and>
   566                  E1 \<union> E2 = S \<and> E1 \<inter> E2 = {} \<and>
   565                  E1 \<union> E2 = S \<and> E1 \<inter> E2 = {} \<and>
   567                  E1 \<noteq> {} \<and> E2 \<noteq> {})"
   566                  E1 \<noteq> {} \<and> E2 \<noteq> {})"
   568   apply (simp add: connected_closedin, safe, blast)
   567   apply (simp add: connected_closedin, safe, blast)
   569   by (metis Int_lower1 Un_subset_iff closedin_closed subset_antisym)
   568   by (metis Int_lower1 Un_subset_iff closedin_closed subset_antisym)
   570 
   569 
   571 text \<open>These "transitivity" results are handy too\<close>
   570 text \<open>These "transitivity" results are handy too\<close>
   572 
   571 
   573 lemma openin_trans[trans]:
   572 lemma openin_trans[trans]:
   574   "openin (subtopology euclidean T) S \<Longrightarrow> openin (subtopology euclidean U) T \<Longrightarrow>
   573   "openin (top_of_set T) S \<Longrightarrow> openin (top_of_set U) T \<Longrightarrow>
   575     openin (subtopology euclidean U) S"
   574     openin (top_of_set U) S"
   576   by (metis openin_Int_open openin_open)
   575   by (metis openin_Int_open openin_open)
   577 
   576 
   578 lemma openin_open_trans: "openin (subtopology euclidean T) S \<Longrightarrow> open T \<Longrightarrow> open S"
   577 lemma openin_open_trans: "openin (top_of_set T) S \<Longrightarrow> open T \<Longrightarrow> open S"
   579   by (auto simp: openin_open intro: openin_trans)
   578   by (auto simp: openin_open intro: openin_trans)
   580 
   579 
   581 lemma closedin_trans[trans]:
   580 lemma closedin_trans[trans]:
   582   "closedin (subtopology euclidean T) S \<Longrightarrow> closedin (subtopology euclidean U) T \<Longrightarrow>
   581   "closedin (top_of_set T) S \<Longrightarrow> closedin (top_of_set U) T \<Longrightarrow>
   583     closedin (subtopology euclidean U) S"
   582     closedin (top_of_set U) S"
   584   by (auto simp: closedin_closed closed_Inter Int_assoc)
   583   by (auto simp: closedin_closed closed_Inter Int_assoc)
   585 
   584 
   586 lemma closedin_closed_trans: "closedin (subtopology euclidean T) S \<Longrightarrow> closed T \<Longrightarrow> closed S"
   585 lemma closedin_closed_trans: "closedin (top_of_set T) S \<Longrightarrow> closed T \<Longrightarrow> closed S"
   587   by (auto simp: closedin_closed intro: closedin_trans)
   586   by (auto simp: closedin_closed intro: closedin_trans)
   588 
   587 
   589 lemma openin_subtopology_Int_subset:
   588 lemma openin_subtopology_Int_subset:
   590    "\<lbrakk>openin (subtopology euclidean u) (u \<inter> S); v \<subseteq> u\<rbrakk> \<Longrightarrow> openin (subtopology euclidean v) (v \<inter> S)"
   589    "\<lbrakk>openin (top_of_set u) (u \<inter> S); v \<subseteq> u\<rbrakk> \<Longrightarrow> openin (top_of_set v) (v \<inter> S)"
   591   by (auto simp: openin_subtopology)
   590   by (auto simp: openin_subtopology)
   592 
   591 
   593 lemma openin_open_eq: "open s \<Longrightarrow> (openin (subtopology euclidean s) t \<longleftrightarrow> open t \<and> t \<subseteq> s)"
   592 lemma openin_open_eq: "open s \<Longrightarrow> (openin (top_of_set s) t \<longleftrightarrow> open t \<and> t \<subseteq> s)"
   594   using open_subset openin_open_trans openin_subset by fastforce
   593   using open_subset openin_open_trans openin_subset by fastforce
   595 
   594 
   596 
   595 
   597 subsection\<open>Derived set (set of limit points)\<close>
   596 subsection\<open>Derived set (set of limit points)\<close>
   598 
   597 
  1682 
  1681 
  1683 lemma continuous_map_from_discrete_topology [simp]:
  1682 lemma continuous_map_from_discrete_topology [simp]:
  1684   "continuous_map (discrete_topology U) X f \<longleftrightarrow> f ` U \<subseteq> topspace X"
  1683   "continuous_map (discrete_topology U) X f \<longleftrightarrow> f ` U \<subseteq> topspace X"
  1685   by (auto simp: continuous_map_def)
  1684   by (auto simp: continuous_map_def)
  1686 
  1685 
  1687 lemma continuous_map_iff_continuous_real [simp]: "continuous_map (subtopology euclideanreal S) euclideanreal g = continuous_on S g"
  1686 lemma continuous_map_iff_continuous [simp]: "continuous_map (subtopology euclidean S) euclidean g = continuous_on S g"
  1688   by (force simp: continuous_map openin_subtopology continuous_on_open_invariant)
  1687   by (fastforce simp add: continuous_map openin_subtopology continuous_on_open_invariant)
  1689 
  1688 
  1690 lemma continuous_map_iff_continuous_real2 [simp]: "continuous_map euclideanreal euclideanreal g = continuous_on UNIV g"
  1689 lemma continuous_map_iff_continuous2 [simp]: "continuous_map euclidean euclidean g = continuous_on UNIV g"
  1691   by (metis continuous_map_iff_continuous_real subtopology_UNIV)
  1690   by (metis continuous_map_iff_continuous subtopology_UNIV)
  1692 
  1691 
  1693 lemma continuous_map_openin_preimage_eq:
  1692 lemma continuous_map_openin_preimage_eq:
  1694    "continuous_map X Y f \<longleftrightarrow>
  1693    "continuous_map X Y f \<longleftrightarrow>
  1695         f ` (topspace X) \<subseteq> topspace Y \<and> (\<forall>U. openin Y U \<longrightarrow> openin X (topspace X \<inter> f -` U))"
  1694         f ` (topspace X) \<subseteq> topspace Y \<and> (\<forall>U. openin Y U \<longrightarrow> openin X (topspace X \<inter> f -` U))"
  1696   by (auto simp: continuous_map_def vimage_def Int_def)
  1695   by (auto simp: continuous_map_def vimage_def Int_def)
  2842     apply (intro conj_cong arg_cong [where f=Not] ex_cong1 refl)
  2841     apply (intro conj_cong arg_cong [where f=Not] ex_cong1 refl)
  2843     apply (blast elim: dest!: openin_subset)+
  2842     apply (blast elim: dest!: openin_subset)+
  2844     done
  2843     done
  2845 qed
  2844 qed
  2846 
  2845 
  2847 lemma connectedin_iff_connected_real [simp]:
  2846 lemma connectedin_iff_connected [simp]: "connectedin euclidean S \<longleftrightarrow> connected S"
  2848      "connectedin euclideanreal S \<longleftrightarrow> connected S"
  2847   by (simp add: connected_def connectedin)
  2849     by (simp add: connected_def connectedin)
       
  2850 
  2848 
  2851 lemma connectedin_closedin:
  2849 lemma connectedin_closedin:
  2852    "connectedin X S \<longleftrightarrow>
  2850    "connectedin X S \<longleftrightarrow>
  2853         S \<subseteq> topspace X \<and>
  2851         S \<subseteq> topspace X \<and>
  2854         \<not>(\<exists>E1 E2. closedin X E1 \<and> closedin X E2 \<and>
  2852         \<not>(\<exists>E1 E2. closedin X E1 \<and> closedin X E2 \<and>
  3188         (\<forall>\<U>. (\<forall>U \<in> \<U>. openin X U) \<and> \<Union>\<U> = topspace X
  3186         (\<forall>\<U>. (\<forall>U \<in> \<U>. openin X U) \<and> \<Union>\<U> = topspace X
  3189             \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> \<Union>\<F> = topspace X))"
  3187             \<longrightarrow> (\<exists>\<F>. finite \<F> \<and> \<F> \<subseteq> \<U> \<and> \<Union>\<F> = topspace X))"
  3190   unfolding compact_space_alt
  3188   unfolding compact_space_alt
  3191   using openin_subset by fastforce
  3189   using openin_subset by fastforce
  3192 
  3190 
  3193 lemma compactin_euclideanreal_iff [simp]: "compactin euclideanreal S \<longleftrightarrow> compact S"
  3191 lemma compactin_euclidean_iff [simp]: "compactin euclidean S \<longleftrightarrow> compact S"
  3194   by (simp add: compact_eq_Heine_Borel compactin_def) meson
  3192   by (simp add: compact_eq_Heine_Borel compactin_def) meson
  3195 
  3193 
  3196 lemma compactin_absolute [simp]:
  3194 lemma compactin_absolute [simp]:
  3197    "compactin (subtopology X S) S \<longleftrightarrow> compactin X S"
  3195    "compactin (subtopology X S) S \<longleftrightarrow> compactin X S"
  3198 proof -
  3196 proof -
  3637 lemma embedding_map_imp_homeomorphic_space:
  3635 lemma embedding_map_imp_homeomorphic_space:
  3638    "embedding_map X Y f \<Longrightarrow> X homeomorphic_space (subtopology Y (f ` (topspace X)))"
  3636    "embedding_map X Y f \<Longrightarrow> X homeomorphic_space (subtopology Y (f ` (topspace X)))"
  3639   unfolding embedding_map_def
  3637   unfolding embedding_map_def
  3640   using homeomorphic_space by blast
  3638   using homeomorphic_space by blast
  3641 
  3639 
       
  3640 
       
  3641 subsection\<open>Retraction and section maps\<close>
       
  3642 
       
  3643 definition retraction_maps :: "'a topology \<Rightarrow> 'b topology \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b \<Rightarrow> 'a) \<Rightarrow> bool"
       
  3644   where "retraction_maps X Y f g \<equiv>
       
  3645            continuous_map X Y f \<and> continuous_map Y X g \<and> (\<forall>x \<in> topspace Y. f(g x) = x)"
       
  3646 
       
  3647 definition section_map :: "'a topology \<Rightarrow> 'b topology \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
       
  3648   where "section_map X Y f \<equiv> \<exists>g. retraction_maps Y X g f"
       
  3649 
       
  3650 definition retraction_map :: "'a topology \<Rightarrow> 'b topology \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
       
  3651   where "retraction_map X Y f \<equiv> \<exists>g. retraction_maps X Y f g"
       
  3652 
       
  3653 lemma retraction_maps_eq:
       
  3654    "\<lbrakk>retraction_maps X Y f g; \<And>x. x \<in> topspace X \<Longrightarrow> f x = f' x; \<And>x. x \<in> topspace Y \<Longrightarrow> g x = g' x\<rbrakk>
       
  3655         \<Longrightarrow> retraction_maps X Y f' g'"
       
  3656   unfolding retraction_maps_def by (metis (no_types, lifting) continuous_map_def continuous_map_eq)
       
  3657 
       
  3658 lemma section_map_eq:
       
  3659    "\<lbrakk>section_map X Y f; \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> section_map X Y g"
       
  3660   unfolding section_map_def using retraction_maps_eq by blast
       
  3661 
       
  3662 lemma retraction_map_eq:
       
  3663    "\<lbrakk>retraction_map X Y f; \<And>x. x \<in> topspace X \<Longrightarrow> f x = g x\<rbrakk> \<Longrightarrow> retraction_map X Y g"
       
  3664   unfolding retraction_map_def using retraction_maps_eq by blast
       
  3665 
       
  3666 lemma homeomorphic_imp_retraction_maps:
       
  3667    "homeomorphic_maps X Y f g \<Longrightarrow> retraction_maps X Y f g"
       
  3668   by (simp add: homeomorphic_maps_def retraction_maps_def)
       
  3669 
       
  3670 lemma section_and_retraction_eq_homeomorphic_map:
       
  3671    "section_map X Y f \<and> retraction_map X Y f \<longleftrightarrow> homeomorphic_map X Y f"
       
  3672   apply (auto simp: section_map_def retraction_map_def homeomorphic_map_maps retraction_maps_def homeomorphic_maps_def)
       
  3673   by (metis (full_types) continuous_map_image_subset_topspace image_subset_iff)
       
  3674 
       
  3675 lemma section_imp_embedding_map:
       
  3676    "section_map X Y f \<Longrightarrow> embedding_map X Y f"
       
  3677   unfolding section_map_def embedding_map_def homeomorphic_map_maps retraction_maps_def homeomorphic_maps_def
       
  3678   by (force simp: continuous_map_in_subtopology continuous_map_from_subtopology topspace_subtopology)
       
  3679 
       
  3680 lemma retraction_imp_quotient_map:
       
  3681   assumes "retraction_map X Y f"
       
  3682   shows "quotient_map X Y f"
       
  3683   unfolding quotient_map_def
       
  3684 proof (intro conjI subsetI allI impI)
       
  3685   show "f ` topspace X = topspace Y"
       
  3686     using assms by (force simp: retraction_map_def retraction_maps_def continuous_map_def)
       
  3687 next
       
  3688   fix U
       
  3689   assume U: "U \<subseteq> topspace Y"
       
  3690   have "openin Y U"
       
  3691     if "\<forall>x\<in>topspace Y. g x \<in> topspace X" "\<forall>x\<in>topspace Y. f (g x) = x"
       
  3692        "openin Y {x \<in> topspace Y. g x \<in> {x \<in> topspace X. f x \<in> U}}" for g
       
  3693     using openin_subopen U that by fastforce
       
  3694   then show "openin X {x \<in> topspace X. f x \<in> U} = openin Y U"
       
  3695     using assms by (auto simp: retraction_map_def retraction_maps_def continuous_map_def)
       
  3696 qed
       
  3697 
       
  3698 lemma retraction_maps_compose:
       
  3699    "\<lbrakk>retraction_maps X Y f f'; retraction_maps Y Z g g'\<rbrakk> \<Longrightarrow> retraction_maps X Z (g \<circ> f) (f' \<circ> g')"
       
  3700   by (clarsimp simp: retraction_maps_def continuous_map_compose) (simp add: continuous_map_def)
       
  3701 
       
  3702 lemma retraction_map_compose:
       
  3703    "\<lbrakk>retraction_map X Y f; retraction_map Y Z g\<rbrakk> \<Longrightarrow> retraction_map X Z (g \<circ> f)"
       
  3704   by (meson retraction_map_def retraction_maps_compose)
       
  3705 
       
  3706 lemma section_map_compose:
       
  3707    "\<lbrakk>section_map X Y f; section_map Y Z g\<rbrakk> \<Longrightarrow> section_map X Z (g \<circ> f)"
       
  3708   by (meson retraction_maps_compose section_map_def)
       
  3709 
       
  3710 lemma surjective_section_eq_homeomorphic_map:
       
  3711    "section_map X Y f \<and> f ` (topspace X) = topspace Y \<longleftrightarrow> homeomorphic_map X Y f"
       
  3712   by (meson section_and_retraction_eq_homeomorphic_map section_imp_embedding_map surjective_embedding_map)
       
  3713 
       
  3714 lemma surjective_retraction_or_section_map:
       
  3715    "f ` (topspace X) = topspace Y \<Longrightarrow> retraction_map X Y f \<or> section_map X Y f \<longleftrightarrow> retraction_map X Y f"
       
  3716   using section_and_retraction_eq_homeomorphic_map surjective_section_eq_homeomorphic_map by fastforce
       
  3717 
       
  3718 lemma retraction_imp_surjective_map:
       
  3719    "retraction_map X Y f \<Longrightarrow> f ` (topspace X) = topspace Y"
       
  3720   by (simp add: retraction_imp_quotient_map quotient_imp_surjective_map)
       
  3721 
       
  3722 lemma section_imp_injective_map:
       
  3723    "\<lbrakk>section_map X Y f; x \<in> topspace X; y \<in> topspace X\<rbrakk> \<Longrightarrow> f x = f y \<longleftrightarrow> x = y"
       
  3724   by (metis (mono_tags, hide_lams) retraction_maps_def section_map_def)
       
  3725 
       
  3726 lemma retraction_maps_to_retract_maps:
       
  3727    "retraction_maps X Y r s
       
  3728         \<Longrightarrow> retraction_maps X (subtopology X (s ` (topspace Y))) (s \<circ> r) id"
       
  3729   unfolding retraction_maps_def
       
  3730   by (auto simp: continuous_map_compose continuous_map_into_subtopology continuous_map_from_subtopology)
  3642 subsection \<open>Continuity\<close>
  3731 subsection \<open>Continuity\<close>
  3643 
  3732 
  3644 lemma continuous_on_open:
  3733 lemma continuous_on_open:
  3645   "continuous_on S f \<longleftrightarrow>
  3734   "continuous_on S f \<longleftrightarrow>
  3646     (\<forall>T. openin (subtopology euclidean (f ` S)) T \<longrightarrow>
  3735     (\<forall>T. openin (top_of_set (f ` S)) T \<longrightarrow>
  3647       openin (subtopology euclidean S) (S \<inter> f -` T))"
  3736       openin (top_of_set S) (S \<inter> f -` T))"
  3648   unfolding continuous_on_open_invariant openin_open Int_def vimage_def Int_commute
  3737   unfolding continuous_on_open_invariant openin_open Int_def vimage_def Int_commute
  3649   by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong)
  3738   by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong)
  3650 
  3739 
  3651 lemma continuous_on_closed:
  3740 lemma continuous_on_closed:
  3652   "continuous_on S f \<longleftrightarrow>
  3741   "continuous_on S f \<longleftrightarrow>
  3653     (\<forall>T. closedin (subtopology euclidean (f ` S)) T \<longrightarrow>
  3742     (\<forall>T. closedin (top_of_set (f ` S)) T \<longrightarrow>
  3654       closedin (subtopology euclidean S) (S \<inter> f -` T))"
  3743       closedin (top_of_set S) (S \<inter> f -` T))"
  3655   unfolding continuous_on_closed_invariant closedin_closed Int_def vimage_def Int_commute
  3744   unfolding continuous_on_closed_invariant closedin_closed Int_def vimage_def Int_commute
  3656   by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong)
  3745   by (simp add: imp_ex imageI conj_commute eq_commute cong: conj_cong)
  3657 
  3746 
  3658 lemma continuous_on_imp_closedin:
  3747 lemma continuous_on_imp_closedin:
  3659   assumes "continuous_on S f" "closedin (subtopology euclidean (f ` S)) T"
  3748   assumes "continuous_on S f" "closedin (top_of_set (f ` S)) T"
  3660   shows "closedin (subtopology euclidean S) (S \<inter> f -` T)"
  3749   shows "closedin (top_of_set S) (S \<inter> f -` T)"
  3661   using assms continuous_on_closed by blast
  3750   using assms continuous_on_closed by blast
  3662 
  3751 
  3663 subsection%unimportant \<open>Half-global and completely global cases\<close>
  3752 subsection%unimportant \<open>Half-global and completely global cases\<close>
  3664 
  3753 
  3665 lemma continuous_openin_preimage_gen:
  3754 lemma continuous_openin_preimage_gen:
  3666   assumes "continuous_on S f"  "open T"
  3755   assumes "continuous_on S f"  "open T"
  3667   shows "openin (subtopology euclidean S) (S \<inter> f -` T)"
  3756   shows "openin (top_of_set S) (S \<inter> f -` T)"
  3668 proof -
  3757 proof -
  3669   have *: "(S \<inter> f -` T) = (S \<inter> f -` (T \<inter> f ` S))"
  3758   have *: "(S \<inter> f -` T) = (S \<inter> f -` (T \<inter> f ` S))"
  3670     by auto
  3759     by auto
  3671   have "openin (subtopology euclidean (f ` S)) (T \<inter> f ` S)"
  3760   have "openin (top_of_set (f ` S)) (T \<inter> f ` S)"
  3672     using openin_open_Int[of T "f ` S", OF assms(2)] unfolding openin_open by auto
  3761     using openin_open_Int[of T "f ` S", OF assms(2)] unfolding openin_open by auto
  3673   then show ?thesis
  3762   then show ?thesis
  3674     using assms(1)[unfolded continuous_on_open, THEN spec[where x="T \<inter> f ` S"]]
  3763     using assms(1)[unfolded continuous_on_open, THEN spec[where x="T \<inter> f ` S"]]
  3675     using * by auto
  3764     using * by auto
  3676 qed
  3765 qed
  3677 
  3766 
  3678 lemma continuous_closedin_preimage:
  3767 lemma continuous_closedin_preimage:
  3679   assumes "continuous_on S f" and "closed T"
  3768   assumes "continuous_on S f" and "closed T"
  3680   shows "closedin (subtopology euclidean S) (S \<inter> f -` T)"
  3769   shows "closedin (top_of_set S) (S \<inter> f -` T)"
  3681 proof -
  3770 proof -
  3682   have *: "(S \<inter> f -` T) = (S \<inter> f -` (T \<inter> f ` S))"
  3771   have *: "(S \<inter> f -` T) = (S \<inter> f -` (T \<inter> f ` S))"
  3683     by auto
  3772     by auto
  3684   have "closedin (subtopology euclidean (f ` S)) (T \<inter> f ` S)"
  3773   have "closedin (top_of_set (f ` S)) (T \<inter> f ` S)"
  3685     using closedin_closed_Int[of T "f ` S", OF assms(2)]
  3774     using closedin_closed_Int[of T "f ` S", OF assms(2)]
  3686     by (simp add: Int_commute)
  3775     by (simp add: Int_commute)
  3687   then show ?thesis
  3776   then show ?thesis
  3688     using assms(1)[unfolded continuous_on_closed, THEN spec[where x="T \<inter> f ` S"]]
  3777     using assms(1)[unfolded continuous_on_closed, THEN spec[where x="T \<inter> f ` S"]]
  3689     using * by auto
  3778     using * by auto
  3690 qed
  3779 qed
  3691 
  3780 
  3692 lemma continuous_openin_preimage_eq:
  3781 lemma continuous_openin_preimage_eq:
  3693    "continuous_on S f \<longleftrightarrow>
  3782    "continuous_on S f \<longleftrightarrow>
  3694     (\<forall>T. open T \<longrightarrow> openin (subtopology euclidean S) (S \<inter> f -` T))"
  3783     (\<forall>T. open T \<longrightarrow> openin (top_of_set S) (S \<inter> f -` T))"
  3695 apply safe
  3784 apply safe
  3696 apply (simp add: continuous_openin_preimage_gen)
  3785 apply (simp add: continuous_openin_preimage_gen)
  3697 apply (fastforce simp add: continuous_on_open openin_open)
  3786 apply (fastforce simp add: continuous_on_open openin_open)
  3698 done
  3787 done
  3699 
  3788 
  3700 lemma continuous_closedin_preimage_eq:
  3789 lemma continuous_closedin_preimage_eq:
  3701    "continuous_on S f \<longleftrightarrow>
  3790    "continuous_on S f \<longleftrightarrow>
  3702     (\<forall>T. closed T \<longrightarrow> closedin (subtopology euclidean S) (S \<inter> f -` T))"
  3791     (\<forall>T. closed T \<longrightarrow> closedin (top_of_set S) (S \<inter> f -` T))"
  3703 apply safe
  3792 apply safe
  3704 apply (simp add: continuous_closedin_preimage)
  3793 apply (simp add: continuous_closedin_preimage)
  3705 apply (fastforce simp add: continuous_on_closed closedin_closed)
  3794 apply (fastforce simp add: continuous_on_closed closedin_closed)
  3706 done
  3795 done
  3707 
  3796 
  3731  
  3820  
  3732 lemma continuous_closed_vimage: "closed S \<Longrightarrow> (\<And>x. continuous (at x) f) \<Longrightarrow> closed (f -` S)"
  3821 lemma continuous_closed_vimage: "closed S \<Longrightarrow> (\<And>x. continuous (at x) f) \<Longrightarrow> closed (f -` S)"
  3733   by (simp add: closed_vimage continuous_on_eq_continuous_within)
  3822   by (simp add: closed_vimage continuous_on_eq_continuous_within)
  3734 
  3823 
  3735 lemma Times_in_interior_subtopology:
  3824 lemma Times_in_interior_subtopology:
  3736   assumes "(x, y) \<in> U" "openin (subtopology euclidean (S \<times> T)) U"
  3825   assumes "(x, y) \<in> U" "openin (top_of_set (S \<times> T)) U"
  3737   obtains V W where "openin (subtopology euclidean S) V" "x \<in> V"
  3826   obtains V W where "openin (top_of_set S) V" "x \<in> V"
  3738                     "openin (subtopology euclidean T) W" "y \<in> W" "(V \<times> W) \<subseteq> U"
  3827                     "openin (top_of_set T) W" "y \<in> W" "(V \<times> W) \<subseteq> U"
  3739 proof -
  3828 proof -
  3740   from assms obtain E where "open E" "U = S \<times> T \<inter> E" "(x, y) \<in> E" "x \<in> S" "y \<in> T"
  3829   from assms obtain E where "open E" "U = S \<times> T \<inter> E" "(x, y) \<in> E" "x \<in> S" "y \<in> T"
  3741     by (auto simp: openin_open)
  3830     by (auto simp: openin_open)
  3742   from open_prod_elim[OF \<open>open E\<close> \<open>(x, y) \<in> E\<close>]
  3831   from open_prod_elim[OF \<open>open E\<close> \<open>(x, y) \<in> E\<close>]
  3743   obtain E1 E2 where "open E1" "open E2" "(x, y) \<in> E1 \<times> E2" "E1 \<times> E2 \<subseteq> E"
  3832   obtain E1 E2 where "open E1" "open E2" "(x, y) \<in> E1 \<times> E2" "E1 \<times> E2 \<subseteq> E"
  3744     by blast
  3833     by blast
  3745   show ?thesis
  3834   show ?thesis
  3746   proof
  3835   proof
  3747     show "openin (subtopology euclidean S) (E1 \<inter> S)"
  3836     show "openin (top_of_set S) (E1 \<inter> S)"
  3748       "openin (subtopology euclidean T) (E2 \<inter> T)"
  3837       "openin (top_of_set T) (E2 \<inter> T)"
  3749       using \<open>open E1\<close> \<open>open E2\<close>
  3838       using \<open>open E1\<close> \<open>open E2\<close>
  3750       by (auto simp: openin_open)
  3839       by (auto simp: openin_open)
  3751     show "x \<in> E1 \<inter> S" "y \<in> E2 \<inter> T"
  3840     show "x \<in> E1 \<inter> S" "y \<in> E2 \<inter> T"
  3752       using \<open>(x, y) \<in> E1 \<times> E2\<close> \<open>x \<in> S\<close> \<open>y \<in> T\<close> by auto
  3841       using \<open>(x, y) \<in> E1 \<times> E2\<close> \<open>x \<in> S\<close> \<open>y \<in> T\<close> by auto
  3753     show "(E1 \<inter> S) \<times> (E2 \<inter> T) \<subseteq> U"
  3842     show "(E1 \<inter> S) \<times> (E2 \<inter> T) \<subseteq> U"
  3755       by (auto simp: )
  3844       by (auto simp: )
  3756   qed
  3845   qed
  3757 qed
  3846 qed
  3758 
  3847 
  3759 lemma closedin_Times:
  3848 lemma closedin_Times:
  3760   "closedin (subtopology euclidean S) S' \<Longrightarrow> closedin (subtopology euclidean T) T' \<Longrightarrow>
  3849   "closedin (top_of_set S) S' \<Longrightarrow> closedin (top_of_set T) T' \<Longrightarrow>
  3761     closedin (subtopology euclidean (S \<times> T)) (S' \<times> T')"
  3850     closedin (top_of_set (S \<times> T)) (S' \<times> T')"
  3762   unfolding closedin_closed using closed_Times by blast
  3851   unfolding closedin_closed using closed_Times by blast
  3763 
  3852 
  3764 lemma openin_Times:
  3853 lemma openin_Times:
  3765   "openin (subtopology euclidean S) S' \<Longrightarrow> openin (subtopology euclidean T) T' \<Longrightarrow>
  3854   "openin (top_of_set S) S' \<Longrightarrow> openin (top_of_set T) T' \<Longrightarrow>
  3766     openin (subtopology euclidean (S \<times> T)) (S' \<times> T')"
  3855     openin (top_of_set (S \<times> T)) (S' \<times> T')"
  3767   unfolding openin_open using open_Times by blast
  3856   unfolding openin_open using open_Times by blast
  3768 
  3857 
  3769 lemma openin_Times_eq:
  3858 lemma openin_Times_eq:
  3770   fixes S :: "'a::topological_space set" and T :: "'b::topological_space set"
  3859   fixes S :: "'a::topological_space set" and T :: "'b::topological_space set"
  3771   shows
  3860   shows
  3772     "openin (subtopology euclidean (S \<times> T)) (S' \<times> T') \<longleftrightarrow>
  3861     "openin (top_of_set (S \<times> T)) (S' \<times> T') \<longleftrightarrow>
  3773       S' = {} \<or> T' = {} \<or> openin (subtopology euclidean S) S' \<and> openin (subtopology euclidean T) T'"
  3862       S' = {} \<or> T' = {} \<or> openin (top_of_set S) S' \<and> openin (top_of_set T) T'"
  3774     (is "?lhs = ?rhs")
  3863     (is "?lhs = ?rhs")
  3775 proof (cases "S' = {} \<or> T' = {}")
  3864 proof (cases "S' = {} \<or> T' = {}")
  3776   case True
  3865   case True
  3777   then show ?thesis by auto
  3866   then show ?thesis by auto
  3778 next
  3867 next
  3780   then obtain x y where "x \<in> S'" "y \<in> T'"
  3869   then obtain x y where "x \<in> S'" "y \<in> T'"
  3781     by blast
  3870     by blast
  3782   show ?thesis
  3871   show ?thesis
  3783   proof
  3872   proof
  3784     assume ?lhs
  3873     assume ?lhs
  3785     have "openin (subtopology euclidean S) S'"
  3874     have "openin (top_of_set S) S'"
  3786       apply (subst openin_subopen, clarify)
  3875       apply (subst openin_subopen, clarify)
  3787       apply (rule Times_in_interior_subtopology [OF _ \<open>?lhs\<close>])
  3876       apply (rule Times_in_interior_subtopology [OF _ \<open>?lhs\<close>])
  3788       using \<open>y \<in> T'\<close>
  3877       using \<open>y \<in> T'\<close>
  3789        apply auto
  3878        apply auto
  3790       done
  3879       done
  3791     moreover have "openin (subtopology euclidean T) T'"
  3880     moreover have "openin (top_of_set T) T'"
  3792       apply (subst openin_subopen, clarify)
  3881       apply (subst openin_subopen, clarify)
  3793       apply (rule Times_in_interior_subtopology [OF _ \<open>?lhs\<close>])
  3882       apply (rule Times_in_interior_subtopology [OF _ \<open>?lhs\<close>])
  3794       using \<open>x \<in> S'\<close>
  3883       using \<open>x \<in> S'\<close>
  3795        apply auto
  3884        apply auto
  3796       done
  3885       done
  3803   qed
  3892   qed
  3804 qed
  3893 qed
  3805 
  3894 
  3806 lemma Lim_transform_within_openin:
  3895 lemma Lim_transform_within_openin:
  3807   assumes f: "(f \<longlongrightarrow> l) (at a within T)"
  3896   assumes f: "(f \<longlongrightarrow> l) (at a within T)"
  3808     and "openin (subtopology euclidean T) S" "a \<in> S"
  3897     and "openin (top_of_set T) S" "a \<in> S"
  3809     and eq: "\<And>x. \<lbrakk>x \<in> S; x \<noteq> a\<rbrakk> \<Longrightarrow> f x = g x"
  3898     and eq: "\<And>x. \<lbrakk>x \<in> S; x \<noteq> a\<rbrakk> \<Longrightarrow> f x = g x"
  3810   shows "(g \<longlongrightarrow> l) (at a within T)"
  3899   shows "(g \<longlongrightarrow> l) (at a within T)"
  3811 proof -
  3900 proof -
  3812   have "\<forall>\<^sub>F x in at a within T. x \<in> T \<and> x \<noteq> a"
  3901   have "\<forall>\<^sub>F x in at a within T. x \<in> T \<and> x \<noteq> a"
  3813     by (simp add: eventually_at_filter)
  3902     by (simp add: eventually_at_filter)
  3825 qed
  3914 qed
  3826 
  3915 
  3827 lemma continuous_on_open_gen:
  3916 lemma continuous_on_open_gen:
  3828   assumes "f ` S \<subseteq> T"
  3917   assumes "f ` S \<subseteq> T"
  3829     shows "continuous_on S f \<longleftrightarrow>
  3918     shows "continuous_on S f \<longleftrightarrow>
  3830              (\<forall>U. openin (subtopology euclidean T) U
  3919              (\<forall>U. openin (top_of_set T) U
  3831                   \<longrightarrow> openin (subtopology euclidean S) (S \<inter> f -` U))"
  3920                   \<longrightarrow> openin (top_of_set S) (S \<inter> f -` U))"
  3832      (is "?lhs = ?rhs")
  3921      (is "?lhs = ?rhs")
  3833 proof
  3922 proof
  3834   assume ?lhs
  3923   assume ?lhs
  3835   then show ?rhs
  3924   then show ?rhs
  3836     by (clarsimp simp add: continuous_openin_preimage_eq openin_open)
  3925     by (clarsimp simp add: continuous_openin_preimage_eq openin_open)
  3839   assume R [rule_format]: ?rhs
  3928   assume R [rule_format]: ?rhs
  3840   show ?lhs
  3929   show ?lhs
  3841   proof (clarsimp simp add: continuous_openin_preimage_eq)
  3930   proof (clarsimp simp add: continuous_openin_preimage_eq)
  3842     fix U::"'a set"
  3931     fix U::"'a set"
  3843     assume "open U"
  3932     assume "open U"
  3844     then have "openin (subtopology euclidean S) (S \<inter> f -` (U \<inter> T))"
  3933     then have "openin (top_of_set S) (S \<inter> f -` (U \<inter> T))"
  3845       by (metis R inf_commute openin_open)
  3934       by (metis R inf_commute openin_open)
  3846     then show "openin (subtopology euclidean S) (S \<inter> f -` U)"
  3935     then show "openin (top_of_set S) (S \<inter> f -` U)"
  3847       by (metis Int_assoc Int_commute assms image_subset_iff_subset_vimage inf.absorb_iff2 vimage_Int)
  3936       by (metis Int_assoc Int_commute assms image_subset_iff_subset_vimage inf.absorb_iff2 vimage_Int)
  3848   qed
  3937   qed
  3849 qed
  3938 qed
  3850 
  3939 
  3851 lemma continuous_openin_preimage:
  3940 lemma continuous_openin_preimage:
  3852   "\<lbrakk>continuous_on S f; f ` S \<subseteq> T; openin (subtopology euclidean T) U\<rbrakk>
  3941   "\<lbrakk>continuous_on S f; f ` S \<subseteq> T; openin (top_of_set T) U\<rbrakk>
  3853         \<Longrightarrow> openin (subtopology euclidean S) (S \<inter> f -` U)"
  3942         \<Longrightarrow> openin (top_of_set S) (S \<inter> f -` U)"
  3854   by (simp add: continuous_on_open_gen)
  3943   by (simp add: continuous_on_open_gen)
  3855 
  3944 
  3856 lemma continuous_on_closed_gen:
  3945 lemma continuous_on_closed_gen:
  3857   assumes "f ` S \<subseteq> T"
  3946   assumes "f ` S \<subseteq> T"
  3858   shows "continuous_on S f \<longleftrightarrow>
  3947   shows "continuous_on S f \<longleftrightarrow>
  3859              (\<forall>U. closedin (subtopology euclidean T) U
  3948              (\<forall>U. closedin (top_of_set T) U
  3860                   \<longrightarrow> closedin (subtopology euclidean S) (S \<inter> f -` U))"
  3949                   \<longrightarrow> closedin (top_of_set S) (S \<inter> f -` U))"
  3861     (is "?lhs = ?rhs")
  3950     (is "?lhs = ?rhs")
  3862 proof -
  3951 proof -
  3863   have *: "U \<subseteq> T \<Longrightarrow> S \<inter> f -` (T - U) = S - (S \<inter> f -` U)" for U
  3952   have *: "U \<subseteq> T \<Longrightarrow> S \<inter> f -` (T - U) = S - (S \<inter> f -` U)" for U
  3864     using assms by blast
  3953     using assms by blast
  3865   show ?thesis
  3954   show ?thesis
  3866   proof
  3955   proof
  3867     assume L: ?lhs
  3956     assume L: ?lhs
  3868     show ?rhs
  3957     show ?rhs
  3869     proof clarify
  3958     proof clarify
  3870       fix U
  3959       fix U
  3871       assume "closedin (subtopology euclidean T) U"
  3960       assume "closedin (top_of_set T) U"
  3872       then show "closedin (subtopology euclidean S) (S \<inter> f -` U)"
  3961       then show "closedin (top_of_set S) (S \<inter> f -` U)"
  3873         using L unfolding continuous_on_open_gen [OF assms]
  3962         using L unfolding continuous_on_open_gen [OF assms]
  3874         by (metis * closedin_def inf_le1 topspace_euclidean_subtopology)
  3963         by (metis * closedin_def inf_le1 topspace_euclidean_subtopology)
  3875     qed
  3964     qed
  3876   next
  3965   next
  3877     assume R [rule_format]: ?rhs
  3966     assume R [rule_format]: ?rhs
  3880       by (metis * R inf_le1 openin_closedin_eq topspace_euclidean_subtopology)
  3969       by (metis * R inf_le1 openin_closedin_eq topspace_euclidean_subtopology)
  3881   qed
  3970   qed
  3882 qed
  3971 qed
  3883 
  3972 
  3884 lemma continuous_closedin_preimage_gen:
  3973 lemma continuous_closedin_preimage_gen:
  3885   assumes "continuous_on S f" "f ` S \<subseteq> T" "closedin (subtopology euclidean T) U"
  3974   assumes "continuous_on S f" "f ` S \<subseteq> T" "closedin (top_of_set T) U"
  3886     shows "closedin (subtopology euclidean S) (S \<inter> f -` U)"
  3975     shows "closedin (top_of_set S) (S \<inter> f -` U)"
  3887 using assms continuous_on_closed_gen by blast
  3976 using assms continuous_on_closed_gen by blast
  3888 
  3977 
  3889 lemma continuous_transform_within_openin:
  3978 lemma continuous_transform_within_openin:
  3890   assumes "continuous (at a within T) f"
  3979   assumes "continuous (at a within T) f"
  3891     and "openin (subtopology euclidean T) S" "a \<in> S"
  3980     and "openin (top_of_set T) S" "a \<in> S"
  3892     and eq: "\<And>x. x \<in> S \<Longrightarrow> f x = g x"
  3981     and eq: "\<And>x. x \<in> S \<Longrightarrow> f x = g x"
  3893   shows "continuous (at a within T) g"
  3982   shows "continuous (at a within T) g"
  3894   using assms by (simp add: Lim_transform_within_openin continuous_within)
  3983   using assms by (simp add: Lim_transform_within_openin continuous_within)
  3895 
  3984 
  3896 
  3985 
       
  3986 subsection%important \<open>The topology generated by some (open) subsets\<close>
       
  3987 
       
  3988 text \<open>In the definition below of a generated topology, the \<open>Empty\<close> case is not necessary,
       
  3989 as it follows from \<open>UN\<close> taking for \<open>K\<close> the empty set. However, it is convenient to have,
       
  3990 and is never a problem in proofs, so I prefer to write it down explicitly.
       
  3991 
       
  3992 We do not require \<open>UNIV\<close> to be an open set, as this will not be the case in applications. (We are
       
  3993 thinking of a topology on a subset of \<open>UNIV\<close>, the remaining part of \<open>UNIV\<close> being irrelevant.)\<close>
       
  3994 
       
  3995 inductive generate_topology_on for S where
       
  3996   Empty: "generate_topology_on S {}"
       
  3997 | Int: "generate_topology_on S a \<Longrightarrow> generate_topology_on S b \<Longrightarrow> generate_topology_on S (a \<inter> b)"
       
  3998 | UN: "(\<And>k. k \<in> K \<Longrightarrow> generate_topology_on S k) \<Longrightarrow> generate_topology_on S (\<Union>K)"
       
  3999 | Basis: "s \<in> S \<Longrightarrow> generate_topology_on S s"
       
  4000 
       
  4001 lemma istopology_generate_topology_on:
       
  4002   "istopology (generate_topology_on S)"
       
  4003 unfolding istopology_def by (auto intro: generate_topology_on.intros)
       
  4004 
       
  4005 text \<open>The basic property of the topology generated by a set \<open>S\<close> is that it is the
       
  4006 smallest topology containing all the elements of \<open>S\<close>:\<close>
       
  4007 
       
  4008 lemma generate_topology_on_coarsest:
       
  4009   assumes "istopology T"
       
  4010           "\<And>s. s \<in> S \<Longrightarrow> T s"
       
  4011           "generate_topology_on S s0"
       
  4012   shows "T s0"
       
  4013 using assms(3) apply (induct rule: generate_topology_on.induct)
       
  4014 using assms(1) assms(2) unfolding istopology_def by auto
       
  4015 
       
  4016 abbreviation%unimportant topology_generated_by::"('a set set) \<Rightarrow> ('a topology)"
       
  4017   where "topology_generated_by S \<equiv> topology (generate_topology_on S)"
       
  4018 
       
  4019 lemma openin_topology_generated_by_iff:
       
  4020   "openin (topology_generated_by S) s \<longleftrightarrow> generate_topology_on S s"
       
  4021   using topology_inverse'[OF istopology_generate_topology_on[of S]] by simp
       
  4022 
       
  4023 lemma openin_topology_generated_by:
       
  4024   "openin (topology_generated_by S) s \<Longrightarrow> generate_topology_on S s"
       
  4025 using openin_topology_generated_by_iff by auto
       
  4026 
       
  4027 lemma topology_generated_by_topspace:
       
  4028   "topspace (topology_generated_by S) = (\<Union>S)"
       
  4029 proof
       
  4030   {
       
  4031     fix s assume "openin (topology_generated_by S) s"
       
  4032     then have "generate_topology_on S s" by (rule openin_topology_generated_by)
       
  4033     then have "s \<subseteq> (\<Union>S)" by (induct, auto)
       
  4034   }
       
  4035   then show "topspace (topology_generated_by S) \<subseteq> (\<Union>S)"
       
  4036     unfolding topspace_def by auto
       
  4037 next
       
  4038   have "generate_topology_on S (\<Union>S)"
       
  4039     using generate_topology_on.UN[OF generate_topology_on.Basis, of S S] by simp
       
  4040   then show "(\<Union>S) \<subseteq> topspace (topology_generated_by S)"
       
  4041     unfolding topspace_def using openin_topology_generated_by_iff by auto
       
  4042 qed
       
  4043 
       
  4044 lemma topology_generated_by_Basis:
       
  4045   "s \<in> S \<Longrightarrow> openin (topology_generated_by S) s"
       
  4046   by (simp only: openin_topology_generated_by_iff, auto simp: generate_topology_on.Basis)
       
  4047 
       
  4048 lemma generate_topology_on_Inter:
       
  4049   "\<lbrakk>finite \<F>; \<And>K. K \<in> \<F> \<Longrightarrow> generate_topology_on \<S> K; \<F> \<noteq> {}\<rbrakk> \<Longrightarrow> generate_topology_on \<S> (\<Inter>\<F>)"
       
  4050   by (induction \<F> rule: finite_induct; force intro: generate_topology_on.intros)
       
  4051 
       
  4052 subsection\<open>Topology bases and sub-bases\<close>
       
  4053 
       
  4054 lemma istopology_base_alt:
       
  4055    "istopology (arbitrary union_of P) \<longleftrightarrow>
       
  4056     (\<forall>S T. (arbitrary union_of P) S \<and> (arbitrary union_of P) T
       
  4057            \<longrightarrow> (arbitrary union_of P) (S \<inter> T))"
       
  4058   by (simp add: istopology_def) (blast intro: arbitrary_union_of_Union)
       
  4059 
       
  4060 lemma istopology_base_eq:
       
  4061    "istopology (arbitrary union_of P) \<longleftrightarrow>
       
  4062     (\<forall>S T. P S \<and> P T \<longrightarrow> (arbitrary union_of P) (S \<inter> T))"
       
  4063   by (simp add: istopology_base_alt arbitrary_union_of_Int_eq)
       
  4064 
       
  4065 lemma istopology_base:
       
  4066    "(\<And>S T. \<lbrakk>P S; P T\<rbrakk> \<Longrightarrow> P(S \<inter> T)) \<Longrightarrow> istopology (arbitrary union_of P)"
       
  4067   by (simp add: arbitrary_def istopology_base_eq union_of_inc)
       
  4068 
       
  4069 lemma openin_topology_base_unique:
       
  4070    "openin X = arbitrary union_of P \<longleftrightarrow>
       
  4071         (\<forall>V. P V \<longrightarrow> openin X V) \<and> (\<forall>U x. openin X U \<and> x \<in> U \<longrightarrow> (\<exists>V. P V \<and> x \<in> V \<and> V \<subseteq> U))"
       
  4072    (is "?lhs = ?rhs")
       
  4073 proof
       
  4074   assume ?lhs
       
  4075   then show ?rhs
       
  4076     by (auto simp: union_of_def arbitrary_def)
       
  4077 next
       
  4078   assume R: ?rhs
       
  4079   then have *: "\<exists>\<U>\<subseteq>Collect P. \<Union>\<U> = S" if "openin X S" for S
       
  4080     using that by (rule_tac x="{V. P V \<and> V \<subseteq> S}" in exI) fastforce
       
  4081   from R show ?lhs
       
  4082     by (fastforce simp add: union_of_def arbitrary_def intro: *)
       
  4083 qed
       
  4084 
       
  4085 lemma topology_base_unique:
       
  4086    "\<lbrakk>\<And>S. P S \<Longrightarrow> openin X S;
       
  4087      \<And>U x. \<lbrakk>openin X U; x \<in> U\<rbrakk> \<Longrightarrow> \<exists>B. P B \<and> x \<in> B \<and> B \<subseteq> U\<rbrakk>
       
  4088     \<Longrightarrow> topology(arbitrary union_of P) = X"
       
  4089   by (metis openin_topology_base_unique openin_inverse [of X])
       
  4090 
       
  4091 lemma topology_bases_eq_aux:
       
  4092    "\<lbrakk>(arbitrary union_of P) S;
       
  4093      \<And>U x. \<lbrakk>P U; x \<in> U\<rbrakk> \<Longrightarrow> \<exists>V. Q V \<and> x \<in> V \<and> V \<subseteq> U\<rbrakk>
       
  4094         \<Longrightarrow> (arbitrary union_of Q) S"
       
  4095   by (metis arbitrary_union_of_alt arbitrary_union_of_idempot)
       
  4096 
       
  4097 lemma topology_bases_eq:
       
  4098    "\<lbrakk>\<And>U x. \<lbrakk>P U; x \<in> U\<rbrakk> \<Longrightarrow> \<exists>V. Q V \<and> x \<in> V \<and> V \<subseteq> U;
       
  4099     \<And>V x. \<lbrakk>Q V; x \<in> V\<rbrakk> \<Longrightarrow> \<exists>U. P U \<and> x \<in> U \<and> U \<subseteq> V\<rbrakk>
       
  4100         \<Longrightarrow> topology (arbitrary union_of P) =
       
  4101             topology (arbitrary union_of Q)"
       
  4102   by (fastforce intro:  arg_cong [where f=topology]  elim: topology_bases_eq_aux)
       
  4103 
       
  4104 lemma istopology_subbase:
       
  4105    "istopology (arbitrary union_of (finite intersection_of P relative_to S))"
       
  4106   by (simp add: finite_intersection_of_Int istopology_base relative_to_Int)
       
  4107 
       
  4108 lemma openin_subbase:
       
  4109   "openin (topology (arbitrary union_of (finite intersection_of B relative_to U))) S
       
  4110    \<longleftrightarrow> (arbitrary union_of (finite intersection_of B relative_to U)) S"
       
  4111   by (simp add: istopology_subbase topology_inverse')
       
  4112 
       
  4113 lemma topspace_subbase [simp]:
       
  4114    "topspace(topology (arbitrary union_of (finite intersection_of B relative_to U))) = U" (is "?lhs = _")
       
  4115 proof
       
  4116   show "?lhs \<subseteq> U"
       
  4117     by (metis arbitrary_union_of_relative_to openin_subbase openin_topspace relative_to_imp_subset)
       
  4118   show "U \<subseteq> ?lhs"
       
  4119     by (metis arbitrary_union_of_inc finite_intersection_of_empty inf.orderE istopology_subbase 
       
  4120               openin_subset relative_to_inc subset_UNIV topology_inverse')
       
  4121 qed
       
  4122 
       
  4123 lemma minimal_topology_subbase:
       
  4124    "\<lbrakk>\<And>S. P S \<Longrightarrow> openin X S; openin X U;
       
  4125      openin(topology(arbitrary union_of (finite intersection_of P relative_to U))) S\<rbrakk>
       
  4126     \<Longrightarrow> openin X S"
       
  4127   apply (simp add: istopology_subbase topology_inverse)
       
  4128   apply (simp add: union_of_def intersection_of_def relative_to_def)
       
  4129   apply (blast intro: openin_Int_Inter)
       
  4130   done
       
  4131 
       
  4132 lemma istopology_subbase_UNIV:
       
  4133    "istopology (arbitrary union_of (finite intersection_of P))"
       
  4134   by (simp add: istopology_base finite_intersection_of_Int)
       
  4135 
       
  4136 
       
  4137 lemma generate_topology_on_eq:
       
  4138   "generate_topology_on S = arbitrary union_of finite' intersection_of (\<lambda>x. x \<in> S)" (is "?lhs = ?rhs")
       
  4139 proof (intro ext iffI)
       
  4140   fix A
       
  4141   assume "?lhs A"
       
  4142   then show "?rhs A"
       
  4143   proof induction
       
  4144     case (Int a b)
       
  4145     then show ?case
       
  4146       by (metis (mono_tags, lifting) istopology_base_alt finite'_intersection_of_Int istopology_base)
       
  4147   next
       
  4148     case (UN K)
       
  4149     then show ?case
       
  4150       by (simp add: arbitrary_union_of_Union)
       
  4151   next
       
  4152     case (Basis s)
       
  4153     then show ?case
       
  4154       by (simp add: Sup_upper arbitrary_union_of_inc finite'_intersection_of_inc relative_to_subset)
       
  4155   qed auto
       
  4156 next
       
  4157   fix A
       
  4158   assume "?rhs A"
       
  4159   then obtain \<U> where \<U>: "\<And>T. T \<in> \<U> \<Longrightarrow> \<exists>\<F>. finite' \<F> \<and> \<F> \<subseteq> S \<and> \<Inter>\<F> = T" and eq: "A = \<Union>\<U>"
       
  4160     unfolding union_of_def intersection_of_def by auto
       
  4161   show "?lhs A"
       
  4162     unfolding eq
       
  4163   proof (rule generate_topology_on.UN)
       
  4164     fix T
       
  4165     assume "T \<in> \<U>"
       
  4166     with \<U> obtain \<F> where "finite' \<F>" "\<F> \<subseteq> S" "\<Inter>\<F> = T"
       
  4167       by blast
       
  4168     have "generate_topology_on S (\<Inter>\<F>)"
       
  4169     proof (rule generate_topology_on_Inter)
       
  4170       show "finite \<F>" "\<F> \<noteq> {}"
       
  4171         by (auto simp: \<open>finite' \<F>\<close>)
       
  4172       show "\<And>K. K \<in> \<F> \<Longrightarrow> generate_topology_on S K"
       
  4173         by (metis \<open>\<F> \<subseteq> S\<close> generate_topology_on.simps subset_iff)
       
  4174     qed
       
  4175     then show "generate_topology_on S T"
       
  4176       using \<open>\<Inter>\<F> = T\<close> by blast
       
  4177   qed
       
  4178 qed
       
  4179 
       
  4180 subsubsection%important \<open>Continuity\<close>
       
  4181 
       
  4182 text \<open>We will need to deal with continuous maps in terms of topologies and not in terms
       
  4183 of type classes, as defined below.\<close>
       
  4184 
       
  4185 definition%important continuous_on_topo::"'a topology \<Rightarrow> 'b topology \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool"
       
  4186   where "continuous_on_topo T1 T2 f = ((\<forall> U. openin T2 U \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1)))
       
  4187                                       \<and> (f`(topspace T1) \<subseteq> (topspace T2)))"
       
  4188 
       
  4189 lemma continuous_on_continuous_on_topo:
       
  4190   "continuous_on s f \<longleftrightarrow> continuous_on_topo (top_of_set s) euclidean f"
       
  4191   by (auto simp: continuous_on_topo_def Int_commute continuous_openin_preimage_eq)
       
  4192 
       
  4193 lemma continuous_on_topo_UNIV:
       
  4194   "continuous_on UNIV f \<longleftrightarrow> continuous_on_topo euclidean euclidean f"
       
  4195 using continuous_on_continuous_on_topo[of UNIV f] subtopology_UNIV[of euclidean] by auto
       
  4196 
       
  4197 lemma continuous_on_topo_open [intro]:
       
  4198   "continuous_on_topo T1 T2 f \<Longrightarrow> openin T2 U \<Longrightarrow> openin T1 (f-`U \<inter> topspace(T1))"
       
  4199   unfolding continuous_on_topo_def by auto
       
  4200 
       
  4201 lemma continuous_on_topo_topspace [intro]:
       
  4202   "continuous_on_topo T1 T2 f \<Longrightarrow> f`(topspace T1) \<subseteq> (topspace T2)"
       
  4203 unfolding continuous_on_topo_def by auto
       
  4204 
       
  4205 lemma continuous_on_generated_topo_iff:
       
  4206   "continuous_on_topo T1 (topology_generated_by S) f \<longleftrightarrow>
       
  4207       ((\<forall>U. U \<in> S \<longrightarrow> openin T1 (f-`U \<inter> topspace(T1))) \<and> (f`(topspace T1) \<subseteq> (\<Union> S)))"
       
  4208 unfolding continuous_on_topo_def topology_generated_by_topspace
       
  4209 proof (auto simp add: topology_generated_by_Basis)
       
  4210   assume H: "\<forall>U. U \<in> S \<longrightarrow> openin T1 (f -` U \<inter> topspace T1)"
       
  4211   fix U assume "openin (topology_generated_by S) U"
       
  4212   then have "generate_topology_on S U" by (rule openin_topology_generated_by)
       
  4213   then show "openin T1 (f -` U \<inter> topspace T1)"
       
  4214   proof (induct)
       
  4215     fix a b
       
  4216     assume H: "openin T1 (f -` a \<inter> topspace T1)" "openin T1 (f -` b \<inter> topspace T1)"
       
  4217     have "f -` (a \<inter> b) \<inter> topspace T1 = (f-`a \<inter> topspace T1) \<inter> (f-`b \<inter> topspace T1)"
       
  4218       by auto
       
  4219     then show "openin T1 (f -` (a \<inter> b) \<inter> topspace T1)" using H by auto
       
  4220   next
       
  4221     fix K
       
  4222     assume H: "openin T1 (f -` k \<inter> topspace T1)" if "k\<in> K" for k
       
  4223     define L where "L = {f -` k \<inter> topspace T1|k. k \<in> K}"
       
  4224     have *: "openin T1 l" if "l \<in>L" for l using that H unfolding L_def by auto
       
  4225     have "openin T1 (\<Union>L)" using openin_Union[OF *] by simp
       
  4226     moreover have "(\<Union>L) = (f -` \<Union>K \<inter> topspace T1)" unfolding L_def by auto
       
  4227     ultimately show "openin T1 (f -` \<Union>K \<inter> topspace T1)" by simp
       
  4228   qed (auto simp add: H)
       
  4229 qed
       
  4230 
       
  4231 lemma continuous_on_generated_topo:
       
  4232   assumes "\<And>U. U \<in>S \<Longrightarrow> openin T1 (f-`U \<inter> topspace(T1))"
       
  4233           "f`(topspace T1) \<subseteq> (\<Union> S)"
       
  4234   shows "continuous_on_topo T1 (topology_generated_by S) f"
       
  4235   using assms continuous_on_generated_topo_iff by blast
       
  4236 
       
  4237 proposition continuous_on_topo_compose:
       
  4238   assumes "continuous_on_topo T1 T2 f" "continuous_on_topo T2 T3 g"
       
  4239   shows "continuous_on_topo T1 T3 (g o f)"
       
  4240   using assms unfolding continuous_on_topo_def
       
  4241 proof (auto)
       
  4242   fix U :: "'c set"
       
  4243   assume H: "openin T3 U"
       
  4244   have "openin T1 (f -` (g -` U \<inter> topspace T2) \<inter> topspace T1)"
       
  4245     using H assms by blast
       
  4246   moreover have "f -` (g -` U \<inter> topspace T2) \<inter> topspace T1 = (g \<circ> f) -` U \<inter> topspace T1"
       
  4247     using H assms continuous_on_topo_topspace by fastforce
       
  4248   ultimately show "openin T1 ((g \<circ> f) -` U \<inter> topspace T1)"
       
  4249     by simp
       
  4250 qed (blast)
       
  4251 
       
  4252 lemma continuous_on_topo_preimage_topspace [intro]:
       
  4253   assumes "continuous_on_topo T1 T2 f"
       
  4254   shows "f-`(topspace T2) \<inter> topspace T1 = topspace T1"
       
  4255 using assms unfolding continuous_on_topo_def by auto
       
  4256 
       
  4257 
       
  4258 subsubsection%important \<open>Pullback topology\<close>
       
  4259 
       
  4260 text \<open>Pulling back a topology by map gives again a topology. \<open>subtopology\<close> is
       
  4261 a special case of this notion, pulling back by the identity. We introduce the general notion as
       
  4262 we will need it to define the strong operator topology on the space of continuous linear operators,
       
  4263 by pulling back the product topology on the space of all functions.\<close>
       
  4264 
       
  4265 text \<open>\<open>pullback_topology A f T\<close> is the pullback of the topology \<open>T\<close> by the map \<open>f\<close> on
       
  4266 the set \<open>A\<close>.\<close>
       
  4267 
       
  4268 definition%important pullback_topology::"('a set) \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> ('b topology) \<Rightarrow> ('a topology)"
       
  4269   where "pullback_topology A f T = topology (\<lambda>S. \<exists>U. openin T U \<and> S = f-`U \<inter> A)"
       
  4270 
       
  4271 lemma istopology_pullback_topology:
       
  4272   "istopology (\<lambda>S. \<exists>U. openin T U \<and> S = f-`U \<inter> A)"
       
  4273   unfolding istopology_def proof (auto)
       
  4274   fix K assume "\<forall>S\<in>K. \<exists>U. openin T U \<and> S = f -` U \<inter> A"
       
  4275   then have "\<exists>U. \<forall>S\<in>K. openin T (U S) \<and> S = f-`(U S) \<inter> A"
       
  4276     by (rule bchoice)
       
  4277   then obtain U where U: "\<forall>S\<in>K. openin T (U S) \<and> S = f-`(U S) \<inter> A"
       
  4278     by blast
       
  4279   define V where "V = (\<Union>S\<in>K. U S)"
       
  4280   have "openin T V" "\<Union>K = f -` V \<inter> A" unfolding V_def using U by auto
       
  4281   then show "\<exists>V. openin T V \<and> \<Union>K = f -` V \<inter> A" by auto
       
  4282 qed
       
  4283 
       
  4284 lemma openin_pullback_topology:
       
  4285   "openin (pullback_topology A f T) S \<longleftrightarrow> (\<exists>U. openin T U \<and> S = f-`U \<inter> A)"
       
  4286 unfolding pullback_topology_def topology_inverse'[OF istopology_pullback_topology] by auto
       
  4287 
       
  4288 lemma topspace_pullback_topology:
       
  4289   "topspace (pullback_topology A f T) = f-`(topspace T) \<inter> A"
       
  4290 by (auto simp add: topspace_def openin_pullback_topology)
       
  4291 
       
  4292 proposition continuous_on_topo_pullback [intro]:
       
  4293   assumes "continuous_on_topo T1 T2 g"
       
  4294   shows "continuous_on_topo (pullback_topology A f T1) T2 (g o f)"
       
  4295 unfolding continuous_on_topo_def
       
  4296 proof (auto)
       
  4297   fix U::"'b set" assume "openin T2 U"
       
  4298   then have "openin T1 (g-`U \<inter> topspace T1)"
       
  4299     using assms unfolding continuous_on_topo_def by auto
       
  4300   have "(g o f)-`U \<inter> topspace (pullback_topology A f T1) = (g o f)-`U \<inter> A \<inter> f-`(topspace T1)"
       
  4301     unfolding topspace_pullback_topology by auto
       
  4302   also have "... = f-`(g-`U \<inter> topspace T1) \<inter> A "
       
  4303     by auto
       
  4304   also have "openin (pullback_topology A f T1) (...)"
       
  4305     unfolding openin_pullback_topology using \<open>openin T1 (g-`U \<inter> topspace T1)\<close> by auto
       
  4306   finally show "openin (pullback_topology A f T1) ((g \<circ> f) -` U \<inter> topspace (pullback_topology A f T1))"
       
  4307     by auto
       
  4308 next
       
  4309   fix x assume "x \<in> topspace (pullback_topology A f T1)"
       
  4310   then have "f x \<in> topspace T1"
       
  4311     unfolding topspace_pullback_topology by auto
       
  4312   then show "g (f x) \<in> topspace T2"
       
  4313     using assms unfolding continuous_on_topo_def by auto
       
  4314 qed
       
  4315 
       
  4316 proposition continuous_on_topo_pullback' [intro]:
       
  4317   assumes "continuous_on_topo T1 T2 (f o g)" "topspace T1 \<subseteq> g-`A"
       
  4318   shows "continuous_on_topo T1 (pullback_topology A f T2) g"
       
  4319 unfolding continuous_on_topo_def
       
  4320 proof (auto)
       
  4321   fix U assume "openin (pullback_topology A f T2) U"
       
  4322   then have "\<exists>V. openin T2 V \<and> U = f-`V \<inter> A"
       
  4323     unfolding openin_pullback_topology by auto
       
  4324   then obtain V where "openin T2 V" "U = f-`V \<inter> A"
       
  4325     by blast
       
  4326   then have "g -` U \<inter> topspace T1 = g-`(f-`V \<inter> A) \<inter> topspace T1"
       
  4327     by blast
       
  4328   also have "... = (f o g)-`V \<inter> (g-`A \<inter> topspace T1)"
       
  4329     by auto
       
  4330   also have "... = (f o g)-`V \<inter> topspace T1"
       
  4331     using assms(2) by auto
       
  4332   also have "openin T1 (...)"
       
  4333     using assms(1) \<open>openin T2 V\<close> by auto
       
  4334   finally show "openin T1 (g -` U \<inter> topspace T1)" by simp
       
  4335 next
       
  4336   fix x assume "x \<in> topspace T1"
       
  4337   have "(f o g) x \<in> topspace T2"
       
  4338     using assms(1) \<open>x \<in> topspace T1\<close> unfolding continuous_on_topo_def by auto
       
  4339   then have "g x \<in> f-`(topspace T2)"
       
  4340     unfolding comp_def by blast
       
  4341   moreover have "g x \<in> A" using assms(2) \<open>x \<in> topspace T1\<close> by blast
       
  4342   ultimately show "g x \<in> topspace (pullback_topology A f T2)"
       
  4343     unfolding topspace_pullback_topology by blast
       
  4344 qed
       
  4345 
  3897 end
  4346 end