src/HOL/Probability/Discrete_Topology.thy
 changeset 62101 26c0a70f78a3 parent 61808 fc1556774cfe child 62390 842917225d56
1.1 --- a/src/HOL/Probability/Discrete_Topology.thy	Fri Jan 08 16:37:56 2016 +0100
1.2 +++ b/src/HOL/Probability/Discrete_Topology.thy	Fri Jan 08 17:40:59 2016 +0100
1.3 @@ -12,24 +12,24 @@
1.4  morphisms of_discrete discrete
1.5  ..
1.7 -instantiation discrete :: (type) topological_space
1.8 -begin
1.9 -
1.10 -definition open_discrete::"'a discrete set \<Rightarrow> bool"
1.11 -  where "open_discrete s = True"
1.12 -
1.13 -instance proof qed (auto simp: open_discrete_def)
1.14 -end
1.15 -
1.16  instantiation discrete :: (type) metric_space
1.17  begin
1.19 -definition dist_discrete::"'a discrete \<Rightarrow> 'a discrete \<Rightarrow> real"
1.20 +definition dist_discrete :: "'a discrete \<Rightarrow> 'a discrete \<Rightarrow> real"
1.21    where "dist_discrete n m = (if n = m then 0 else 1)"
1.23 -instance proof qed (auto simp: open_discrete_def dist_discrete_def intro: exI[where x=1])
1.24 +definition uniformity_discrete :: "('a discrete \<times> 'a discrete) filter" where
1.25 +  "(uniformity::('a discrete \<times> 'a discrete) filter) = (INF e:{0 <..}. principal {(x, y). dist x y < e})"
1.26 +
1.27 +definition "open_discrete" :: "'a discrete set \<Rightarrow> bool" where
1.28 +  "(open::'a discrete set \<Rightarrow> bool) U \<longleftrightarrow> (\<forall>x\<in>U. eventually (\<lambda>(x', y). x' = x \<longrightarrow> y \<in> U) uniformity)"
1.29 +
1.30 +instance proof qed (auto simp: uniformity_discrete_def open_discrete_def dist_discrete_def intro: exI[where x=1])
1.31  end
1.33 +lemma open_discrete: "open (S :: 'a discrete set)"
1.34 +  unfolding open_dist dist_discrete_def by (auto intro!: exI[of _ "1 / 2"])
1.35 +
1.36  instance discrete :: (type) complete_space
1.37  proof
1.38    fix X::"nat\<Rightarrow>'a discrete" assume "Cauchy X"
1.39 @@ -54,7 +54,7 @@
1.40    have "\<And>S. generate_topology ?B (\<Union>x\<in>S. {x})"
1.41      by (intro generate_topology_Union) (auto intro: generate_topology.intros)
1.42    then have "open = generate_topology ?B"
1.43 -    by (auto intro!: ext simp: open_discrete_def)
1.44 +    by (auto intro!: ext simp: open_discrete)
1.45    moreover have "countable ?B" by simp
1.46    ultimately show "\<exists>B::'a discrete set set. countable B \<and> open = generate_topology B" by blast
1.47  qed