# HG changeset patch # User huffman # Date 1313443757 25200 # Node ID 1e0414bda9af3cb4b6f4a55de4016b8a7245df4d # Parent 6fb54701a11bc5512304340cf88e7865b59426f5 Library/Product_Vector.thy: class instances for t0_space, t1_space, and t2_space diff -r 6fb54701a11b -r 1e0414bda9af src/HOL/Library/Product_Vector.thy --- a/src/HOL/Library/Product_Vector.thy Mon Aug 15 14:09:39 2011 -0700 +++ b/src/HOL/Library/Product_Vector.thy Mon Aug 15 14:29:17 2011 -0700 @@ -154,13 +154,62 @@ then show "\T. open T \ y \ T \ T \ snd ` S" by - (rule exI) qed +text {* Product preserves separation axioms. *} + +lemma mem_Times_iff: "x \ A \ B \ fst x \ A \ snd x \ B" + by (induct x) simp (* TODO: move elsewhere *) + +instance prod :: (t0_space, t0_space) t0_space +proof + fix x y :: "'a \ 'b" assume "x \ y" + hence "fst x \ fst y \ snd x \ snd y" + by (simp add: prod_eq_iff) + thus "\U. open U \ (x \ U) \ (y \ U)" + apply (rule disjE) + apply (drule t0_space, erule exE, rule_tac x="U \ UNIV" in exI) + apply (simp add: open_Times mem_Times_iff) + apply (drule t0_space, erule exE, rule_tac x="UNIV \ U" in exI) + apply (simp add: open_Times mem_Times_iff) + done +qed + +instance prod :: (t1_space, t1_space) t1_space +proof + fix x y :: "'a \ 'b" assume "x \ y" + hence "fst x \ fst y \ snd x \ snd y" + by (simp add: prod_eq_iff) + thus "\U. open U \ x \ U \ y \ U" + apply (rule disjE) + apply (drule t1_space, erule exE, rule_tac x="U \ UNIV" in exI) + apply (simp add: open_Times mem_Times_iff) + apply (drule t1_space, erule exE, rule_tac x="UNIV \ U" in exI) + apply (simp add: open_Times mem_Times_iff) + done +qed + +instance prod :: (t2_space, t2_space) t2_space +proof + fix x y :: "'a \ 'b" assume "x \ y" + hence "fst x \ fst y \ snd x \ snd y" + by (simp add: prod_eq_iff) + thus "\U V. open U \ open V \ x \ U \ y \ V \ U \ V = {}" + apply (rule disjE) + apply (drule hausdorff, clarify) + apply (rule_tac x="U \ UNIV" in exI, rule_tac x="V \ UNIV" in exI) + apply (simp add: open_Times mem_Times_iff disjoint_iff_not_equal) + apply (drule hausdorff, clarify) + apply (rule_tac x="UNIV \ U" in exI, rule_tac x="UNIV \ V" in exI) + apply (simp add: open_Times mem_Times_iff disjoint_iff_not_equal) + done +qed + subsection {* Product is a metric space *} instantiation prod :: (metric_space, metric_space) metric_space begin definition dist_prod_def: - "dist (x::'a \ 'b) y = sqrt ((dist (fst x) (fst y))\ + (dist (snd x) (snd y))\)" + "dist x y = sqrt ((dist (fst x) (fst y))\ + (dist (snd x) (snd y))\)" lemma dist_Pair_Pair: "dist (a, b) (c, d) = sqrt ((dist a c)\ + (dist b d)\)" unfolding dist_prod_def by simp