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