src/HOL/Probability/Discrete_Topology.thy
 author hoelzl Mon Jan 14 17:29:04 2013 +0100 (2013-01-14) changeset 50881 ae630bab13da parent 50245 dea9363887a6 child 51000 c9adb50f74ad permissions -rw-r--r--
renamed countable_basis_space to second_countable_topology
```     1 (*  Title:      HOL/Probability/Discrete_Topology.thy
```
```     2     Author:     Fabian Immler, TU München
```
```     3 *)
```
```     4
```
```     5 theory Discrete_Topology
```
```     6 imports Multivariate_Analysis
```
```     7 begin
```
```     8
```
```     9 text {* Copy of discrete types with discrete topology. This space is polish. *}
```
```    10
```
```    11 typedef 'a discrete = "UNIV::'a set"
```
```    12 morphisms of_discrete discrete
```
```    13 ..
```
```    14
```
```    15 instantiation discrete :: (type) topological_space
```
```    16 begin
```
```    17
```
```    18 definition open_discrete::"'a discrete set \<Rightarrow> bool"
```
```    19   where "open_discrete s = True"
```
```    20
```
```    21 instance proof qed (auto simp: open_discrete_def)
```
```    22 end
```
```    23
```
```    24 instantiation discrete :: (type) metric_space
```
```    25 begin
```
```    26
```
```    27 definition dist_discrete::"'a discrete \<Rightarrow> 'a discrete \<Rightarrow> real"
```
```    28   where "dist_discrete n m = (if n = m then 0 else 1)"
```
```    29
```
```    30 instance proof qed (auto simp: open_discrete_def dist_discrete_def intro: exI[where x=1])
```
```    31 end
```
```    32
```
```    33 instance discrete :: (type) complete_space
```
```    34 proof
```
```    35   fix X::"nat\<Rightarrow>'a discrete" assume "Cauchy X"
```
```    36   hence "\<exists>n. \<forall>m\<ge>n. X n = X m"
```
```    37     by (force simp: dist_discrete_def Cauchy_def split: split_if_asm dest:spec[where x=1])
```
```    38   then guess n ..
```
```    39   thus "convergent X"
```
```    40     by (intro convergentI[where L="X n"] tendstoI eventually_sequentiallyI[of n])
```
```    41        (simp add: dist_discrete_def)
```
```    42 qed
```
```    43
```
```    44 instance discrete :: (countable) countable
```
```    45 proof
```
```    46   have "inj (\<lambda>c::'a discrete. to_nat (of_discrete c))"
```
```    47     by (simp add: inj_on_def of_discrete_inject)
```
```    48   thus "\<exists>f::'a discrete \<Rightarrow> nat. inj f" by blast
```
```    49 qed
```
```    50
```
```    51 instance discrete :: (countable) second_countable_topology
```
```    52 proof
```
```    53   let ?B = "(range (\<lambda>n::nat. {from_nat n::'a discrete}))"
```
```    54   have "topological_basis ?B"
```
```    55   proof (intro topological_basisI)
```
```    56     fix x::"'a discrete" and O' assume "open O'" "x \<in> O'"
```
```    57     thus "\<exists>B'\<in>range (\<lambda>n. {from_nat n}). x \<in> B' \<and> B' \<subseteq> O'"
```
```    58       by (auto intro: exI[where x="to_nat x"])
```
```    59   qed (simp add: open_discrete_def)
```
```    60   moreover have "countable ?B" by simp
```
```    61   ultimately show "\<exists>B::'a discrete set set. countable B \<and> topological_basis B" by blast
```
```    62 qed
```
```    63
```
```    64 instance discrete :: (countable) polish_space ..
```
```    65
```
```    66 end
```