# HG changeset patch # User huffman # Date 1244401203 25200 # Node ID c350f3ad6b0d929740361cbd07557f265978905d # Parent 10080e31b294b2858426dc5536ce060f3c1254c8 move definitions of open, closed to RealVector.thy diff -r 10080e31b294 -r c350f3ad6b0d src/HOL/Library/Topology_Euclidean_Space.thy --- a/src/HOL/Library/Topology_Euclidean_Space.thy Sat Jun 06 10:28:34 2009 -0700 +++ b/src/HOL/Library/Topology_Euclidean_Space.thy Sun Jun 07 12:00:03 2009 -0700 @@ -196,29 +196,9 @@ subsection{* The universal Euclidean versions are what we use most of the time *} definition - "open" :: "'a::topological_space set \ bool" where - "open S \ S \ topo" - -definition - closed :: "'a::topological_space set \ bool" where - "closed S \ open(UNIV - S)" - -definition euclidean :: "'a::topological_space topology" where "euclidean = topology open" -lemma open_UNIV[intro,simp]: "open UNIV" - unfolding open_def by (rule topo_UNIV) - -lemma open_inter[intro]: "open S \ open T \ open (S \ T)" - unfolding open_def by (rule topo_Int) - -lemma open_Union[intro]: "(\S\K. open S) \ open (\ K)" - unfolding open_def subset_eq [symmetric] by (rule topo_Union) - -lemma open_empty[intro,simp]: "open {}" - using open_Union [of "{}"] by simp - lemma open_openin: "open S \ openin euclidean S" unfolding euclidean_def apply (rule cong[where x=S and y=S]) @@ -235,53 +215,11 @@ by (simp add: topspace_euclidean topspace_subtopology) lemma closed_closedin: "closed S \ closedin euclidean S" - by (simp add: closed_def closedin_def topspace_euclidean open_openin) - -lemma open_Un[intro]: - fixes S T :: "'a::topological_space set" - shows "open S \ open T \ open (S\T)" - by (auto simp add: open_openin) + by (simp add: closed_def closedin_def topspace_euclidean open_openin Compl_eq_Diff_UNIV) lemma open_subopen: "open S \ (\x\S. \T. open T \ x \ T \ T \ S)" by (simp add: open_openin openin_subopen[symmetric]) -lemma closed_empty[intro, simp]: "closed {}" by (simp add: closed_closedin) - -lemma closed_UNIV[simp,intro]: "closed UNIV" - by (simp add: closed_closedin topspace_euclidean[symmetric]) - -lemma closed_Un[intro]: "closed S \ closed T \ closed (S\T)" - by (auto simp add: closed_closedin) - -lemma closed_Int[intro]: "closed S \ closed T \ closed (S\T)" - by (auto simp add: closed_closedin) - -lemma closed_Inter[intro]: assumes H: "\S \K. closed S" shows "closed (\K)" - using H - unfolding closed_closedin - apply (cases "K = {}") - apply (simp add: closed_closedin[symmetric]) - apply (rule closedin_Inter, auto) - done - -lemma open_closed: "open S \ closed (UNIV - S)" - by (simp add: open_openin closed_closedin topspace_euclidean openin_closedin_eq) - -lemma closed_open: "closed S \ open(UNIV - S)" - by (simp add: open_openin closed_closedin topspace_euclidean closedin_def) - -lemma open_diff[intro]: "open S \ closed T \ open (S - T)" - by (auto simp add: open_openin closed_closedin) - -lemma closed_diff[intro]: "closed S \ open T \ closed(S-T)" - by (auto simp add: open_openin closed_closedin) - -lemma open_Inter[intro]: assumes fS: "finite S" and h: "\T\S. open T" shows "open (\S)" - using h by (induct rule: finite_induct[OF fS], auto) - -lemma closed_Union[intro]: assumes fS: "finite S" and h: "\T\S. closed T" shows "closed (\S)" - using h by (induct rule: finite_induct[OF fS], auto) - subsection{* Open and closed balls. *} definition @@ -466,7 +404,7 @@ unfolding connected_def openin_open closedin_closed apply (subst exists_diff) by blast hence th0: "connected S \ \ (\e2 e1. closed e2 \ open e1 \ S \ e1 \ (UNIV - e2) \ e1 \ (UNIV - e2) \ S = {} \ e1 \ S \ {} \ (UNIV - e2) \ S \ {})" - (is " _ \ \ (\e2 e1. ?P e2 e1)") apply (simp add: closed_def) by metis + (is " _ \ \ (\e2 e1. ?P e2 e1)") apply (simp add: closed_def Compl_eq_Diff_UNIV) by metis have th1: "?rhs \ \ (\t' t. closed t'\t = S\t' \ t\{} \ t\S \ (\t'. open t' \ t = S \ t'))" (is "_ \ \ (\t' t. ?Q t' t)") @@ -622,7 +560,7 @@ lemma closed_limpt: "closed S \ (\x. x islimpt S \ x \ S)" unfolding closed_def apply (subst open_subopen) - apply (simp add: islimpt_def subset_eq) + apply (simp add: islimpt_def subset_eq Compl_eq_Diff_UNIV) by (metis DiffE DiffI UNIV_I insertCI insert_absorb mem_def) lemma islimpt_EMPTY[simp]: "\ x islimpt {}" @@ -679,7 +617,7 @@ unfolding islimpt_def apply (rule ccontr, clarsimp, rename_tac A B) apply (drule_tac x="A \ B" in spec) - apply (auto simp add: open_inter) + apply (auto simp add: open_Int) done lemma discrete_imp_closed: @@ -731,7 +669,7 @@ lemma interior_inter[simp]: "interior(S \ T) = interior S \ interior T" apply (rule equalityI, simp) apply (metis Int_lower1 Int_lower2 subset_interior) - by (metis Int_mono interior_subset open_inter open_interior open_subset_interior) + by (metis Int_mono interior_subset open_Int open_interior open_subset_interior) lemma interior_limit_point [intro]: fixes x :: "'a::perfect_space" @@ -770,7 +708,7 @@ assume "x \ interior S" with `x \ R` `open R` obtain y where "y \ R - S" unfolding interior_def expand_set_eq by fast - from `open R` `closed S` have "open (R - S)" by (rule open_diff) + from `open R` `closed S` have "open (R - S)" by (rule open_Diff) from `R \ S \ T` have "R - S \ T" by fast from `y \ R - S` `open (R - S)` `R - S \ T` `interior T = {}` show "False" unfolding interior_def by fast @@ -924,7 +862,7 @@ fix A assume "x \ A" "open A" with as have "x \ A \ S" "open (A \ S)" - by (simp_all add: open_inter) + by (simp_all add: open_Int) with * obtain y where "y \ T" "y \ A \ S" "y \ x" by (rule islimptE) hence "y \ S \ T" "y \ A \ y \ x" @@ -955,7 +893,7 @@ definition "frontier S = closure S - interior S" lemma frontier_closed: "closed(frontier S)" - by (simp add: frontier_def closed_diff closed_closure) + by (simp add: frontier_def closed_Diff) lemma frontier_closures: "frontier S = (closure S) \ (closure(UNIV - S))" by (auto simp add: frontier_def interior_closure) @@ -1027,7 +965,7 @@ lemma frontier_disjoint_eq: "frontier S \ S = {} \ open S" using frontier_complement frontier_subset_eq[of "UNIV - S"] - unfolding open_closed by auto + unfolding open_closed Compl_eq_Diff_UNIV by auto subsection{* Common nets and The "within" modifier for nets. *} @@ -1432,7 +1370,7 @@ shows "l \ S" proof (rule ccontr) assume "l \ S" - obtain e where e:"e>0" "ball l e \ UNIV - S" using assms(1) `l \ S` unfolding closed_def open_contains_ball by auto + obtain e where e:"e>0" "ball l e \ UNIV - S" using assms(1) `l \ S` unfolding closed_def open_contains_ball Compl_eq_Diff_UNIV by auto hence *:"\x. dist l x < e \ x \ S" by auto have "eventually (\x. dist (f x) l < e) net" using assms(4) `e>0` by (rule tendstoD) @@ -2926,7 +2864,7 @@ lemma open_delete: fixes s :: "'a::metric_space set" shows "open s ==> open(s - {x})" - using open_diff[of s "{x}"] closed_sing + using open_Diff[of s "{x}"] closed_sing by blast text{* Finite intersection property. I could make it an equivalence in fact. *} @@ -2939,7 +2877,7 @@ proof assume as:"s \ (\ f) = {}" hence "s \ \op - UNIV ` f" by auto - moreover have "Ball (op - UNIV ` f) open" using open_diff closed_diff using assms(2) by auto + moreover have "Ball (op - UNIV ` f) open" using open_Diff closed_Diff using assms(2) by auto ultimately obtain f' where f':"f' \ op - UNIV ` f" "finite f'" "s \ \f'" using assms(1)[unfolded compact_eq_heine_borel, THEN spec[where x="(\t. UNIV - t) ` f"]] by auto hence "finite (op - UNIV ` f') \ op - UNIV ` f' \ f" by(auto simp add: Diff_Diff_Int) hence "s \ \op - UNIV ` f' \ {}" using assms(3)[THEN spec[where x="op - UNIV ` f'"]] by auto @@ -3657,7 +3595,7 @@ proof- obtain T where T: "open T" "{x \ s. f x \ t} = s \ T" using continuous_open_in_preimage[OF assms(1,3)] unfolding openin_open by auto - thus ?thesis using open_inter[of s T, OF assms(2)] by auto + thus ?thesis using open_Int[of s T, OF assms(2)] by auto qed lemma continuous_closed_preimage: @@ -5149,13 +5087,13 @@ lemma open_halfspace_lt: "open {x::real^_. a \ x < b}" proof- have "UNIV - {x. b \ a \ x} = {x. a \ x < b}" by auto - thus ?thesis using closed_halfspace_ge[unfolded closed_def, of b a] by auto + thus ?thesis using closed_halfspace_ge[unfolded closed_def Compl_eq_Diff_UNIV, of b a] by auto qed lemma open_halfspace_gt: "open {x::real^_. a \ x > b}" proof- have "UNIV - {x. b \ a \ x} = {x. a \ x > b}" by auto - thus ?thesis using closed_halfspace_le[unfolded closed_def, of a b] by auto + thus ?thesis using closed_halfspace_le[unfolded closed_def Compl_eq_Diff_UNIV, of a b] by auto qed lemma open_halfspace_component_lt: diff -r 10080e31b294 -r c350f3ad6b0d src/HOL/RealVector.thy --- a/src/HOL/RealVector.thy Sat Jun 06 10:28:34 2009 -0700 +++ b/src/HOL/RealVector.thy Sun Jun 07 12:00:03 2009 -0700 @@ -421,10 +421,94 @@ class topo = fixes topo :: "'a set set" +text {* + The syntactic class uses @{term topo} instead of @{text "open"} + so that @{text "open"} and @{text closed} will have the same type. + Maybe we could use extra type constraints instead, like with + @{text dist} and @{text norm}? +*} + class topological_space = topo + assumes topo_UNIV: "UNIV \ topo" assumes topo_Int: "A \ topo \ B \ topo \ A \ B \ topo" assumes topo_Union: "T \ topo \ \T \ topo" +begin + +definition + "open" :: "'a set \ bool" where + "open S \ S \ topo" + +definition + closed :: "'a set \ bool" where + "closed S \ open (- S)" + +lemma open_UNIV [intro, simp]: "open UNIV" + unfolding open_def by (rule topo_UNIV) + +lemma open_Int [intro]: "open S \ open T \ open (S \ T)" + unfolding open_def by (rule topo_Int) + +lemma open_Union [intro]: "\S\K. open S \ open (\ K)" + unfolding open_def subset_eq [symmetric] by (rule topo_Union) + +lemma open_empty [intro, simp]: "open {}" + using open_Union [of "{}"] by simp + +lemma open_Un [intro]: "open S \ open T \ open (S \ T)" + using open_Union [of "{S, T}"] by simp + +lemma open_UN [intro]: "\x\A. open (B x) \ open (\x\A. B x)" + unfolding UN_eq by (rule open_Union) auto + +lemma open_INT [intro]: "finite A \ \x\A. open (B x) \ open (\x\A. B x)" + by (induct set: finite) auto + +lemma open_Inter [intro]: "finite S \ \T\S. open T \ open (\S)" + unfolding Inter_def by (rule open_INT) + +lemma closed_empty [intro, simp]: "closed {}" + unfolding closed_def by simp + +lemma closed_Un [intro]: "closed S \ closed T \ closed (S \ T)" + unfolding closed_def by auto + +lemma closed_Inter [intro]: "\S\K. closed S \ closed (\ K)" + unfolding closed_def Inter_def by auto + +lemma closed_UNIV [intro, simp]: "closed UNIV" + unfolding closed_def by simp + +lemma closed_Int [intro]: "closed S \ closed T \ closed (S \ T)" + unfolding closed_def by auto + +lemma closed_INT [intro]: "\x\A. closed (B x) \ closed (\x\A. B x)" + unfolding closed_def by auto + +lemma closed_UN [intro]: "finite A \ \x\A. closed (B x) \ closed (\x\A. B x)" + by (induct set: finite) auto + +lemma closed_Union [intro]: "finite S \ \T\S. closed T \ closed (\S)" + unfolding Union_def by (rule closed_UN) + +lemma open_closed: "open S \ closed (- S)" + unfolding closed_def by simp + +lemma closed_open: "closed S \ open (- S)" + unfolding closed_def by simp + +lemma open_Diff [intro]: "open S \ closed T \ open (S - T)" + unfolding closed_open Diff_eq by (rule open_Int) + +lemma closed_Diff [intro]: "closed S \ open T \ closed (S - T)" + unfolding open_closed Diff_eq by (rule closed_Int) + +lemma open_Compl [intro]: "closed S \ open (- S)" + unfolding closed_open . + +lemma closed_Compl [intro]: "open S \ closed (- S)" + unfolding open_closed . + +end subsection {* Metric spaces *}