diff -r 18d4e100c267 -r af691e67f71f src/HOL/Topological_Spaces.thy --- a/src/HOL/Topological_Spaces.thy Mon Dec 08 12:30:47 2014 +0100 +++ b/src/HOL/Topological_Spaces.thy Mon Dec 08 14:32:11 2014 +0100 @@ -297,6 +297,31 @@ case (Basis S) then show ?case by (fastforce intro: exI[of _ y] lt_ex) qed blast+ +subsubsection {* Boolean is an order topology *} + +text {* It also is a discrete topology, but don't have a type class for it (yet). *} + +instantiation bool :: order_topology +begin + +definition open_bool :: "bool set \ bool" where + "open_bool = generate_topology (range (\a. {..< a}) \ range (\a. {a <..}))" + +instance + proof qed (rule open_bool_def) + +end + +lemma open_bool[simp, intro!]: "open (A::bool set)" +proof - + have *: "{False <..} = {True}" "{..< True} = {False}" + by auto + have "A = UNIV \ A = {} \ A = {False <..} \ A = {..< True}" + using subset_UNIV[of A] unfolding UNIV_bool * by auto + then show "open A" + by auto +qed + subsection {* Filters *} text {* @@ -2476,6 +2501,55 @@ end +lemma connected_iff_const: + fixes S :: "'a::topological_space set" + shows "connected S \ (\P::'a \ bool. continuous_on S P \ (\c. \s\S. P s = c))" +proof safe + fix P :: "'a \ bool" assume "connected S" "continuous_on S P" + then have "\b. \A. open A \ A \ S = P -` {b} \ S" + unfolding continuous_on_open_invariant by simp + from this[of True] this[of False] + obtain t f where "open t" "open f" and *: "f \ S = P -` {False} \ S" "t \ S = P -` {True} \ S" + by auto + then have "t \ S = {} \ f \ S = {}" + by (intro connectedD[OF `connected S`]) auto + then show "\c. \s\S. P s = c" + proof (rule disjE) + assume "t \ S = {}" then show ?thesis + unfolding * by (intro exI[of _ False]) auto + next + assume "f \ S = {}" then show ?thesis + unfolding * by (intro exI[of _ True]) auto + qed +next + assume P: "\P::'a \ bool. continuous_on S P \ (\c. \s\S. P s = c)" + show "connected S" + proof (rule connectedI) + fix A B assume *: "open A" "open B" "A \ S \ {}" "B \ S \ {}" "A \ B \ S = {}" "S \ A \ B" + have "continuous_on S (\x. x \ A)" + unfolding continuous_on_open_invariant + proof safe + fix C :: "bool set" + have "C = UNIV \ C = {True} \ C = {False} \ C = {}" + using subset_UNIV[of C] unfolding UNIV_bool by auto + with * show "\T. open T \ T \ S = (\x. x \ A) -` C \ S" + by (intro exI[of _ "(if True \ C then A else {}) \ (if False \ C then B else {})"]) auto + qed + from P[rule_format, OF this] obtain c where "\s. s \ S \ (s \ A) = c" by blast + with * show False + by (cases c) auto + qed +qed + +lemma connectedD_const: + fixes P :: "'a::topological_space \ bool" + shows "connected S \ continuous_on S P \ \c. \s\S. P s = c" + unfolding connected_iff_const by auto + +lemma connectedI_const: + "(\P::'a::topological_space \ bool. continuous_on S P \ \c. \s\S. P s = c) \ connected S" + unfolding connected_iff_const by auto + lemma connected_local_const: assumes "connected A" "a \ A" "b \ A" assumes *: "\a\A. eventually (\b. f a = f b) (at a within A)" @@ -2522,27 +2596,14 @@ assumes *: "continuous_on s f" assumes "connected s" shows "connected (f ` s)" -proof (rule connectedI) - fix A B assume A: "open A" "A \ f ` s \ {}" and B: "open B" "B \ f ` s \ {}" and - AB: "A \ B \ f ` s = {}" "f ` s \ A \ B" - obtain A' where A': "open A'" "f -` A \ s = A' \ s" - using * `open A` unfolding continuous_on_open_invariant by metis - obtain B' where B': "open B'" "f -` B \ s = B' \ s" - using * `open B` unfolding continuous_on_open_invariant by metis - - have "\A B. open A \ open B \ s \ A \ B \ A \ B \ s = {} \ A \ s \ {} \ B \ s \ {}" - proof (rule exI[of _ A'], rule exI[of _ B'], intro conjI) - have "s \ (f -` A \ s) \ (f -` B \ s)" using AB by auto - then show "s \ A' \ B'" using A' B' by auto - next - have "(f -` A \ s) \ (f -` B \ s) = {}" using AB by auto - then show "A' \ B' \ s = {}" using A' B' by auto - qed (insert A' B' A B, auto) - with `connected s` show False - unfolding connected_def by blast +proof (rule connectedI_const) + fix P :: "'b \ bool" assume "continuous_on (f ` s) P" + then have "continuous_on s (P \ f)" + by (rule continuous_on_compose[OF *]) + from connectedD_const[OF `connected s` this] show "\c. \s\f ` s. P s = c" + by auto qed - section {* Connectedness *} class linear_continuum_topology = linorder_topology + linear_continuum