src/HOL/Topological_Spaces.thy
author paulson <lp15@cam.ac.uk>
Tue, 02 May 2023 12:51:05 +0100
changeset 77934 01c88cf514fc
parent 77223 607e1e345e8f
child 78093 cec875dcc59e
permissions -rw-r--r--
A few new theorems
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52265
bb907eba5902 tuned headers;
wenzelm
parents: 51775
diff changeset
     1
(*  Title:      HOL/Topological_Spaces.thy
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
     2
    Author:     Brian Huffman
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
     3
    Author:     Johannes Hölzl
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
     4
*)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
     5
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
     6
section \<open>Topological Spaces\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
     7
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
     8
theory Topological_Spaces
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
     9
  imports Main
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    10
begin
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    11
57953
69728243a614 updated to named_theorems;
wenzelm
parents: 57448
diff changeset
    12
named_theorems continuous_intros "structural introduction rules for continuity"
69728243a614 updated to named_theorems;
wenzelm
parents: 57448
diff changeset
    13
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
    14
subsection \<open>Topological space\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    15
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    16
class "open" =
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    17
  fixes "open" :: "'a set \<Rightarrow> bool"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    18
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    19
class topological_space = "open" +
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    20
  assumes open_UNIV [simp, intro]: "open UNIV"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    21
  assumes open_Int [intro]: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<inter> T)"
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60182
diff changeset
    22
  assumes open_Union [intro]: "\<forall>S\<in>K. open S \<Longrightarrow> open (\<Union>K)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    23
begin
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    24
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
    25
definition closed :: "'a set \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
    26
  where "closed S \<longleftrightarrow> open (- S)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    27
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    28
lemma open_empty [continuous_intros, intro, simp]: "open {}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    29
  using open_Union [of "{}"] by simp
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    30
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    31
lemma open_Un [continuous_intros, intro]: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<union> T)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    32
  using open_Union [of "{S, T}"] by simp
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    33
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    34
lemma open_UN [continuous_intros, intro]: "\<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Union>x\<in>A. B x)"
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
    35
  using open_Union [of "B ` A"] by simp
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    36
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    37
lemma open_Inter [continuous_intros, intro]: "finite S \<Longrightarrow> \<forall>T\<in>S. open T \<Longrightarrow> open (\<Inter>S)"
73832
9db620f007fa More general fold function for maps
nipkow
parents: 73411
diff changeset
    38
  by (induction set: finite) auto
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    39
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    40
lemma open_INT [continuous_intros, intro]: "finite A \<Longrightarrow> \<forall>x\<in>A. open (B x) \<Longrightarrow> open (\<Inter>x\<in>A. B x)"
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
    41
  using open_Inter [of "B ` A"] by simp
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    42
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    43
lemma openI:
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    44
  assumes "\<And>x. x \<in> S \<Longrightarrow> \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S"
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    45
  shows "open S"
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    46
proof -
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    47
  have "open (\<Union>{T. open T \<and> T \<subseteq> S})" by auto
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    48
  moreover have "\<Union>{T. open T \<and> T \<subseteq> S} = S" by (auto dest!: assms)
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    49
  ultimately show "open S" by simp
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    50
qed
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
    51
71063
d628bbdce79a moved lemma
nipkow
parents: 70749
diff changeset
    52
lemma open_subopen: "open S \<longleftrightarrow> (\<forall>x\<in>S. \<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> S)"
d628bbdce79a moved lemma
nipkow
parents: 70749
diff changeset
    53
by (auto intro: openI)
d628bbdce79a moved lemma
nipkow
parents: 70749
diff changeset
    54
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
    55
lemma closed_empty [continuous_intros, intro, simp]: "closed {}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    56
  unfolding closed_def by simp
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    57
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    58
lemma closed_Un [continuous_intros, intro]: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<union> T)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    59
  unfolding closed_def by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    60
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    61
lemma closed_UNIV [continuous_intros, intro, simp]: "closed UNIV"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    62
  unfolding closed_def by simp
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    63
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    64
lemma closed_Int [continuous_intros, intro]: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<inter> T)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    65
  unfolding closed_def by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    66
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    67
lemma closed_INT [continuous_intros, intro]: "\<forall>x\<in>A. closed (B x) \<Longrightarrow> closed (\<Inter>x\<in>A. B x)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    68
  unfolding closed_def by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    69
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60182
diff changeset
    70
lemma closed_Inter [continuous_intros, intro]: "\<forall>S\<in>K. closed S \<Longrightarrow> closed (\<Inter>K)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    71
  unfolding closed_def uminus_Inf by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    72
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    73
lemma closed_Union [continuous_intros, intro]: "finite S \<Longrightarrow> \<forall>T\<in>S. closed T \<Longrightarrow> closed (\<Union>S)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    74
  by (induct set: finite) auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    75
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
    76
lemma closed_UN [continuous_intros, intro]:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
    77
  "finite A \<Longrightarrow> \<forall>x\<in>A. closed (B x) \<Longrightarrow> closed (\<Union>x\<in>A. B x)"
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
    78
  using closed_Union [of "B ` A"] by simp
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    79
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    80
lemma open_closed: "open S \<longleftrightarrow> closed (- S)"
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63092
diff changeset
    81
  by (simp add: closed_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    82
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    83
lemma closed_open: "closed S \<longleftrightarrow> open (- S)"
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63092
diff changeset
    84
  by (rule closed_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    85
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    86
lemma open_Diff [continuous_intros, intro]: "open S \<Longrightarrow> closed T \<Longrightarrow> open (S - T)"
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63092
diff changeset
    87
  by (simp add: closed_open Diff_eq open_Int)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    88
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    89
lemma closed_Diff [continuous_intros, intro]: "closed S \<Longrightarrow> open T \<Longrightarrow> closed (S - T)"
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63092
diff changeset
    90
  by (simp add: open_closed Diff_eq closed_Int)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    91
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    92
lemma open_Compl [continuous_intros, intro]: "closed S \<Longrightarrow> open (- S)"
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63092
diff changeset
    93
  by (simp add: closed_open)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    94
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
    95
lemma closed_Compl [continuous_intros, intro]: "open S \<Longrightarrow> closed (- S)"
63170
eae6549dbea2 tuned proofs, to allow unfold_abs_def;
wenzelm
parents: 63092
diff changeset
    96
  by (simp add: open_closed)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    97
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
    98
lemma open_Collect_neg: "closed {x. P x} \<Longrightarrow> open {x. \<not> P x}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
    99
  unfolding Collect_neg_eq by (rule open_Compl)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   100
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   101
lemma open_Collect_conj:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   102
  assumes "open {x. P x}" "open {x. Q x}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   103
  shows "open {x. P x \<and> Q x}"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   104
  using open_Int[OF assms] by (simp add: Int_def)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   105
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   106
lemma open_Collect_disj:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   107
  assumes "open {x. P x}" "open {x. Q x}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   108
  shows "open {x. P x \<or> Q x}"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   109
  using open_Un[OF assms] by (simp add: Un_def)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   110
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   111
lemma open_Collect_ex: "(\<And>i. open {x. P i x}) \<Longrightarrow> open {x. \<exists>i. P i x}"
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   112
  using open_UN[of UNIV "\<lambda>i. {x. P i x}"] unfolding Collect_ex_eq by simp
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   113
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   114
lemma open_Collect_imp: "closed {x. P x} \<Longrightarrow> open {x. Q x} \<Longrightarrow> open {x. P x \<longrightarrow> Q x}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   115
  unfolding imp_conv_disj by (intro open_Collect_disj open_Collect_neg)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   116
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   117
lemma open_Collect_const: "open {x. P}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   118
  by (cases P) auto
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   119
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   120
lemma closed_Collect_neg: "open {x. P x} \<Longrightarrow> closed {x. \<not> P x}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   121
  unfolding Collect_neg_eq by (rule closed_Compl)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   122
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   123
lemma closed_Collect_conj:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   124
  assumes "closed {x. P x}" "closed {x. Q x}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   125
  shows "closed {x. P x \<and> Q x}"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   126
  using closed_Int[OF assms] by (simp add: Int_def)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   127
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   128
lemma closed_Collect_disj:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   129
  assumes "closed {x. P x}" "closed {x. Q x}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   130
  shows "closed {x. P x \<or> Q x}"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   131
  using closed_Un[OF assms] by (simp add: Un_def)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   132
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   133
lemma closed_Collect_all: "(\<And>i. closed {x. P i x}) \<Longrightarrow> closed {x. \<forall>i. P i x}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   134
  using closed_INT[of UNIV "\<lambda>i. {x. P i x}"] by (simp add: Collect_all_eq)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   135
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   136
lemma closed_Collect_imp: "open {x. P x} \<Longrightarrow> closed {x. Q x} \<Longrightarrow> closed {x. P x \<longrightarrow> Q x}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   137
  unfolding imp_conv_disj by (intro closed_Collect_disj closed_Collect_neg)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   138
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   139
lemma closed_Collect_const: "closed {x. P}"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   140
  by (cases P) auto
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
   141
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   142
end
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   143
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   144
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   145
subsection \<open>Hausdorff and other separation properties\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   146
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   147
class t0_space = topological_space +
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   148
  assumes t0_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U)"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   149
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   150
class t1_space = topological_space +
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   151
  assumes t1_space: "x \<noteq> y \<Longrightarrow> \<exists>U. open U \<and> x \<in> U \<and> y \<notin> U"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   152
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   153
instance t1_space \<subseteq> t0_space
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   154
  by standard (fast dest: t1_space)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   155
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   156
context t1_space begin
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   157
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   158
lemma separation_t1: "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   159
  using t1_space[of x y] by blast
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   160
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   161
lemma closed_singleton [iff]: "closed {a}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   162
proof -
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   163
  let ?T = "\<Union>{S. open S \<and> a \<notin> S}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   164
  have "open ?T"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   165
    by (simp add: open_Union)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   166
  also have "?T = - {a}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   167
    by (auto simp add: set_eq_iff separation_t1)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   168
  finally show "closed {a}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   169
    by (simp only: closed_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   170
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   171
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
   172
lemma closed_insert [continuous_intros, simp]:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   173
  assumes "closed S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   174
  shows "closed (insert a S)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   175
proof -
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   176
  from closed_singleton assms have "closed ({a} \<union> S)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   177
    by (rule closed_Un)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   178
  then show "closed (insert a S)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   179
    by simp
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   180
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   181
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   182
lemma finite_imp_closed: "finite S \<Longrightarrow> closed S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   183
  by (induct pred: finite) simp_all
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   184
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   185
end
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   186
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   187
text \<open>T2 spaces are also known as Hausdorff spaces.\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   188
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   189
class t2_space = topological_space +
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   190
  assumes hausdorff: "x \<noteq> y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   191
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   192
instance t2_space \<subseteq> t1_space
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   193
  by standard (fast dest: hausdorff)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   194
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   195
lemma (in t2_space) separation_t2: "x \<noteq> y \<longleftrightarrow> (\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {})"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   196
  using hausdorff [of x y] by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   197
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   198
lemma (in t0_space) separation_t0: "x \<noteq> y \<longleftrightarrow> (\<exists>U. open U \<and> \<not> (x \<in> U \<longleftrightarrow> y \<in> U))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   199
  using t0_space [of x y] by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   200
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   201
67454
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   202
text \<open>A classical separation axiom for topological space, the T3 axiom -- also called regularity:
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   203
if a point is not in a closed set, then there are open sets separating them.\<close>
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   204
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   205
class t3_space = t2_space +
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   206
  assumes t3_space: "closed S \<Longrightarrow> y \<notin> S \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> y \<in> U \<and> S \<subseteq> V \<and> U \<inter> V = {}"
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   207
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   208
text \<open>A classical separation axiom for topological space, the T4 axiom -- also called normality:
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   209
if two closed sets are disjoint, then there are open sets separating them.\<close>
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   210
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   211
class t4_space = t2_space +
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   212
  assumes t4_space: "closed S \<Longrightarrow> closed T \<Longrightarrow> S \<inter> T = {} \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> S \<subseteq> U \<and> T \<subseteq> V \<and> U \<inter> V = {}"
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   213
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   214
text \<open>T4 is stronger than T3, and weaker than metric.\<close>
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   215
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   216
instance t4_space \<subseteq> t3_space
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   217
proof
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   218
  fix S and y::'a assume "closed S" "y \<notin> S"
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   219
  then show "\<exists>U V. open U \<and> open V \<and> y \<in> U \<and> S \<subseteq> V \<and> U \<inter> V = {}"
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   220
    using t4_space[of "{y}" S] by auto
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   221
qed
867d7e91af65 moved t3/t4 space from AFP/Gromov to here.
nipkow
parents: 67453
diff changeset
   222
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   223
text \<open>A perfect space is a topological space with no isolated points.\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   224
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   225
class perfect_space = topological_space +
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   226
  assumes not_open_singleton: "\<not> open {x}"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   227
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   228
lemma (in perfect_space) UNIV_not_singleton: "UNIV \<noteq> {x}"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   229
  for x::'a
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   230
  by (metis (no_types) open_UNIV not_open_singleton)
62381
a6479cb85944 New and revised material for (multivariate) analysis
paulson <lp15@cam.ac.uk>
parents: 62369
diff changeset
   231
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   232
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   233
subsection \<open>Generators for toplogies\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   234
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   235
inductive generate_topology :: "'a set set \<Rightarrow> 'a set \<Rightarrow> bool" for S :: "'a set set"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   236
  where
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   237
    UNIV: "generate_topology S UNIV"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   238
  | Int: "generate_topology S (a \<inter> b)" if "generate_topology S a" and "generate_topology S b"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   239
  | UN: "generate_topology S (\<Union>K)" if "(\<And>k. k \<in> K \<Longrightarrow> generate_topology S k)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   240
  | Basis: "generate_topology S s" if "s \<in> S"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   241
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   242
hide_fact (open) UNIV Int UN Basis
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   243
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   244
lemma generate_topology_Union:
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   245
  "(\<And>k. k \<in> I \<Longrightarrow> generate_topology S (K k)) \<Longrightarrow> generate_topology S (\<Union>k\<in>I. K k)"
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
   246
  using generate_topology.UN [of "K ` I"] by auto
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   247
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   248
lemma topological_space_generate_topology: "class.topological_space (generate_topology S)"
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 60762
diff changeset
   249
  by standard (auto intro: generate_topology.intros)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   250
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   251
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   252
subsection \<open>Order topologies\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   253
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   254
class order_topology = order + "open" +
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   255
  assumes open_generated_order: "open = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   256
begin
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   257
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   258
subclass topological_space
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   259
  unfolding open_generated_order
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   260
  by (rule topological_space_generate_topology)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   261
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
   262
lemma open_greaterThan [continuous_intros, simp]: "open {a <..}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   263
  unfolding open_generated_order by (auto intro: generate_topology.Basis)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   264
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
   265
lemma open_lessThan [continuous_intros, simp]: "open {..< a}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   266
  unfolding open_generated_order by (auto intro: generate_topology.Basis)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   267
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
   268
lemma open_greaterThanLessThan [continuous_intros, simp]: "open {a <..< b}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   269
   unfolding greaterThanLessThan_eq by (simp add: open_Int)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   270
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   271
end
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   272
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   273
class linorder_topology = linorder + order_topology
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   274
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   275
lemma closed_atMost [continuous_intros, simp]: "closed {..a}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   276
  for a :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   277
  by (simp add: closed_open)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   278
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   279
lemma closed_atLeast [continuous_intros, simp]: "closed {a..}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   280
  for a :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   281
  by (simp add: closed_open)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   282
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   283
lemma closed_atLeastAtMost [continuous_intros, simp]: "closed {a..b}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   284
  for a b :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   285
proof -
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   286
  have "{a .. b} = {a ..} \<inter> {.. b}"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   287
    by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   288
  then show ?thesis
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   289
    by (simp add: closed_Int)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   290
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   291
70749
5d06b7bb9d22 More type class generalisations. Note that linorder_antisym_conv1 and linorder_antisym_conv2 no longer exist.
paulson <lp15@cam.ac.uk>
parents: 70723
diff changeset
   292
lemma (in order) less_separate:
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   293
  assumes "x < y"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   294
  shows "\<exists>a b. x \<in> {..< a} \<and> y \<in> {b <..} \<and> {..< a} \<inter> {b <..} = {}"
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
   295
proof (cases "\<exists>z. x < z \<and> z < y")
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
   296
  case True
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
   297
  then obtain z where "x < z \<and> z < y" ..
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   298
  then have "x \<in> {..< z} \<and> y \<in> {z <..} \<and> {z <..} \<inter> {..< z} = {}"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   299
    by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   300
  then show ?thesis by blast
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   301
next
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
   302
  case False
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   303
  with \<open>x < y\<close> have "x \<in> {..< y}" "y \<in> {x <..}" "{x <..} \<inter> {..< y} = {}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   304
    by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   305
  then show ?thesis by blast
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   306
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   307
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   308
instance linorder_topology \<subseteq> t2_space
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   309
proof
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   310
  fix x y :: 'a
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   311
  show "x \<noteq> y \<Longrightarrow> \<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   312
    using less_separate [of x y] less_separate [of y x]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   313
    by (elim neqE; metis open_lessThan open_greaterThan Int_commute)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   314
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   315
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
   316
lemma (in linorder_topology) open_right:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   317
  assumes "open S" "x \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   318
    and gt_ex: "x < y"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   319
  shows "\<exists>b>x. {x ..< b} \<subseteq> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   320
  using assms unfolding open_generated_order
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   321
proof induct
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   322
  case UNIV
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   323
  then show ?case by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   324
next
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   325
  case (Int A B)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   326
  then obtain a b where "a > x" "{x ..< a} \<subseteq> A"  "b > x" "{x ..< b} \<subseteq> B"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   327
    by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   328
  then show ?case
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   329
    by (auto intro!: exI[of _ "min a b"])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   330
next
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   331
  case UN
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   332
  then show ?case by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   333
next
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   334
  case Basis
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   335
  then show ?case
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   336
    by (fastforce intro: exI[of _ y] gt_ex)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   337
qed
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   338
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   339
lemma (in linorder_topology) open_left:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   340
  assumes "open S" "x \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   341
    and lt_ex: "y < x"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   342
  shows "\<exists>b<x. {b <.. x} \<subseteq> S"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   343
  using assms unfolding open_generated_order
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   344
proof induction
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   345
  case UNIV
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   346
  then show ?case by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   347
next
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   348
  case (Int A B)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   349
  then obtain a b where "a < x" "{a <.. x} \<subseteq> A"  "b < x" "{b <.. x} \<subseteq> B"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   350
    by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   351
  then show ?case
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   352
    by (auto intro!: exI[of _ "max a b"])
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   353
next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   354
  case UN
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   355
  then show ?case by blast
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   356
next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   357
  case Basis
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   358
  then show ?case
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   359
    by (fastforce intro: exI[of _ y] lt_ex)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   360
qed
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   361
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   362
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   363
subsection \<open>Setup some topologies\<close>
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   364
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   365
subsubsection \<open>Boolean is an order topology\<close>
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   366
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   367
class discrete_topology = topological_space +
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   368
  assumes open_discrete: "\<And>A. open A"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   370
instance discrete_topology < t2_space
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   371
proof
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   372
  fix x y :: 'a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   373
  assume "x \<noteq> y"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   374
  then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   375
    by (intro exI[of _ "{_}"]) (auto intro!: open_discrete)
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   376
qed
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   377
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   378
instantiation bool :: linorder_topology
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   379
begin
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   380
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   381
definition open_bool :: "bool set \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   382
  where "open_bool = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   383
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   384
instance
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   385
  by standard (rule open_bool_def)
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   386
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   387
end
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   388
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   389
instance bool :: discrete_topology
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   390
proof
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   391
  fix A :: "bool set"
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   392
  have *: "{False <..} = {True}" "{..< True} = {False}"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   393
    by auto
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   394
  have "A = UNIV \<or> A = {} \<or> A = {False <..} \<or> A = {..< True}"
63171
a0088f1c049d tuned proofs;
wenzelm
parents: 63170
diff changeset
   395
    using subset_UNIV[of A] unfolding UNIV_bool * by blast
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   396
  then show "open A"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   397
    by auto
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   398
qed
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
   399
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   400
instantiation nat :: linorder_topology
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   401
begin
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   402
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   403
definition open_nat :: "nat set \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   404
  where "open_nat = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   405
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   406
instance
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   407
  by standard (rule open_nat_def)
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   408
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   409
end
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   410
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   411
instance nat :: discrete_topology
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   412
proof
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   413
  fix A :: "nat set"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   414
  have "open {n}" for n :: nat
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   415
  proof (cases n)
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   416
    case 0
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   417
    moreover have "{0} = {..<1::nat}"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   418
      by auto
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   419
    ultimately show ?thesis
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   420
       by auto
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   421
  next
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   422
    case (Suc n')
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   423
    then have "{n} = {..<Suc n} \<inter> {n' <..}"
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   424
      by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   425
    with Suc show ?thesis
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   426
      by (auto intro: open_lessThan open_greaterThan)
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   427
  qed
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   428
  then have "open (\<Union>a\<in>A. {a})"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   429
    by (intro open_UN) auto
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   430
  then show "open A"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   431
    by simp
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   432
qed
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   433
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   434
instantiation int :: linorder_topology
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   435
begin
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   436
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   437
definition open_int :: "int set \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   438
  where "open_int = generate_topology (range (\<lambda>a. {..< a}) \<union> range (\<lambda>a. {a <..}))"
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   439
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   440
instance
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   441
  by standard (rule open_int_def)
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   442
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   443
end
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   444
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   445
instance int :: discrete_topology
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   446
proof
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   447
  fix A :: "int set"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   448
  have "{..<i + 1} \<inter> {i-1 <..} = {i}" for i :: int
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   449
    by auto
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   450
  then have "open {i}" for i :: int
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   451
    using open_Int[OF open_lessThan[of "i + 1"] open_greaterThan[of "i - 1"]] by auto
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   452
  then have "open (\<Union>a\<in>A. {a})"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   453
    by (intro open_UN) auto
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   454
  then show "open A"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   455
    by simp
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   456
qed
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   457
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   458
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   459
subsubsection \<open>Topological filters\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   460
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   461
definition (in topological_space) nhds :: "'a \<Rightarrow> 'a filter"
68802
3974935e0252 some modernization of notation
haftmann
parents: 68721
diff changeset
   462
  where "nhds a = (INF S\<in>{S. open S \<and> a \<in> S}. principal S)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   463
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   464
definition (in topological_space) at_within :: "'a \<Rightarrow> 'a set \<Rightarrow> 'a filter"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   465
    ("at (_)/ within (_)" [1000, 60] 60)
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51518
diff changeset
   466
  where "at a within s = inf (nhds a) (principal (s - {a}))"
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51518
diff changeset
   467
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   468
abbreviation (in topological_space) at :: "'a \<Rightarrow> 'a filter"  ("at")
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   469
  where "at x \<equiv> at x within (CONST UNIV)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   470
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   471
abbreviation (in order_topology) at_right :: "'a \<Rightarrow> 'a filter"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   472
  where "at_right x \<equiv> at x within {x <..}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   473
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   474
abbreviation (in order_topology) at_left :: "'a \<Rightarrow> 'a filter"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   475
  where "at_left x \<equiv> at x within {..< x}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   476
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   477
lemma (in topological_space) nhds_generated_topology:
68802
3974935e0252 some modernization of notation
haftmann
parents: 68721
diff changeset
   478
  "open = generate_topology T \<Longrightarrow> nhds x = (INF S\<in>{S\<in>T. x \<in> S}. principal S)"
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   479
  unfolding nhds_def
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   480
proof (safe intro!: antisym INF_greatest)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   481
  fix S
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   482
  assume "generate_topology T S" "x \<in> S"
68802
3974935e0252 some modernization of notation
haftmann
parents: 68721
diff changeset
   483
  then show "(INF S\<in>{S \<in> T. x \<in> S}. principal S) \<le> principal S"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   484
    by induct
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   485
      (auto intro: INF_lower order_trans simp: inf_principal[symmetric] simp del: inf_principal)
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   486
qed (auto intro!: INF_lower intro: generate_topology.intros)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   487
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
   488
lemma (in topological_space) eventually_nhds:
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   489
  "eventually P (nhds a) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. P x))"
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
   490
  unfolding nhds_def by (subst eventually_INF_base) (auto simp: eventually_principal)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   491
65036
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64969
diff changeset
   492
lemma eventually_eventually:
64969
a6953714799d Simplified Gamma_Function
eberlm <eberlm@in.tum.de>
parents: 64845
diff changeset
   493
  "eventually (\<lambda>y. eventually P (nhds y)) (nhds x) = eventually P (nhds x)"
65036
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64969
diff changeset
   494
  by (auto simp: eventually_nhds)
64969
a6953714799d Simplified Gamma_Function
eberlm <eberlm@in.tum.de>
parents: 64845
diff changeset
   495
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   496
lemma (in topological_space) eventually_nhds_in_open:
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   497
  "open s \<Longrightarrow> x \<in> s \<Longrightarrow> eventually (\<lambda>y. y \<in> s) (nhds x)"
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   498
  by (subst eventually_nhds) blast
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   499
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   500
lemma (in topological_space) eventually_nhds_x_imp_x: "eventually P (nhds x) \<Longrightarrow> P x"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   501
  by (subst (asm) eventually_nhds) blast
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   502
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   503
lemma (in topological_space) nhds_neq_bot [simp]: "nhds a \<noteq> bot"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   504
  by (simp add: trivial_limit_def eventually_nhds)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   505
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   506
lemma (in t1_space) t1_space_nhds: "x \<noteq> y \<Longrightarrow> (\<forall>\<^sub>F x in nhds x. x \<noteq> y)"
60182
e1ea5a6379c9 generalized tends over powr; added DERIV rule for powr
hoelzl
parents: 60172
diff changeset
   507
  by (drule t1_space) (auto simp: eventually_nhds)
e1ea5a6379c9 generalized tends over powr; added DERIV rule for powr
hoelzl
parents: 60172
diff changeset
   508
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   509
lemma (in topological_space) nhds_discrete_open: "open {x} \<Longrightarrow> nhds x = principal {x}"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   510
  by (auto simp: nhds_def intro!: antisym INF_greatest INF_lower2[of "{x}"])
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   511
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   512
lemma (in discrete_topology) nhds_discrete: "nhds x = principal {x}"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   513
  by (simp add: nhds_discrete_open open_discrete)
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   514
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   515
lemma (in discrete_topology) at_discrete: "at x within S = bot"
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   516
  unfolding at_within_def nhds_discrete by simp
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
   517
68860
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   518
lemma (in discrete_topology) tendsto_discrete:
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   519
  "filterlim (f :: 'b \<Rightarrow> 'a) (nhds y) F \<longleftrightarrow> eventually (\<lambda>x. f x = y) F"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   520
  by (auto simp: nhds_discrete filterlim_principal)
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   521
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   522
lemma (in topological_space) at_within_eq:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   523
  "at x within s = (INF S\<in>{S. open S \<and> x \<in> S}. principal (S \<inter> s - {x}))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   524
  unfolding nhds_def at_within_def
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   525
  by (subst INF_inf_const2[symmetric]) (auto simp: Diff_Int_distrib)
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   526
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   527
lemma (in topological_space) eventually_at_filter:
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51518
diff changeset
   528
  "eventually P (at a within s) \<longleftrightarrow> eventually (\<lambda>x. x \<noteq> a \<longrightarrow> x \<in> s \<longrightarrow> P x) (nhds a)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   529
  by (simp add: at_within_def eventually_inf_principal imp_conjL[symmetric] conj_commute)
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51518
diff changeset
   530
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   531
lemma (in topological_space) at_le: "s \<subseteq> t \<Longrightarrow> at x within s \<le> at x within t"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51518
diff changeset
   532
  unfolding at_within_def by (intro inf_mono) auto
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51518
diff changeset
   533
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   534
lemma (in topological_space) eventually_at_topological:
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51518
diff changeset
   535
  "eventually P (at a within s) \<longleftrightarrow> (\<exists>S. open S \<and> a \<in> S \<and> (\<forall>x\<in>S. x \<noteq> a \<longrightarrow> x \<in> s \<longrightarrow> P x))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   536
  by (simp add: eventually_nhds eventually_at_filter)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   537
77138
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   538
lemma eventually_at_in_open:
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   539
  assumes "open A" "x \<in> A"
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   540
  shows   "eventually (\<lambda>y. y \<in> A - {x}) (at x)"
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   541
  using assms eventually_at_topological by blast
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   542
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   543
lemma eventually_at_in_open':
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   544
  assumes "open A" "x \<in> A"
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   545
  shows   "eventually (\<lambda>y. y \<in> A) (at x)"
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   546
  using assms eventually_at_topological by blast
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   547
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   548
lemma (in topological_space) at_within_open: "a \<in> S \<Longrightarrow> open S \<Longrightarrow> at a within S = at a"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51518
diff changeset
   549
  unfolding filter_eq_iff eventually_at_topological by (metis open_Int Int_iff UNIV_I)
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
   550
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   551
lemma (in topological_space) at_within_open_NO_MATCH:
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   552
  "a \<in> s \<Longrightarrow> open s \<Longrightarrow> NO_MATCH UNIV s \<Longrightarrow> at a within s = at a"
61234
a9e6052188fa New lemmas
paulson <lp15@cam.ac.uk>
parents: 61204
diff changeset
   553
  by (simp only: at_within_open)
a9e6052188fa New lemmas
paulson <lp15@cam.ac.uk>
parents: 61204
diff changeset
   554
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   555
lemma (in topological_space) at_within_open_subset:
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   556
  "a \<in> S \<Longrightarrow> open S \<Longrightarrow> S \<subseteq> T \<Longrightarrow> at a within T = at a"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   557
  by (metis at_le at_within_open dual_order.antisym subset_UNIV)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   558
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   559
lemma (in topological_space) at_within_nhd:
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   560
  assumes "x \<in> S" "open S" "T \<inter> S - {x} = U \<inter> S - {x}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   561
  shows "at x within T = at x within U"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   562
  unfolding filter_eq_iff eventually_at_filter
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   563
proof (intro allI eventually_subst)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   564
  have "eventually (\<lambda>x. x \<in> S) (nhds x)"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   565
    using \<open>x \<in> S\<close> \<open>open S\<close> by (auto simp: eventually_nhds)
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   566
  then show "\<forall>\<^sub>F n in nhds x. (n \<noteq> x \<longrightarrow> n \<in> T \<longrightarrow> P n) = (n \<noteq> x \<longrightarrow> n \<in> U \<longrightarrow> P n)" for P
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   567
    by eventually_elim (insert \<open>T \<inter> S - {x} = U \<inter> S - {x}\<close>, blast)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   568
qed
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   569
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   570
lemma (in topological_space) at_within_empty [simp]: "at a within {} = bot"
53859
e6cb01686f7b replace lemma with more general simp rule
huffman
parents: 53381
diff changeset
   571
  unfolding at_within_def by simp
e6cb01686f7b replace lemma with more general simp rule
huffman
parents: 53381
diff changeset
   572
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   573
lemma (in topological_space) at_within_union:
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   574
  "at x within (S \<union> T) = sup (at x within S) (at x within T)"
53860
f2d683432580 factor out new lemma
huffman
parents: 53859
diff changeset
   575
  unfolding filter_eq_iff eventually_sup eventually_at_filter
f2d683432580 factor out new lemma
huffman
parents: 53859
diff changeset
   576
  by (auto elim!: eventually_rev_mp)
f2d683432580 factor out new lemma
huffman
parents: 53859
diff changeset
   577
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   578
lemma (in topological_space) at_eq_bot_iff: "at a = bot \<longleftrightarrow> open {a}"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   579
  unfolding trivial_limit_def eventually_at_topological
74668
2d9d02beaf96 simplified some ugly proofs
paulson <lp15@cam.ac.uk>
parents: 74475
diff changeset
   580
  by (metis UNIV_I empty_iff is_singletonE is_singletonI' singleton_iff)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   581
77138
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   582
lemma (in t1_space) eventually_neq_at_within:
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   583
  "eventually (\<lambda>w. w \<noteq> x) (at z within A)"
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   584
  by (smt (verit, ccfv_threshold) eventually_True eventually_at_topological separation_t1)
c8597292cd41 Moved in a large number of highly useful library lemmas, mostly due to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 76724
diff changeset
   585
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   586
lemma (in perfect_space) at_neq_bot [simp]: "at a \<noteq> bot"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   587
  by (simp add: at_eq_bot_iff not_open_singleton)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   588
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   589
lemma (in order_topology) nhds_order:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   590
  "nhds x = inf (INF a\<in>{x <..}. principal {..< a}) (INF a\<in>{..< x}. principal {a <..})"
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   591
proof -
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   592
  have 1: "{S \<in> range lessThan \<union> range greaterThan. x \<in> S} =
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   593
      (\<lambda>a. {..< a}) ` {x <..} \<union> (\<lambda>a. {a <..}) ` {..< x}"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   594
    by auto
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   595
  show ?thesis
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   596
    by (simp only: nhds_generated_topology[OF open_generated_order] INF_union 1 INF_image comp_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   597
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   598
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   599
lemma (in topological_space) filterlim_at_within_If:
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   600
  assumes "filterlim f G (at x within (A \<inter> {x. P x}))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   601
    and "filterlim g G (at x within (A \<inter> {x. \<not>P x}))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   602
  shows "filterlim (\<lambda>x. if P x then f x else g x) G (at x within A)"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   603
proof (rule filterlim_If)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   604
  note assms(1)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   605
  also have "at x within (A \<inter> {x. P x}) = inf (nhds x) (principal (A \<inter> Collect P - {x}))"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   606
    by (simp add: at_within_def)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   607
  also have "A \<inter> Collect P - {x} = (A - {x}) \<inter> Collect P"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   608
    by blast
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   609
  also have "inf (nhds x) (principal \<dots>) = inf (at x within A) (principal (Collect P))"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   610
    by (simp add: at_within_def inf_assoc)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   611
  finally show "filterlim f G (inf (at x within A) (principal (Collect P)))" .
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   612
next
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   613
  note assms(2)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   614
  also have "at x within (A \<inter> {x. \<not> P x}) = inf (nhds x) (principal (A \<inter> {x. \<not> P x} - {x}))"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   615
    by (simp add: at_within_def)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   616
  also have "A \<inter> {x. \<not> P x} - {x} = (A - {x}) \<inter> {x. \<not> P x}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   617
    by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   618
  also have "inf (nhds x) (principal \<dots>) = inf (at x within A) (principal {x. \<not> P x})"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   619
    by (simp add: at_within_def inf_assoc)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   620
  finally show "filterlim g G (inf (at x within A) (principal {x. \<not> P x}))" .
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   621
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   622
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   623
lemma (in topological_space) filterlim_at_If:
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   624
  assumes "filterlim f G (at x within {x. P x})"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   625
    and "filterlim g G (at x within {x. \<not>P x})"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   626
  shows "filterlim (\<lambda>x. if P x then f x else g x) G (at x)"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   627
  using assms by (intro filterlim_at_within_If) simp_all
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   628
lemma (in linorder_topology) at_within_order:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   629
  assumes "UNIV \<noteq> {x}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   630
  shows "at x within s =
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   631
    inf (INF a\<in>{x <..}. principal ({..< a} \<inter> s - {x}))
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   632
        (INF a\<in>{..< x}. principal ({a <..} \<inter> s - {x}))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   633
proof (cases "{x <..} = {}" "{..< x} = {}" rule: case_split [case_product case_split])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   634
  case True_True
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   635
  have "UNIV = {..< x} \<union> {x} \<union> {x <..}"
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   636
    by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   637
  with assms True_True show ?thesis
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   638
    by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   639
qed (auto simp del: inf_principal simp: at_within_def nhds_order Int_Diff
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   640
      inf_principal[symmetric] INF_inf_const2 inf_sup_aci[where 'a="'a filter"])
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   641
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   642
lemma (in linorder_topology) at_left_eq:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   643
  "y < x \<Longrightarrow> at_left x = (INF a\<in>{..< x}. principal {a <..< x})"
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   644
  by (subst at_within_order)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   645
     (auto simp: greaterThan_Int_greaterThan greaterThanLessThan_eq[symmetric] min.absorb2 INF_constant
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   646
           intro!: INF_lower2 inf_absorb2)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   647
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   648
lemma (in linorder_topology) eventually_at_left:
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   649
  "y < x \<Longrightarrow> eventually P (at_left x) \<longleftrightarrow> (\<exists>b<x. \<forall>y>b. y < x \<longrightarrow> P y)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   650
  unfolding at_left_eq
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   651
  by (subst eventually_INF_base) (auto simp: eventually_principal Ball_def)
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   652
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   653
lemma (in linorder_topology) at_right_eq:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   654
  "x < y \<Longrightarrow> at_right x = (INF a\<in>{x <..}. principal {x <..< a})"
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   655
  by (subst at_within_order)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   656
     (auto simp: lessThan_Int_lessThan greaterThanLessThan_eq[symmetric] max.absorb2 INF_constant Int_commute
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   657
           intro!: INF_lower2 inf_absorb1)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   658
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   659
lemma (in linorder_topology) eventually_at_right:
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   660
  "x < y \<Longrightarrow> eventually P (at_right x) \<longleftrightarrow> (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   661
  unfolding at_right_eq
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   662
  by (subst eventually_INF_base) (auto simp: eventually_principal Ball_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   663
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 62049
diff changeset
   664
lemma eventually_at_right_less: "\<forall>\<^sub>F y in at_right (x::'a::{linorder_topology, no_top}). x < y"
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 62049
diff changeset
   665
  using gt_ex[of x] eventually_at_right[of x] by auto
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 62049
diff changeset
   666
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   667
lemma trivial_limit_at_right_top: "at_right (top::_::{order_top,linorder_topology}) = bot"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   668
  by (auto simp: filter_eq_iff eventually_at_topological)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   669
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   670
lemma trivial_limit_at_left_bot: "at_left (bot::_::{order_bot,linorder_topology}) = bot"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   671
  by (auto simp: filter_eq_iff eventually_at_topological)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   672
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   673
lemma trivial_limit_at_left_real [simp]: "\<not> trivial_limit (at_left x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   674
  for x :: "'a::{no_bot,dense_order,linorder_topology}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   675
  using lt_ex [of x]
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57025
diff changeset
   676
  by safe (auto simp add: trivial_limit_def eventually_at_left dest: dense)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   677
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   678
lemma trivial_limit_at_right_real [simp]: "\<not> trivial_limit (at_right x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   679
  for x :: "'a::{no_top,dense_order,linorder_topology}"
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57025
diff changeset
   680
  using gt_ex[of x]
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57025
diff changeset
   681
  by safe (auto simp add: trivial_limit_def eventually_at_right dest: dense)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   682
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   683
lemma (in linorder_topology) at_eq_sup_left_right: "at x = sup (at_left x) (at_right x)"
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   684
  by (auto simp: eventually_at_filter filter_eq_iff eventually_sup
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   685
      elim: eventually_elim2 eventually_mono)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   686
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   687
lemma (in linorder_topology) eventually_at_split:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   688
  "eventually P (at x) \<longleftrightarrow> eventually P (at_left x) \<and> eventually P (at_right x)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   689
  by (subst at_eq_sup_left_right) (simp add: eventually_sup)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   690
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   691
lemma (in order_topology) eventually_at_leftI:
63713
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   692
  assumes "\<And>x. x \<in> {a<..<b} \<Longrightarrow> P x" "a < b"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   693
  shows   "eventually P (at_left b)"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   694
  using assms unfolding eventually_at_topological by (intro exI[of _ "{a<..}"]) auto
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   695
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   696
lemma (in order_topology) eventually_at_rightI:
63713
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   697
  assumes "\<And>x. x \<in> {a<..<b} \<Longrightarrow> P x" "a < b"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   698
  shows   "eventually P (at_right a)"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   699
  using assms unfolding eventually_at_topological by (intro exI[of _ "{..<b}"]) auto
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   700
66162
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   701
lemma eventually_filtercomap_nhds:
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   702
  "eventually P (filtercomap f (nhds x)) \<longleftrightarrow> (\<exists>S. open S \<and> x \<in> S \<and> (\<forall>x. f x \<in> S \<longrightarrow> P x))"
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   703
  unfolding eventually_filtercomap eventually_nhds by auto
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   704
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   705
lemma eventually_filtercomap_at_topological:
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   706
  "eventually P (filtercomap f (at A within B)) \<longleftrightarrow> 
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   707
     (\<exists>S. open S \<and> A \<in> S \<and> (\<forall>x. f x \<in> S \<inter> B - {A} \<longrightarrow> P x))" (is "?lhs = ?rhs")
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   708
  unfolding at_within_def filtercomap_inf eventually_inf_principal filtercomap_principal 
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   709
          eventually_filtercomap_nhds eventually_principal by blast
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   710
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   711
lemma eventually_at_right_field:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   712
  "eventually P (at_right x) \<longleftrightarrow> (\<exists>b>x. \<forall>y>x. y < b \<longrightarrow> P y)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   713
  for x :: "'a::{linordered_field, linorder_topology}"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   714
  using linordered_field_no_ub[rule_format, of x]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   715
  by (auto simp: eventually_at_right)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   716
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   717
lemma eventually_at_left_field:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   718
  "eventually P (at_left x) \<longleftrightarrow> (\<exists>b<x. \<forall>y>b. y < x \<longrightarrow> P y)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   719
  for x :: "'a::{linordered_field, linorder_topology}"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   720
  using linordered_field_no_lb[rule_format, of x]
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   721
  by (auto simp: eventually_at_left)
66162
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   722
77140
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   723
lemma filtermap_nhds_eq_imp_filtermap_at_eq: 
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   724
  assumes "filtermap f (nhds z) = nhds (f z)"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   725
  assumes "eventually (\<lambda>x. f x = f z \<longrightarrow> x = z) (at z)"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   726
  shows   "filtermap f (at z) = at (f z)"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   727
proof (rule filter_eqI)
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   728
  fix P :: "'a \<Rightarrow> bool"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   729
  have "eventually P (filtermap f (at z)) \<longleftrightarrow> (\<forall>\<^sub>F x in nhds z. x \<noteq> z \<longrightarrow> P (f x))"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   730
    by (simp add: eventually_filtermap eventually_at_filter)
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   731
  also have "\<dots> \<longleftrightarrow> (\<forall>\<^sub>F x in nhds z. f x \<noteq> f z \<longrightarrow> P (f x))"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   732
    by (rule eventually_cong [OF assms(2)[unfolded eventually_at_filter]]) auto
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   733
  also have "\<dots> \<longleftrightarrow> (\<forall>\<^sub>F x in filtermap f (nhds z). x \<noteq> f z \<longrightarrow> P x)"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   734
    by (simp add: eventually_filtermap)
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   735
  also have "filtermap f (nhds z) = nhds (f z)"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   736
    by (rule assms)
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   737
  also have "(\<forall>\<^sub>F x in nhds (f z). x \<noteq> f z \<longrightarrow> P x) \<longleftrightarrow> (\<forall>\<^sub>F x in at (f z). P x)"
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   738
    by (simp add: eventually_at_filter)
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   739
  finally show "eventually P (filtermap f (at z)) = eventually P (at (f z))" .
9a60c1759543 Lots more new material thanks to Manuel Eberl
paulson <lp15@cam.ac.uk>
parents: 77138
diff changeset
   740
qed
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   741
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   742
subsubsection \<open>Tendsto\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   743
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   744
abbreviation (in topological_space)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   745
  tendsto :: "('b \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'b filter \<Rightarrow> bool"  (infixr "\<longlongrightarrow>" 55)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   746
  where "(f \<longlongrightarrow> l) F \<equiv> filterlim f (nhds l) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   747
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   748
definition (in t2_space) Lim :: "'f filter \<Rightarrow> ('f \<Rightarrow> 'a) \<Rightarrow> 'a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   749
  where "Lim A f = (THE l. (f \<longlongrightarrow> l) A)"
51478
270b21f3ae0a move continuous and continuous_on to the HOL image; isCont is an abbreviation for continuous (at x) (isCont is now restricted to a T2 space)
hoelzl
parents: 51474
diff changeset
   750
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   751
lemma (in topological_space) tendsto_eq_rhs: "(f \<longlongrightarrow> x) F \<Longrightarrow> x = y \<Longrightarrow> (f \<longlongrightarrow> y) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   752
  by simp
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   753
57953
69728243a614 updated to named_theorems;
wenzelm
parents: 57448
diff changeset
   754
named_theorems tendsto_intros "introduction rules for tendsto"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   755
setup \<open>
67149
e61557884799 prefer control symbol antiquotations;
wenzelm
parents: 66827
diff changeset
   756
  Global_Theory.add_thms_dynamic (\<^binding>\<open>tendsto_eq_intros\<close>,
57953
69728243a614 updated to named_theorems;
wenzelm
parents: 57448
diff changeset
   757
    fn context =>
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 69546
diff changeset
   758
      Named_Theorems.get (Context.proof_of context) \<^named_theorems>\<open>tendsto_intros\<close>
57953
69728243a614 updated to named_theorems;
wenzelm
parents: 57448
diff changeset
   759
      |> map_filter (try (fn thm => @{thm tendsto_eq_rhs} OF [thm])))
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   760
\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   761
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   762
context topological_space begin
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   763
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   764
lemma tendsto_def:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   765
   "(f \<longlongrightarrow> l) F \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) F)"
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
   766
   unfolding nhds_def filterlim_INF filterlim_principal by auto
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   767
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   768
lemma tendsto_cong: "(f \<longlongrightarrow> c) F \<longleftrightarrow> (g \<longlongrightarrow> c) F" if "eventually (\<lambda>x. f x = g x) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   769
  by (rule filterlim_cong [OF refl refl that])
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   770
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   771
lemma tendsto_mono: "F \<le> F' \<Longrightarrow> (f \<longlongrightarrow> l) F' \<Longrightarrow> (f \<longlongrightarrow> l) F"