src/HOL/Topological_Spaces.thy
author nipkow
Wed, 06 Nov 2019 17:38:19 +0100
changeset 71063 d628bbdce79a
parent 70749 5d06b7bb9d22
child 71827 5e315defb038
permissions -rw-r--r--
moved lemma
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)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
    38
  by (induct set: finite) auto
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
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   538
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
   539
  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
   540
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   541
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
   542
  "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
   543
  by (simp only: at_within_open)
a9e6052188fa New lemmas
paulson <lp15@cam.ac.uk>
parents: 61204
diff changeset
   544
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   545
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
   546
  "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
   547
  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
   548
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   549
lemma (in topological_space) at_within_nhd:
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   550
  assumes "x \<in> S" "open S" "T \<inter> S - {x} = U \<inter> S - {x}"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   551
  shows "at x within T = at x within U"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   552
  unfolding filter_eq_iff eventually_at_filter
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   553
proof (intro allI eventually_subst)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   554
  have "eventually (\<lambda>x. x \<in> S) (nhds x)"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   555
    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
   556
  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
   557
    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
   558
qed
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
   559
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   560
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
   561
  unfolding at_within_def by simp
e6cb01686f7b replace lemma with more general simp rule
huffman
parents: 53381
diff changeset
   562
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   563
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
   564
  "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
   565
  unfolding filter_eq_iff eventually_sup eventually_at_filter
f2d683432580 factor out new lemma
huffman
parents: 53859
diff changeset
   566
  by (auto elim!: eventually_rev_mp)
f2d683432580 factor out new lemma
huffman
parents: 53859
diff changeset
   567
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   568
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
   569
  unfolding trivial_limit_def eventually_at_topological
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   570
  apply safe
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   571
   apply (case_tac "S = {a}")
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   572
    apply simp
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   573
   apply fast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   574
  apply fast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   575
  done
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   576
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   577
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
   578
  by (simp add: at_eq_bot_iff not_open_singleton)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   579
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   580
lemma (in order_topology) nhds_order:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   581
  "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
   582
proof -
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
   583
  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
   584
      (\<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
   585
    by auto
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   586
  show ?thesis
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   587
    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
   588
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   589
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   590
lemma (in topological_space) filterlim_at_within_If:
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   591
  assumes "filterlim f G (at x within (A \<inter> {x. P x}))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   592
    and "filterlim g G (at x within (A \<inter> {x. \<not>P x}))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   593
  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
   594
proof (rule filterlim_If)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   595
  note assms(1)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   596
  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
   597
    by (simp add: at_within_def)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   598
  also have "A \<inter> Collect P - {x} = (A - {x}) \<inter> Collect P"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   599
    by blast
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   600
  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
   601
    by (simp add: at_within_def inf_assoc)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   602
  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
   603
next
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   604
  note assms(2)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   605
  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
   606
    by (simp add: at_within_def)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   607
  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
   608
    by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   609
  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
   610
    by (simp add: at_within_def inf_assoc)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   611
  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
   612
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   613
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   614
lemma (in topological_space) filterlim_at_If:
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
   615
  assumes "filterlim f G (at x within {x. P x})"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   616
    and "filterlim g G (at x within {x. \<not>P x})"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   617
  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
   618
  using assms by (intro filterlim_at_within_If) simp_all
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   619
lemma (in linorder_topology) at_within_order:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   620
  assumes "UNIV \<noteq> {x}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   621
  shows "at x within s =
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   622
    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
   623
        (INF a\<in>{..< x}. principal ({a <..} \<inter> s - {x}))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   624
proof (cases "{x <..} = {}" "{..< x} = {}" rule: case_split [case_product case_split])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   625
  case True_True
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   626
  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
   627
    by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   628
  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
   629
    by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   630
qed (auto simp del: inf_principal simp: at_within_def nhds_order Int_Diff
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   631
      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
   632
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   633
lemma (in linorder_topology) at_left_eq:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   634
  "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
   635
  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
   636
     (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
   637
           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
   638
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   639
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
   640
  "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
   641
  unfolding at_left_eq
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   642
  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
   643
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   644
lemma (in linorder_topology) at_right_eq:
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
   645
  "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
   646
  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
   647
     (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
   648
           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
   649
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   650
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
   651
  "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
   652
  unfolding at_right_eq
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   653
  by (subst eventually_INF_base) (auto simp: eventually_principal Ball_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   654
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 62049
diff changeset
   655
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
   656
  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
   657
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   658
lemma trivial_limit_at_right_top: "at_right (top::_::{order_top,linorder_topology}) = bot"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   659
  by (auto simp: filter_eq_iff eventually_at_topological)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   660
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   661
lemma trivial_limit_at_left_bot: "at_left (bot::_::{order_bot,linorder_topology}) = bot"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   662
  by (auto simp: filter_eq_iff eventually_at_topological)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   663
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   664
lemma trivial_limit_at_left_real [simp]: "\<not> trivial_limit (at_left x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   665
  for x :: "'a::{no_bot,dense_order,linorder_topology}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   666
  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
   667
  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
   668
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   669
lemma trivial_limit_at_right_real [simp]: "\<not> trivial_limit (at_right x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   670
  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
   671
  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
   672
  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
   673
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   674
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
   675
  by (auto simp: eventually_at_filter filter_eq_iff eventually_sup
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   676
      elim: eventually_elim2 eventually_mono)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   677
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   678
lemma (in linorder_topology) eventually_at_split:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   679
  "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
   680
  by (subst at_eq_sup_left_right) (simp add: eventually_sup)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   681
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   682
lemma (in order_topology) eventually_at_leftI:
63713
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   683
  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
   684
  shows   "eventually P (at_left b)"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   685
  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
   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 order_topology) eventually_at_rightI:
63713
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   688
  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
   689
  shows   "eventually P (at_right a)"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   690
  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
   691
66162
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   692
lemma eventually_filtercomap_nhds:
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   693
  "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
   694
  unfolding eventually_filtercomap eventually_nhds by auto
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   695
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   696
lemma eventually_filtercomap_at_topological:
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   697
  "eventually P (filtercomap f (at A within B)) \<longleftrightarrow> 
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   698
     (\<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
   699
  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
   700
          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
   701
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   702
lemma eventually_at_right_field:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   703
  "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
   704
  for x :: "'a::{linordered_field, linorder_topology}"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   705
  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
   706
  by (auto simp: eventually_at_right)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   707
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   708
lemma eventually_at_left_field:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   709
  "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
   710
  for x :: "'a::{linordered_field, linorder_topology}"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   711
  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
   712
  by (auto simp: eventually_at_left)
66162
65cd285f6b9c Contravariant map on filters
eberlm <eberlm@in.tum.de>
parents: 65583
diff changeset
   713
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   714
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   715
subsubsection \<open>Tendsto\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   716
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   717
abbreviation (in topological_space)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   718
  tendsto :: "('b \<Rightarrow> 'a) \<Rightarrow> 'a \<Rightarrow> 'b filter \<Rightarrow> bool"  (infixr "\<longlongrightarrow>" 55)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   719
  where "(f \<longlongrightarrow> l) F \<equiv> filterlim f (nhds l) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   720
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   721
definition (in t2_space) Lim :: "'f filter \<Rightarrow> ('f \<Rightarrow> 'a) \<Rightarrow> 'a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   722
  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
   723
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   724
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
   725
  by simp
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   726
57953
69728243a614 updated to named_theorems;
wenzelm
parents: 57448
diff changeset
   727
named_theorems tendsto_intros "introduction rules for tendsto"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   728
setup \<open>
67149
e61557884799 prefer control symbol antiquotations;
wenzelm
parents: 66827
diff changeset
   729
  Global_Theory.add_thms_dynamic (\<^binding>\<open>tendsto_eq_intros\<close>,
57953
69728243a614 updated to named_theorems;
wenzelm
parents: 57448
diff changeset
   730
    fn context =>
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 69546
diff changeset
   731
      Named_Theorems.get (Context.proof_of context) \<^named_theorems>\<open>tendsto_intros\<close>
57953
69728243a614 updated to named_theorems;
wenzelm
parents: 57448
diff changeset
   732
      |> map_filter (try (fn thm => @{thm tendsto_eq_rhs} OF [thm])))
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   733
\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   734
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   735
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
   736
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   737
lemma tendsto_def:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   738
   "(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
   739
   unfolding nhds_def filterlim_INF filterlim_principal by auto
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   740
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   741
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
   742
  by (rule filterlim_cong [OF refl refl that])
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   743
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   744
lemma tendsto_mono: "F \<le> F' \<Longrightarrow> (f \<longlongrightarrow> l) F' \<Longrightarrow> (f \<longlongrightarrow> l) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   745
  unfolding tendsto_def le_filter_def by fast
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   746
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   747
lemma tendsto_ident_at [tendsto_intros, simp, intro]: "((\<lambda>x. x) \<longlongrightarrow> a) (at a within s)"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   748
  by (auto simp: tendsto_def eventually_at_topological)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   749
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   750
lemma tendsto_const [tendsto_intros, simp, intro]: "((\<lambda>x. k) \<longlongrightarrow> k) F"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   751
  by (simp add: tendsto_def)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   752
67950
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   753
lemma filterlim_at:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   754
  "(LIM x F. f x :> at b within s) \<longleftrightarrow> eventually (\<lambda>x. f x \<in> s \<and> f x \<noteq> b) F \<and> (f \<longlongrightarrow> b) F"
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
   755
  by (simp add: at_within_def filterlim_inf filterlim_principal conj_commute)
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
   756
67950
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   757
lemma (in -)
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   758
  assumes "filterlim f (nhds L) F"
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   759
  shows tendsto_imp_filterlim_at_right:
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   760
          "eventually (\<lambda>x. f x > L) F \<Longrightarrow> filterlim f (at_right L) F"
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   761
    and tendsto_imp_filterlim_at_left:
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   762
          "eventually (\<lambda>x. f x < L) F \<Longrightarrow> filterlim f (at_left L) F"
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   763
  using assms by (auto simp: filterlim_at elim: eventually_mono)
99eaa5cedbb7 Added some simple facts about limits
Manuel Eberl <eberlm@in.tum.de>
parents: 67727
diff changeset
   764
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   765
lemma  filterlim_at_withinI:
63713
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   766
  assumes "filterlim f (nhds c) F"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   767
  assumes "eventually (\<lambda>x. f x \<in> A - {c}) F"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   768
  shows   "filterlim f (at c within A) F"
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63952
diff changeset
   769
  using assms by (simp add: filterlim_at)
63713
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   770
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   771
lemma filterlim_atI:
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   772
  assumes "filterlim f (nhds c) F"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   773
  assumes "eventually (\<lambda>x. f x \<noteq> c) F"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   774
  shows   "filterlim f (at c) F"
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   775
  using assms by (intro filterlim_at_withinI) simp_all
009e176e1010 Tuned L'Hospital
eberlm <eberlm@in.tum.de>
parents: 63495
diff changeset
   776
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   777
lemma topological_tendstoI:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   778
  "(\<And>S. open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F) \<Longrightarrow> (f \<longlongrightarrow> l) F"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   779
  by (auto simp: tendsto_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   780
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   781
lemma topological_tendstoD:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   782
  "(f \<longlongrightarrow> l) F \<Longrightarrow> open S \<Longrightarrow> l \<in> S \<Longrightarrow> eventually (\<lambda>x. f x \<in> S) F"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   783
  by (auto simp: tendsto_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   784
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   785
lemma tendsto_bot [simp]: "(f \<longlongrightarrow> a) bot"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   786
  by (simp add: tendsto_def)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   787
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
   788
lemma tendsto_eventually: "eventually (\<lambda>x. f x = l) net \<Longrightarrow> ((\<lambda>x. f x) \<longlongrightarrow> l) net"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
   789
  by (rule topological_tendstoI) (auto elim: eventually_mono)
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
   790
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   791
end
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   792
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   793
lemma (in topological_space) filterlim_within_subset:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   794
  "filterlim f l (at x within S) \<Longrightarrow> T \<subseteq> S \<Longrightarrow> filterlim f l (at x within T)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   795
  by (blast intro: filterlim_mono at_le)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   796
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
   797
lemmas tendsto_within_subset = filterlim_within_subset
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   798
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   799
lemma (in order_topology) order_tendsto_iff:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   800
  "(f \<longlongrightarrow> x) F \<longleftrightarrow> (\<forall>l<x. eventually (\<lambda>x. l < f x) F) \<and> (\<forall>u>x. eventually (\<lambda>x. f x < u) F)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   801
  by (auto simp: nhds_order filterlim_inf filterlim_INF filterlim_principal)
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   802
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   803
lemma (in order_topology) order_tendstoI:
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   804
  "(\<And>a. a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F) \<Longrightarrow> (\<And>a. y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F) \<Longrightarrow>
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   805
    (f \<longlongrightarrow> y) F"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   806
  by (auto simp: order_tendsto_iff)
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   807
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
   808
lemma (in order_topology) order_tendstoD:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   809
  assumes "(f \<longlongrightarrow> y) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   810
  shows "a < y \<Longrightarrow> eventually (\<lambda>x. a < f x) F"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   811
    and "y < a \<Longrightarrow> eventually (\<lambda>x. f x < a) F"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   812
  using assms by (auto simp: order_tendsto_iff)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   813
67453
afefc45ed4e9 more automation
nipkow
parents: 67231
diff changeset
   814
lemma (in linorder_topology) tendsto_max[tendsto_intros]:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   815
  assumes X: "(X \<longlongrightarrow> x) net"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   816
    and Y: "(Y \<longlongrightarrow> y) net"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   817
  shows "((\<lambda>x. max (X x) (Y x)) \<longlongrightarrow> max x y) net"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   818
proof (rule order_tendstoI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   819
  fix a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   820
  assume "a < max x y"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   821
  then show "eventually (\<lambda>x. a < max (X x) (Y x)) net"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   822
    using order_tendstoD(1)[OF X, of a] order_tendstoD(1)[OF Y, of a]
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61806
diff changeset
   823
    by (auto simp: less_max_iff_disj elim: eventually_mono)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   824
next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   825
  fix a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   826
  assume "max x y < a"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   827
  then show "eventually (\<lambda>x. max (X x) (Y x) < a) net"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   828
    using order_tendstoD(2)[OF X, of a] order_tendstoD(2)[OF Y, of a]
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   829
    by (auto simp: eventually_conj_iff)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   830
qed
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   831
67453
afefc45ed4e9 more automation
nipkow
parents: 67231
diff changeset
   832
lemma (in linorder_topology) tendsto_min[tendsto_intros]:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   833
  assumes X: "(X \<longlongrightarrow> x) net"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   834
    and Y: "(Y \<longlongrightarrow> y) net"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   835
  shows "((\<lambda>x. min (X x) (Y x)) \<longlongrightarrow> min x y) net"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   836
proof (rule order_tendstoI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   837
  fix a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   838
  assume "a < min x y"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   839
  then show "eventually (\<lambda>x. a < min (X x) (Y x)) net"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   840
    using order_tendstoD(1)[OF X, of a] order_tendstoD(1)[OF Y, of a]
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   841
    by (auto simp: eventually_conj_iff)
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   842
next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   843
  fix a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   844
  assume "min x y < a"
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   845
  then show "eventually (\<lambda>x. min (X x) (Y x) < a) net"
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   846
    using order_tendstoD(2)[OF X, of a] order_tendstoD(2)[OF Y, of a]
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61806
diff changeset
   847
    by (auto simp: min_less_iff_disj elim: eventually_mono)
56949
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   848
qed
d1a937cbf858 clean up Lebesgue integration
hoelzl
parents: 56524
diff changeset
   849
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   850
lemma (in order_topology)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   851
  assumes "a < b"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   852
  shows at_within_Icc_at_right: "at a within {a..b} = at_right a"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   853
    and at_within_Icc_at_left:  "at b within {a..b} = at_left b"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   854
  using order_tendstoD(2)[OF tendsto_ident_at assms, of "{a<..}"]
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   855
  using order_tendstoD(1)[OF tendsto_ident_at assms, of "{..<b}"]
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   856
  by (auto intro!: order_class.antisym filter_leI
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   857
      simp: eventually_at_filter less_le
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   858
      elim: eventually_elim2)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   859
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   860
lemma (in order_topology) at_within_Icc_at: "a < x \<Longrightarrow> x < b \<Longrightarrow> at x within {a..b} = at x"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   861
  by (rule at_within_open_subset[where S="{a<..<b}"]) auto
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   862
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
   863
lemma (in t2_space) tendsto_unique:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   864
  assumes "F \<noteq> bot"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   865
    and "(f \<longlongrightarrow> a) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   866
    and "(f \<longlongrightarrow> b) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   867
  shows "a = b"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   868
proof (rule ccontr)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   869
  assume "a \<noteq> b"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   870
  obtain U V where "open U" "open V" "a \<in> U" "b \<in> V" "U \<inter> V = {}"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   871
    using hausdorff [OF \<open>a \<noteq> b\<close>] by fast
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   872
  have "eventually (\<lambda>x. f x \<in> U) F"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   873
    using \<open>(f \<longlongrightarrow> a) F\<close> \<open>open U\<close> \<open>a \<in> U\<close> by (rule topological_tendstoD)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   874
  moreover
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   875
  have "eventually (\<lambda>x. f x \<in> V) F"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   876
    using \<open>(f \<longlongrightarrow> b) F\<close> \<open>open V\<close> \<open>b \<in> V\<close> by (rule topological_tendstoD)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   877
  ultimately
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   878
  have "eventually (\<lambda>x. False) F"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   879
  proof eventually_elim
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   880
    case (elim x)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   881
    then have "f x \<in> U \<inter> V" by simp
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   882
    with \<open>U \<inter> V = {}\<close> show ?case by simp
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   883
  qed
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
   884
  with \<open>\<not> trivial_limit F\<close> show "False"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   885
    by (simp add: trivial_limit_def)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   886
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   887
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
   888
lemma (in t2_space) tendsto_const_iff:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   889
  fixes a b :: 'a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   890
  assumes "\<not> trivial_limit F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   891
  shows "((\<lambda>x. a) \<longlongrightarrow> b) F \<longleftrightarrow> a = b"
58729
e8ecc79aee43 add tendsto_const and tendsto_ident_at as simp and intro rules
hoelzl
parents: 57953
diff changeset
   892
  by (auto intro!: tendsto_unique [OF assms tendsto_const])
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   893
68860
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   894
lemma Lim_in_closed_set:
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   895
  assumes "closed S" "eventually (\<lambda>x. f(x) \<in> S) F" "F \<noteq> bot" "(f \<longlongrightarrow> l) F"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   896
  shows "l \<in> S"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   897
proof (rule ccontr)
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   898
  assume "l \<notin> S"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   899
  with \<open>closed S\<close> have "open (- S)" "l \<in> - S"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   900
    by (simp_all add: open_Compl)
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   901
  with assms(4) have "eventually (\<lambda>x. f x \<in> - S) F"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   902
    by (rule topological_tendstoD)
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   903
  with assms(2) have "eventually (\<lambda>x. False) F"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   904
    by (rule eventually_elim2) simp
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   905
  with assms(3) show "False"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   906
    by (simp add: eventually_False)
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   907
qed
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   908
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   909
lemma (in t3_space) nhds_closed:
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   910
  assumes "x \<in> A" and "open A"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   911
  shows   "\<exists>A'. x \<in> A' \<and> closed A' \<and> A' \<subseteq> A \<and> eventually (\<lambda>y. y \<in> A') (nhds x)"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   912
proof -
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   913
  from assms have "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> - A \<subseteq> V \<and> U \<inter> V = {}"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   914
    by (intro t3_space) auto
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   915
  then obtain U V where UV: "open U" "open V" "x \<in> U" "-A \<subseteq> V" "U \<inter> V = {}"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   916
    by auto
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   917
  have "eventually (\<lambda>y. y \<in> U) (nhds x)"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   918
    using \<open>open U\<close> and \<open>x \<in> U\<close> by (intro eventually_nhds_in_open)
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   919
  hence "eventually (\<lambda>y. y \<in> -V) (nhds x)"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   920
    by eventually_elim (use UV in auto)
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   921
  with UV show ?thesis by (intro exI[of _ "-V"]) auto
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   922
qed
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
   923
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   924
lemma (in order_topology) increasing_tendsto:
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   925
  assumes bdd: "eventually (\<lambda>n. f n \<le> l) F"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   926
    and en: "\<And>x. x < l \<Longrightarrow> eventually (\<lambda>n. x < f n) F"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   927
  shows "(f \<longlongrightarrow> l) F"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61806
diff changeset
   928
  using assms by (intro order_tendstoI) (auto elim!: eventually_mono)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   929
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   930
lemma (in order_topology) decreasing_tendsto:
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   931
  assumes bdd: "eventually (\<lambda>n. l \<le> f n) F"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   932
    and en: "\<And>x. l < x \<Longrightarrow> eventually (\<lambda>n. f n < x) F"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   933
  shows "(f \<longlongrightarrow> l) F"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61806
diff changeset
   934
  using assms by (intro order_tendstoI) (auto elim!: eventually_mono)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   935
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   936
lemma (in order_topology) tendsto_sandwich:
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   937
  assumes ev: "eventually (\<lambda>n. f n \<le> g n) net" "eventually (\<lambda>n. g n \<le> h n) net"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   938
  assumes lim: "(f \<longlongrightarrow> c) net" "(h \<longlongrightarrow> c) net"
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
   939
  shows "(g \<longlongrightarrow> c) net"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   940
proof (rule order_tendstoI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   941
  fix a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   942
  show "a < c \<Longrightarrow> eventually (\<lambda>x. a < g x) net"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   943
    using order_tendstoD[OF lim(1), of a] ev by (auto elim: eventually_elim2)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   944
next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   945
  fix a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   946
  show "c < a \<Longrightarrow> eventually (\<lambda>x. g x < a) net"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   947
    using order_tendstoD[OF lim(2), of a] ev by (auto elim: eventually_elim2)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   948
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   949
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   950
lemma (in t1_space) limit_frequently_eq:
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   951
  assumes "F \<noteq> bot"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   952
    and "frequently (\<lambda>x. f x = c) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   953
    and "(f \<longlongrightarrow> d) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   954
  shows "d = c"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   955
proof (rule ccontr)
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   956
  assume "d \<noteq> c"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   957
  from t1_space[OF this] obtain U where "open U" "d \<in> U" "c \<notin> U"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   958
    by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   959
  with assms have "eventually (\<lambda>x. f x \<in> U) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   960
    unfolding tendsto_def by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   961
  then have "eventually (\<lambda>x. f x \<noteq> c) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   962
    by eventually_elim (insert \<open>c \<notin> U\<close>, blast)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   963
  with assms(2) show False
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   964
    unfolding frequently_def by contradiction
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   965
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   966
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   967
lemma (in t1_space) tendsto_imp_eventually_ne:
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   968
  assumes  "(f \<longlongrightarrow> c) F" "c \<noteq> c'"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   969
  shows "eventually (\<lambda>z. f z \<noteq> c') F"
64394
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   970
proof (cases "F=bot")
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   971
  case True
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   972
  thus ?thesis by auto
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   973
next
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   974
  case False
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   975
  show ?thesis
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   976
  proof (rule ccontr)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   977
    assume "\<not> eventually (\<lambda>z. f z \<noteq> c') F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   978
    then have "frequently (\<lambda>z. f z = c') F"
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   979
      by (simp add: frequently_def)
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   980
    from limit_frequently_eq[OF False this \<open>(f \<longlongrightarrow> c) F\<close>] and \<open>c \<noteq> c'\<close> show False
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   981
      by contradiction
141e1ed8d5a0 more new material
paulson <lp15@cam.ac.uk>
parents: 64284
diff changeset
   982
  qed
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   983
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
   984
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
   985
lemma (in linorder_topology) tendsto_le:
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   986
  assumes F: "\<not> trivial_limit F"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   987
    and x: "(f \<longlongrightarrow> x) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   988
    and y: "(g \<longlongrightarrow> y) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
   989
    and ev: "eventually (\<lambda>x. g x \<le> f x) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   990
  shows "y \<le> x"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   991
proof (rule ccontr)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   992
  assume "\<not> y \<le> x"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   993
  with less_separate[of x y] obtain a b where xy: "x < a" "b < y" "{..<a} \<inter> {b<..} = {}"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   994
    by (auto simp: not_le)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   995
  then have "eventually (\<lambda>x. f x < a) F" "eventually (\<lambda>x. b < g x) F"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   996
    using x y by (auto intro: order_tendstoD)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   997
  with ev have "eventually (\<lambda>x. False) F"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   998
    by eventually_elim (insert xy, fastforce)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
   999
  with F show False
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1000
    by (simp add: eventually_False)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1001
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1002
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  1003
lemma (in linorder_topology) tendsto_lowerbound:
63952
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63713
diff changeset
  1004
  assumes x: "(f \<longlongrightarrow> x) F"
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63713
diff changeset
  1005
      and ev: "eventually (\<lambda>i. a \<le> f i) F"
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63713
diff changeset
  1006
      and F: "\<not> trivial_limit F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1007
  shows "a \<le> x"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1008
  using F x tendsto_const ev by (rule tendsto_le)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1009
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  1010
lemma (in linorder_topology) tendsto_upperbound:
63952
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63713
diff changeset
  1011
  assumes x: "(f \<longlongrightarrow> x) F"
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63713
diff changeset
  1012
      and ev: "eventually (\<lambda>i. a \<ge> f i) F"
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63713
diff changeset
  1013
      and F: "\<not> trivial_limit F"
56289
d8d2a2b97168 Some useful lemmas
paulson <lp15@cam.ac.uk>
parents: 56231
diff changeset
  1014
  shows "a \<ge> x"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1015
  by (rule tendsto_le [OF F tendsto_const x ev])
56289
d8d2a2b97168 Some useful lemmas
paulson <lp15@cam.ac.uk>
parents: 56231
diff changeset
  1016
67706
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1017
lemma filterlim_at_within_not_equal:
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1018
  fixes f::"'a \<Rightarrow> 'b::t2_space"
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1019
  assumes "filterlim f (at a within s) F"
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1020
  shows "eventually (\<lambda>w. f w\<in>s \<and> f w \<noteq>b) F"
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1021
proof (cases "a=b")
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1022
  case True
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1023
  then show ?thesis using assms by (simp add: filterlim_at)
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1024
next
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1025
  case False
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1026
  from hausdorff[OF this] obtain U V where UV:"open U" "open V" "a \<in> U" "b \<in> V" "U \<inter> V = {}"
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1027
    by auto  
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1028
  have "(f \<longlongrightarrow> a) F" using assms filterlim_at by auto
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1029
  then have "\<forall>\<^sub>F x in F. f x \<in> U" using UV unfolding tendsto_def by auto
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1030
  moreover have  "\<forall>\<^sub>F x in F. f x \<in> s \<and> f x\<noteq>a" using assms filterlim_at by auto
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1031
  ultimately show ?thesis 
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1032
    apply eventually_elim
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1033
    using UV by auto
4ddc49205f5d Unified the order of zeros and poles; improved reasoning around non-essential singularites
Wenda Li <wl302@cam.ac.uk>
parents: 67577
diff changeset
  1034
qed
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
  1035
69593
3dda49e08b9d isabelle update -u control_cartouches;
wenzelm
parents: 69546
diff changeset
  1036
subsubsection \<open>Rules about \<^const>\<open>Lim\<close>\<close>
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
  1037
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1038
lemma tendsto_Lim: "\<not> trivial_limit net \<Longrightarrow> (f \<longlongrightarrow> l) net \<Longrightarrow> Lim net f = l"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1039
  unfolding Lim_def using tendsto_unique [of net f] by auto
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
  1040
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
  1041
lemma Lim_ident_at: "\<not> trivial_limit (at x within s) \<Longrightarrow> Lim (at x within s) (\<lambda>x. x) = x"
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
  1042
  by (rule tendsto_Lim[OF _ tendsto_ident_at]) 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
  1043
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  1044
lemma eventually_Lim_ident_at:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  1045
  "(\<forall>\<^sub>F y in at x within X. P (Lim (at x within X) (\<lambda>x. x)) y) \<longleftrightarrow>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  1046
    (\<forall>\<^sub>F y in at x within X. P x y)" for x::"'a::t2_space"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  1047
  by (cases "at x within X = bot") (auto simp: Lim_ident_at)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  1048
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1049
lemma filterlim_at_bot_at_right:
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57025
diff changeset
  1050
  fixes f :: "'a::linorder_topology \<Rightarrow> 'b::linorder"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1051
  assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1052
    and bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1053
    and Q: "eventually Q (at_right a)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1054
    and bound: "\<And>b. Q b \<Longrightarrow> a < b"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1055
    and P: "eventually P at_bot"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1056
  shows "filterlim f at_bot (at_right a)"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1057
proof -
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1058
  from P obtain x where x: "\<And>y. y \<le> x \<Longrightarrow> P y"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1059
    unfolding eventually_at_bot_linorder by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1060
  show ?thesis
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1061
  proof (intro filterlim_at_bot_le[THEN iffD2] allI impI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1062
    fix z
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1063
    assume "z \<le> x"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1064
    with x have "P z" by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1065
    have "eventually (\<lambda>x. x \<le> g z) (at_right a)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1066
      using bound[OF bij(2)[OF \<open>P z\<close>]]
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1067
      unfolding eventually_at_right[OF bound[OF bij(2)[OF \<open>P z\<close>]]]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1068
      by (auto intro!: exI[of _ "g z"])
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1069
    with Q show "eventually (\<lambda>x. f x \<le> z) (at_right a)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1070
      by eventually_elim (metis bij \<open>P z\<close> mono)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1071
  qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1072
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1073
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1074
lemma filterlim_at_top_at_left:
57275
0ddb5b755cdc moved lemmas from the proof of the Central Limit Theorem by Jeremy Avigad and Luke Serafin
hoelzl
parents: 57025
diff changeset
  1075
  fixes f :: "'a::linorder_topology \<Rightarrow> 'b::linorder"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1076
  assumes mono: "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1077
    and bij: "\<And>x. P x \<Longrightarrow> f (g x) = x" "\<And>x. P x \<Longrightarrow> Q (g x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1078
    and Q: "eventually Q (at_left a)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1079
    and bound: "\<And>b. Q b \<Longrightarrow> b < a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1080
    and P: "eventually P at_top"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1081
  shows "filterlim f at_top (at_left a)"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1082
proof -
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1083
  from P obtain x where x: "\<And>y. x \<le> y \<Longrightarrow> P y"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1084
    unfolding eventually_at_top_linorder by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1085
  show ?thesis
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1086
  proof (intro filterlim_at_top_ge[THEN iffD2] allI impI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1087
    fix z
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1088
    assume "x \<le> z"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1089
    with x have "P z" by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1090
    have "eventually (\<lambda>x. g z \<le> x) (at_left a)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1091
      using bound[OF bij(2)[OF \<open>P z\<close>]]
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1092
      unfolding eventually_at_left[OF bound[OF bij(2)[OF \<open>P z\<close>]]]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1093
      by (auto intro!: exI[of _ "g z"])
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1094
    with Q show "eventually (\<lambda>x. z \<le> f x) (at_left a)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1095
      by eventually_elim (metis bij \<open>P z\<close> mono)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1096
  qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1097
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1098
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1099
lemma filterlim_split_at:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1100
  "filterlim f F (at_left x) \<Longrightarrow> filterlim f F (at_right x) \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1101
    filterlim f F (at x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1102
  for x :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1103
  by (subst at_eq_sup_left_right) (rule filterlim_sup)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1104
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1105
lemma filterlim_at_split:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1106
  "filterlim f F (at x) \<longleftrightarrow> filterlim f F (at_left x) \<and> filterlim f F (at_right x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1107
  for x :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1108
  by (subst at_eq_sup_left_right) (simp add: filterlim_def filtermap_sup)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1109
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1110
lemma eventually_nhds_top:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1111
  fixes P :: "'a :: {order_top,linorder_topology} \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1112
    and b :: 'a
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1113
  assumes "b < top"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1114
  shows "eventually P (nhds top) \<longleftrightarrow> (\<exists>b<top. (\<forall>z. b < z \<longrightarrow> P z))"
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1115
  unfolding eventually_nhds
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1116
proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1117
  fix S :: "'a set"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1118
  assume "open S" "top \<in> S"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1119
  note open_left[OF this \<open>b < top\<close>]
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1120
  moreover assume "\<forall>s\<in>S. P s"
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1121
  ultimately show "\<exists>b<top. \<forall>z>b. P z"
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1122
    by (auto simp: subset_eq Ball_def)
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1123
next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1124
  fix b
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1125
  assume "b < top" "\<forall>z>b. P z"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1126
  then show "\<exists>S. open S \<and> top \<in> S \<and> (\<forall>xa\<in>S. P xa)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1127
    by (intro exI[of _ "{b <..}"]) auto
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1128
qed
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1129
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1130
lemma tendsto_at_within_iff_tendsto_nhds:
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  1131
  "(g \<longlongrightarrow> g l) (at l within S) \<longleftrightarrow> (g \<longlongrightarrow> g l) (inf (nhds l) (principal S))"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1132
  unfolding tendsto_def eventually_at_filter eventually_inf_principal
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61806
diff changeset
  1133
  by (intro ext all_cong imp_cong) (auto elim!: eventually_mono)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1134
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1135
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1136
subsection \<open>Limits on sequences\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1137
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1138
abbreviation (in topological_space)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1139
  LIMSEQ :: "[nat \<Rightarrow> 'a, 'a] \<Rightarrow> bool"  ("((_)/ \<longlonglongrightarrow> (_))" [60, 60] 60)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1140
  where "X \<longlonglongrightarrow> L \<equiv> (X \<longlongrightarrow> L) sequentially"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1141
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1142
abbreviation (in t2_space) lim :: "(nat \<Rightarrow> 'a) \<Rightarrow> 'a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1143
  where "lim X \<equiv> Lim sequentially X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1144
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1145
definition (in topological_space) convergent :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1146
  where "convergent X = (\<exists>L. X \<longlonglongrightarrow> L)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1147
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1148
lemma lim_def: "lim X = (THE L. X \<longlonglongrightarrow> L)"
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
  1149
  unfolding Lim_def ..
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
  1150
70367
81b65ddac59f fixed renaming issues
paulson <lp15@cam.ac.uk>
parents: 70365
diff changeset
  1151
lemma lim_explicit:
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  1152
  "f \<longlonglongrightarrow> f0 \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> f0 \<in> S \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. f n \<in> S))"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  1153
  unfolding tendsto_def eventually_sequentially by auto
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  1154
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1155
68532
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1156
subsection \<open>Monotone sequences and subsequences\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1157
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1158
text \<open>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1159
  Definition of monotonicity.
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1160
  The use of disjunction here complicates proofs considerably.
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1161
  One alternative is to add a Boolean argument to indicate the direction.
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1162
  Another is to develop the notions of increasing and decreasing first.
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1163
\<close>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1164
definition monoseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1165
  where "monoseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X m \<le> X n) \<or> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1166
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1167
abbreviation incseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1168
  where "incseq X \<equiv> mono X"
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 55945
diff changeset
  1169
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 55945
diff changeset
  1170
lemma incseq_def: "incseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<ge> X m)"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 55945
diff changeset
  1171
  unfolding mono_def ..
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 55945
diff changeset
  1172
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1173
abbreviation decseq :: "(nat \<Rightarrow> 'a::order) \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1174
  where "decseq X \<equiv> antimono X"
56020
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 55945
diff changeset
  1175
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 55945
diff changeset
  1176
lemma decseq_def: "decseq X \<longleftrightarrow> (\<forall>m. \<forall>n\<ge>m. X n \<le> X m)"
f92479477c52 introduced antimono; incseq, decseq are now abbreviations for mono and antimono; renamed Library/Continuity to Library/Order_Continuity; removed up_cont; renamed down_cont to down_continuity and generalized to complete_lattices
hoelzl
parents: 55945
diff changeset
  1177
  unfolding antimono_def ..
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1178
68532
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1179
subsubsection \<open>Definition of subsequence.\<close>
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1180
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1181
(* For compatibility with the old "subseq" *)
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1182
lemma strict_mono_leD: "strict_mono r \<Longrightarrow> m \<le> n \<Longrightarrow> r m \<le> r n"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1183
  by (erule (1) monoD [OF strict_mono_mono])
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1184
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1185
lemma strict_mono_id: "strict_mono id"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1186
  by (simp add: strict_mono_def)
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
  1187
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1188
lemma incseq_SucI: "(\<And>n. X n \<le> X (Suc n)) \<Longrightarrow> incseq X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1189
  using lift_Suc_mono_le[of X] by (auto simp: incseq_def)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1190
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1191
lemma incseqD: "incseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f i \<le> f j"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1192
  by (auto simp: incseq_def)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1193
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1194
lemma incseq_SucD: "incseq A \<Longrightarrow> A i \<le> A (Suc i)"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1195
  using incseqD[of A i "Suc i"] by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1196
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1197
lemma incseq_Suc_iff: "incseq f \<longleftrightarrow> (\<forall>n. f n \<le> f (Suc n))"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1198
  by (auto intro: incseq_SucI dest: incseq_SucD)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1199
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1200
lemma incseq_const[simp, intro]: "incseq (\<lambda>x. k)"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1201
  unfolding incseq_def by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1202
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1203
lemma decseq_SucI: "(\<And>n. X (Suc n) \<le> X n) \<Longrightarrow> decseq X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1204
  using order.lift_Suc_mono_le[OF dual_order, of X] by (auto simp: decseq_def)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1205
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1206
lemma decseqD: "decseq f \<Longrightarrow> i \<le> j \<Longrightarrow> f j \<le> f i"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1207
  by (auto simp: decseq_def)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1208
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1209
lemma decseq_SucD: "decseq A \<Longrightarrow> A (Suc i) \<le> A i"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1210
  using decseqD[of A i "Suc i"] by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1211
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1212
lemma decseq_Suc_iff: "decseq f \<longleftrightarrow> (\<forall>n. f (Suc n) \<le> f n)"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1213
  by (auto intro: decseq_SucI dest: decseq_SucD)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1214
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1215
lemma decseq_const[simp, intro]: "decseq (\<lambda>x. k)"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1216
  unfolding decseq_def by auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1217
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1218
lemma monoseq_iff: "monoseq X \<longleftrightarrow> incseq X \<or> decseq X"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1219
  unfolding monoseq_def incseq_def decseq_def ..
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1220
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1221
lemma monoseq_Suc: "monoseq X \<longleftrightarrow> (\<forall>n. X n \<le> X (Suc n)) \<or> (\<forall>n. X (Suc n) \<le> X n)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1222
  unfolding monoseq_iff incseq_Suc_iff decseq_Suc_iff ..
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1223
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1224
lemma monoI1: "\<forall>m. \<forall>n \<ge> m. X m \<le> X n \<Longrightarrow> monoseq X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1225
  by (simp add: monoseq_def)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1226
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1227
lemma monoI2: "\<forall>m. \<forall>n \<ge> m. X n \<le> X m \<Longrightarrow> monoseq X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1228
  by (simp add: monoseq_def)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1229
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1230
lemma mono_SucI1: "\<forall>n. X n \<le> X (Suc n) \<Longrightarrow> monoseq X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1231
  by (simp add: monoseq_Suc)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1232
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1233
lemma mono_SucI2: "\<forall>n. X (Suc n) \<le> X n \<Longrightarrow> monoseq X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1234
  by (simp add: monoseq_Suc)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1235
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1236
lemma monoseq_minus:
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1237
  fixes a :: "nat \<Rightarrow> 'a::ordered_ab_group_add"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1238
  assumes "monoseq a"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1239
  shows "monoseq (\<lambda> n. - a n)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1240
proof (cases "\<forall>m. \<forall>n \<ge> m. a m \<le> a n")
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1241
  case True
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1242
  then have "\<forall>m. \<forall>n \<ge> m. - a n \<le> - a m" by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1243
  then show ?thesis by (rule monoI2)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1244
next
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1245
  case False
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1246
  then have "\<forall>m. \<forall>n \<ge> m. - a m \<le> - a n"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1247
    using \<open>monoseq a\<close>[unfolded monoseq_def] by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1248
  then show ?thesis by (rule monoI1)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1249
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1250
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1251
68532
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1252
subsubsection \<open>Subsequence (alternative definition, (e.g. Hoskins)\<close>
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1253
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1254
lemma strict_mono_Suc_iff: "strict_mono f \<longleftrightarrow> (\<forall>n. f n < f (Suc n))"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1255
proof (intro iffI strict_monoI)
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1256
  assume *: "\<forall>n. f n < f (Suc n)"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1257
  fix m n :: nat assume "m < n"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1258
  thus "f m < f n"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1259
    by (induction rule: less_Suc_induct) (use * in auto)
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1260
qed (auto simp: strict_mono_def)
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1261
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1262
lemma strict_mono_add: "strict_mono (\<lambda>n::'a::linordered_semidom. n + k)"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1263
  by (auto simp: strict_mono_def)
63317
ca187a9f66da Various additions to polynomials, FPSs, Gamma function
eberlm
parents: 63301
diff changeset
  1264
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1265
text \<open>For any sequence, there is a monotonic subsequence.\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1266
lemma seq_monosub:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1267
  fixes s :: "nat \<Rightarrow> 'a::linorder"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1268
  shows "\<exists>f. strict_mono f \<and> monoseq (\<lambda>n. (s (f n)))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1269
proof (cases "\<forall>n. \<exists>p>n. \<forall>m\<ge>p. s m \<le> s p")
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1270
  case True
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1271
  then have "\<exists>f. \<forall>n. (\<forall>m\<ge>f n. s m \<le> s (f n)) \<and> f n < f (Suc n)"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1272
    by (intro dependent_nat_choice) (auto simp: conj_commute)
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1273
  then obtain f :: "nat \<Rightarrow> nat" 
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1274
    where f: "strict_mono f" and mono: "\<And>n m. f n \<le> m \<Longrightarrow> s m \<le> s (f n)"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1275
    by (auto simp: strict_mono_Suc_iff)
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1276
  then have "incseq f"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1277
    unfolding strict_mono_Suc_iff incseq_Suc_iff by (auto intro: less_imp_le)
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1278
  then have "monoseq (\<lambda>n. s (f n))"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1279
    by (auto simp add: incseq_def intro!: mono monoI2)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1280
  with f show ?thesis
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1281
    by auto
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1282
next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1283
  case False
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1284
  then obtain N where N: "p > N \<Longrightarrow> \<exists>m>p. s p < s m" for p
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1285
    by (force simp: not_le le_less)
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1286
  have "\<exists>f. \<forall>n. N < f n \<and> f n < f (Suc n) \<and> s (f n) \<le> s (f (Suc n))"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1287
  proof (intro dependent_nat_choice)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1288
    fix x
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1289
    assume "N < x" with N[of x]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1290
    show "\<exists>y>N. x < y \<and> s x \<le> s y"
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1291
      by (auto intro: less_trans)
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1292
  qed auto
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1293
  then show ?thesis
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1294
    by (auto simp: monoseq_iff incseq_Suc_iff strict_mono_Suc_iff)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1295
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1296
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1297
lemma seq_suble:
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1298
  assumes sf: "strict_mono (f :: nat \<Rightarrow> nat)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1299
  shows "n \<le> f n"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1300
proof (induct n)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1301
  case 0
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1302
  show ?case by simp
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1303
next
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1304
  case (Suc n)
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1305
  with sf [unfolded strict_mono_Suc_iff, rule_format, of n] have "n < f (Suc n)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1306
     by arith
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1307
  then show ?case by arith
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1308
qed
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1309
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1310
lemma eventually_subseq:
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1311
  "strict_mono r \<Longrightarrow> eventually P sequentially \<Longrightarrow> eventually (\<lambda>n. P (r n)) sequentially"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1312
  unfolding eventually_sequentially by (metis seq_suble le_trans)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1313
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1314
lemma not_eventually_sequentiallyD:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1315
  assumes "\<not> eventually P sequentially"
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1316
  shows "\<exists>r::nat\<Rightarrow>nat. strict_mono r \<and> (\<forall>n. \<not> P (r n))"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1317
proof -
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1318
  from assms have "\<forall>n. \<exists>m\<ge>n. \<not> P m"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1319
    unfolding eventually_sequentially by (simp add: not_less)
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1320
  then obtain r where "\<And>n. r n \<ge> n" "\<And>n. \<not> P (r n)"
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1321
    by (auto simp: choice_iff)
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1322
  then show ?thesis
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1323
    by (auto intro!: exI[of _ "\<lambda>n. r (((Suc \<circ> r) ^^ Suc n) 0)"]
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1324
             simp: less_eq_Suc_le strict_mono_Suc_iff)
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1325
qed
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1326
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1327
lemma sequentially_offset: 
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1328
  assumes "eventually (\<lambda>i. P i) sequentially"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1329
  shows "eventually (\<lambda>i. P (i + k)) sequentially"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1330
  using assms by (rule eventually_sequentially_seg [THEN iffD2])
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1331
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1332
lemma seq_offset_neg: 
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1333
  "(f \<longlongrightarrow> l) sequentially \<Longrightarrow> ((\<lambda>i. f(i - k)) \<longlongrightarrow> l) sequentially"
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1334
  apply (erule filterlim_compose)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1335
  apply (simp add: filterlim_def le_sequentially eventually_filtermap eventually_sequentially, arith)
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1336
  done
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  1337
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1338
lemma filterlim_subseq: "strict_mono f \<Longrightarrow> filterlim f sequentially sequentially"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1339
  unfolding filterlim_iff by (metis eventually_subseq)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1340
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1341
lemma strict_mono_o: "strict_mono r \<Longrightarrow> strict_mono s \<Longrightarrow> strict_mono (r \<circ> s)"
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1342
  unfolding strict_mono_def by simp
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
  1343
67727
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  1344
lemma strict_mono_compose: "strict_mono r \<Longrightarrow> strict_mono s \<Longrightarrow> strict_mono (\<lambda>x. r (s x))"
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  1345
  using strict_mono_o[of r s] by (simp add: o_def)
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  1346
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1347
lemma incseq_imp_monoseq:  "incseq X \<Longrightarrow> monoseq X"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1348
  by (simp add: incseq_def monoseq_def)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1349
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1350
lemma decseq_imp_monoseq:  "decseq X \<Longrightarrow> monoseq X"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1351
  by (simp add: decseq_def monoseq_def)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1352
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1353
lemma decseq_eq_incseq: "decseq X = incseq (\<lambda>n. - X n)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1354
  for X :: "nat \<Rightarrow> 'a::ordered_ab_group_add"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1355
  by (simp add: decseq_def incseq_def)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1356
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1357
lemma INT_decseq_offset:
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1358
  assumes "decseq F"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1359
  shows "(\<Inter>i. F i) = (\<Inter>i\<in>{n..}. F i)"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1360
proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1361
  fix x i
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1362
  assume x: "x \<in> (\<Inter>i\<in>{n..}. F i)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1363
  show "x \<in> F i"
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1364
  proof cases
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1365
    from x have "x \<in> F n" by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1366
    also assume "i \<le> n" with \<open>decseq F\<close> have "F n \<subseteq> F i"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1367
      unfolding decseq_def by simp
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1368
    finally show ?thesis .
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1369
  qed (insert x, simp)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1370
qed auto
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1371
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1372
lemma LIMSEQ_const_iff: "(\<lambda>n. k) \<longlonglongrightarrow> l \<longleftrightarrow> k = l"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1373
  for k l :: "'a::t2_space"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1374
  using trivial_limit_sequentially by (rule tendsto_const_iff)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1375
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1376
lemma LIMSEQ_SUP: "incseq X \<Longrightarrow> X \<longlonglongrightarrow> (SUP i. X i :: 'a::{complete_linorder,linorder_topology})"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1377
  by (intro increasing_tendsto)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1378
    (auto simp: SUP_upper less_SUP_iff incseq_def eventually_sequentially intro: less_le_trans)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1379
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1380
lemma LIMSEQ_INF: "decseq X \<Longrightarrow> X \<longlonglongrightarrow> (INF i. X i :: 'a::{complete_linorder,linorder_topology})"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1381
  by (intro decreasing_tendsto)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1382
    (auto simp: INF_lower INF_less_iff decseq_def eventually_sequentially intro: le_less_trans)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1383
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1384
lemma LIMSEQ_ignore_initial_segment: "f \<longlonglongrightarrow> a \<Longrightarrow> (\<lambda>n. f (n + k)) \<longlonglongrightarrow> a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1385
  unfolding tendsto_def by (subst eventually_sequentially_seg[where k=k])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1386
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1387
lemma LIMSEQ_offset: "(\<lambda>n. f (n + k)) \<longlonglongrightarrow> a \<Longrightarrow> f \<longlonglongrightarrow> a"
51474
1e9e68247ad1 generalize Bfun and Bseq to metric spaces; Bseq is an abbreviation for Bfun
hoelzl
parents: 51473
diff changeset
  1388
  unfolding tendsto_def
1e9e68247ad1 generalize Bfun and Bseq to metric spaces; Bseq is an abbreviation for Bfun
hoelzl
parents: 51473
diff changeset
  1389
  by (subst (asm) eventually_sequentially_seg[where k=k])
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1390
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1391
lemma LIMSEQ_Suc: "f \<longlonglongrightarrow> l \<Longrightarrow> (\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1392
  by (drule LIMSEQ_ignore_initial_segment [where k="Suc 0"]) simp
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1393
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1394
lemma LIMSEQ_imp_Suc: "(\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l \<Longrightarrow> f \<longlonglongrightarrow> l"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1395
  by (rule LIMSEQ_offset [where k="Suc 0"]) simp
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1396
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1397
lemma LIMSEQ_Suc_iff: "(\<lambda>n. f (Suc n)) \<longlonglongrightarrow> l = f \<longlonglongrightarrow> l"
68532
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1398
  by (rule filterlim_sequentially_Suc)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1399
68361
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68296
diff changeset
  1400
lemma LIMSEQ_lessThan_iff_atMost:
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68296
diff changeset
  1401
  shows "(\<lambda>n. f {..<n}) \<longlonglongrightarrow> x \<longleftrightarrow> (\<lambda>n. f {..n}) \<longlonglongrightarrow> x"
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68296
diff changeset
  1402
  apply (subst LIMSEQ_Suc_iff [symmetric])
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68296
diff changeset
  1403
  apply (simp only: lessThan_Suc_atMost)
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68296
diff changeset
  1404
  done
20375f232f3b infinite product material
paulson <lp15@cam.ac.uk>
parents: 68296
diff changeset
  1405
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1406
lemma LIMSEQ_unique: "X \<longlonglongrightarrow> a \<Longrightarrow> X \<longlonglongrightarrow> b \<Longrightarrow> a = b"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1407
  for a b :: "'a::t2_space"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1408
  using trivial_limit_sequentially by (rule tendsto_unique)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1409
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1410
lemma LIMSEQ_le_const: "X \<longlonglongrightarrow> x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. a \<le> X n \<Longrightarrow> a \<le> x"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1411
  for a x :: "'a::linorder_topology"
63952
354808e9f44b new material connected with HOL Light measure theory, plus more rationalisation
paulson <lp15@cam.ac.uk>
parents: 63713
diff changeset
  1412
  by (simp add: eventually_at_top_linorder tendsto_lowerbound)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1413
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1414
lemma LIMSEQ_le: "X \<longlonglongrightarrow> x \<Longrightarrow> Y \<longlonglongrightarrow> y \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. X n \<le> Y n \<Longrightarrow> x \<le> y"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1415
  for x y :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1416
  using tendsto_le[of sequentially Y y X x] by (simp add: eventually_sequentially)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1417
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1418
lemma LIMSEQ_le_const2: "X \<longlonglongrightarrow> x \<Longrightarrow> \<exists>N. \<forall>n\<ge>N. X n \<le> a \<Longrightarrow> x \<le> a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1419
  for a x :: "'a::linorder_topology"
58729
e8ecc79aee43 add tendsto_const and tendsto_ident_at as simp and intro rules
hoelzl
parents: 57953
diff changeset
  1420
  by (rule LIMSEQ_le[of X x "\<lambda>n. a"]) auto
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1421
68532
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1422
lemma Lim_bounded: "f \<longlonglongrightarrow> l \<Longrightarrow> \<forall>n\<ge>M. f n \<le> C \<Longrightarrow> l \<le> C"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1423
  for l :: "'a::linorder_topology"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1424
  by (intro LIMSEQ_le_const2) auto
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1425
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1426
lemma Lim_bounded2:
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1427
  fixes f :: "nat \<Rightarrow> 'a::linorder_topology"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1428
  assumes lim:"f \<longlonglongrightarrow> l" and ge: "\<forall>n\<ge>N. f n \<ge> C"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1429
  shows "l \<ge> C"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1430
  using ge
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1431
  by (intro tendsto_le[OF trivial_limit_sequentially lim tendsto_const])
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1432
     (auto simp: eventually_sequentially)
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1433
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1434
lemma lim_mono:
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1435
  fixes X Y :: "nat \<Rightarrow> 'a::linorder_topology"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1436
  assumes "\<And>n. N \<le> n \<Longrightarrow> X n \<le> Y n"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1437
    and "X \<longlonglongrightarrow> x"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1438
    and "Y \<longlonglongrightarrow> y"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1439
  shows "x \<le> y"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1440
  using assms(1) by (intro LIMSEQ_le[OF assms(2,3)]) auto
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1441
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1442
lemma Sup_lim:
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1443
  fixes a :: "'a::{complete_linorder,linorder_topology}"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1444
  assumes "\<And>n. b n \<in> s"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1445
    and "b \<longlonglongrightarrow> a"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1446
  shows "a \<le> Sup s"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1447
  by (metis Lim_bounded assms complete_lattice_class.Sup_upper)
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1448
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1449
lemma Inf_lim:
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1450
  fixes a :: "'a::{complete_linorder,linorder_topology}"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1451
  assumes "\<And>n. b n \<in> s"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1452
    and "b \<longlonglongrightarrow> a"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1453
  shows "Inf s \<le> a"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1454
  by (metis Lim_bounded2 assms complete_lattice_class.Inf_lower)
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1455
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1456
lemma SUP_Lim:
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1457
  fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1458
  assumes inc: "incseq X"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1459
    and l: "X \<longlonglongrightarrow> l"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1460
  shows "(SUP n. X n) = l"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1461
  using LIMSEQ_SUP[OF inc] tendsto_unique[OF trivial_limit_sequentially l]
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1462
  by simp
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1463
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1464
lemma INF_Lim:
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1465
  fixes X :: "nat \<Rightarrow> 'a::{complete_linorder,linorder_topology}"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1466
  assumes dec: "decseq X"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1467
    and l: "X \<longlonglongrightarrow> l"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1468
  shows "(INF n. X n) = l"
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1469
  using LIMSEQ_INF[OF dec] tendsto_unique[OF trivial_limit_sequentially l]
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1470
  by simp
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1471
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1472
lemma convergentD: "convergent X \<Longrightarrow> \<exists>L. X \<longlonglongrightarrow> L"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1473
  by (simp add: convergent_def)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1474
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1475
lemma convergentI: "X \<longlonglongrightarrow> L \<Longrightarrow> convergent X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1476
  by (auto simp add: convergent_def)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1477
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1478
lemma convergent_LIMSEQ_iff: "convergent X \<longleftrightarrow> X \<longlonglongrightarrow> lim X"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1479
  by (auto intro: theI LIMSEQ_unique simp add: convergent_def lim_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1480
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1481
lemma convergent_const: "convergent (\<lambda>n. c)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1482
  by (rule convergentI) (rule tendsto_const)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1483
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1484
lemma monoseq_le:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1485
  "monoseq a \<Longrightarrow> a \<longlonglongrightarrow> x \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1486
    (\<forall>n. a n \<le> x) \<and> (\<forall>m. \<forall>n\<ge>m. a m \<le> a n) \<or>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1487
    (\<forall>n. x \<le> a n) \<and> (\<forall>m. \<forall>n\<ge>m. a n \<le> a m)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1488
  for x :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1489
  by (metis LIMSEQ_le_const LIMSEQ_le_const2 decseq_def incseq_def monoseq_iff)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1490
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1491
lemma LIMSEQ_subseq_LIMSEQ: "X \<longlonglongrightarrow> L \<Longrightarrow> strict_mono f \<Longrightarrow> (X \<circ> f) \<longlonglongrightarrow> L"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1492
  unfolding comp_def by (rule filterlim_compose [of X, OF _ filterlim_subseq])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1493
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1494
lemma convergent_subseq_convergent: "convergent X \<Longrightarrow> strict_mono f \<Longrightarrow> convergent (X \<circ> f)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1495
  by (auto simp: convergent_def intro: LIMSEQ_subseq_LIMSEQ)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1496
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1497
lemma limI: "X \<longlonglongrightarrow> L \<Longrightarrow> lim X = L"
57276
49c51eeaa623 filters are easier to define with INF on filters.
hoelzl
parents: 57275
diff changeset
  1498
  by (rule tendsto_Lim) (rule trivial_limit_sequentially)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1499
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1500
lemma lim_le: "convergent f \<Longrightarrow> (\<And>n. f n \<le> x) \<Longrightarrow> lim f \<le> x"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1501
  for x :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1502
  using LIMSEQ_le_const2[of f "lim f" x] by (simp add: convergent_LIMSEQ_iff)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1503
62217
527488dc8b90 Reorganised a huge proof
paulson <lp15@cam.ac.uk>
parents: 62175
diff changeset
  1504
lemma lim_const [simp]: "lim (\<lambda>m. a) = a"
527488dc8b90 Reorganised a huge proof
paulson <lp15@cam.ac.uk>
parents: 62175
diff changeset
  1505
  by (simp add: limI)
527488dc8b90 Reorganised a huge proof
paulson <lp15@cam.ac.uk>
parents: 62175
diff changeset
  1506
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1507
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1508
subsubsection \<open>Increasing and Decreasing Series\<close>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1509
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1510
lemma incseq_le: "incseq X \<Longrightarrow> X \<longlonglongrightarrow> L \<Longrightarrow> X n \<le> L"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1511
  for L :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1512
  by (metis incseq_def LIMSEQ_le_const)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1513
68532
f8b98d31ad45 Incorporating new/strengthened proofs from Library and AFP entries
paulson <lp15@cam.ac.uk>
parents: 68361
diff changeset
  1514
lemma decseq_ge: "decseq X \<Longrightarrow> X \<longlonglongrightarrow> L \<Longrightarrow> L \<le> X n"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1515
  for L :: "'a::linorder_topology"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1516
  by (metis decseq_def LIMSEQ_le_const2)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1517
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1518
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1519
subsection \<open>First countable topologies\<close>
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1520
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1521
class first_countable_topology = topological_space +
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1522
  assumes first_countable_basis:
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1523
    "\<exists>A::nat \<Rightarrow> 'a set. (\<forall>i. x \<in> A i \<and> open (A i)) \<and> (\<forall>S. open S \<and> x \<in> S \<longrightarrow> (\<exists>i. A i \<subseteq> S))"
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1524
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1525
lemma (in first_countable_topology) countable_basis_at_decseq:
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1526
  obtains A :: "nat \<Rightarrow> 'a set" where
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1527
    "\<And>i. open (A i)" "\<And>i. x \<in> (A i)"
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1528
    "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1529
proof atomize_elim
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1530
  from first_countable_basis[of x] obtain A :: "nat \<Rightarrow> 'a set"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1531
    where nhds: "\<And>i. open (A i)" "\<And>i. x \<in> A i"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1532
      and incl: "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>i. A i \<subseteq> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1533
    by auto
63040
eb4ddd18d635 eliminated old 'def';
wenzelm
parents: 63007
diff changeset
  1534
  define F where "F n = (\<Inter>i\<le>n. A i)" for n
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1535
  show "\<exists>A. (\<forall>i. open (A i)) \<and> (\<forall>i. x \<in> A i) \<and>
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1536
    (\<forall>S. open S \<longrightarrow> x \<in> S \<longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially)"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1537
  proof (safe intro!: exI[of _ F])
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1538
    fix i
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1539
    show "open (F i)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1540
      using nhds(1) by (auto simp: F_def)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1541
    show "x \<in> F i"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1542
      using nhds(2) by (auto simp: F_def)
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1543
  next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1544
    fix S
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1545
    assume "open S" "x \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1546
    from incl[OF this] obtain i where "F i \<subseteq> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1547
      unfolding F_def by auto
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1548
    moreover have "\<And>j. i \<le> j \<Longrightarrow> F j \<subseteq> F i"
63171
a0088f1c049d tuned proofs;
wenzelm
parents: 63170
diff changeset
  1549
      by (simp add: Inf_superset_mono F_def image_mono)
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1550
    ultimately show "eventually (\<lambda>i. F i \<subseteq> S) sequentially"
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1551
      by (auto simp: eventually_sequentially)
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1552
  qed
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1553
qed
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1554
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1555
lemma (in first_countable_topology) nhds_countable:
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1556
  obtains X :: "nat \<Rightarrow> 'a set"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1557
  where "decseq X" "\<And>n. open (X n)" "\<And>n. x \<in> X n" "nhds x = (INF n. principal (X n))"
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1558
proof -
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1559
  from first_countable_basis obtain A :: "nat \<Rightarrow> 'a set"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1560
    where *: "\<And>n. x \<in> A n" "\<And>n. open (A n)" "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> \<exists>i. A i \<subseteq> S"
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1561
    by metis
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1562
  show thesis
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1563
  proof
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1564
    show "decseq (\<lambda>n. \<Inter>i\<le>n. A i)"
63171
a0088f1c049d tuned proofs;
wenzelm
parents: 63170
diff changeset
  1565
      by (simp add: antimono_iff_le_Suc atMost_Suc)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1566
    show "x \<in> (\<Inter>i\<le>n. A i)" "\<And>n. open (\<Inter>i\<le>n. A i)" for n
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1567
      using * by auto
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60182
diff changeset
  1568
    show "nhds x = (INF n. principal (\<Inter>i\<le>n. A i))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1569
      using *
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1570
      unfolding nhds_def
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 62217
diff changeset
  1571
      apply -
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 62217
diff changeset
  1572
      apply (rule INF_eq)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1573
       apply simp_all
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1574
       apply fastforce
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 62217
diff changeset
  1575
      apply (intro exI [of _ "\<Inter>i\<le>n. A i" for n] conjI open_INT)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1576
         apply auto
57448
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1577
      done
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1578
  qed
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1579
qed
159e45728ceb more equalities of topological filters; strengthen dependent_nat_choice; tuned a couple of proofs
hoelzl
parents: 57447
diff changeset
  1580
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1581
lemma (in first_countable_topology) countable_basis:
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1582
  obtains A :: "nat \<Rightarrow> 'a set" where
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1583
    "\<And>i. open (A i)" "\<And>i. x \<in> A i"
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1584
    "\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F \<longlonglongrightarrow> x"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1585
proof atomize_elim
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1586
  obtain A :: "nat \<Rightarrow> 'a set" where *:
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1587
    "\<And>i. open (A i)"
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1588
    "\<And>i. x \<in> A i"
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1589
    "\<And>S. open S \<Longrightarrow> x \<in> S \<Longrightarrow> eventually (\<lambda>i. A i \<subseteq> S) sequentially"
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1590
    by (rule countable_basis_at_decseq) blast
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1591
  have "eventually (\<lambda>n. F n \<in> S) sequentially"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1592
    if "\<forall>n. F n \<in> A n" "open S" "x \<in> S" for F S
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1593
    using *(3)[of S] that by (auto elim: eventually_mono simp: subset_eq)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1594
  with * show "\<exists>A. (\<forall>i. open (A i)) \<and> (\<forall>i. x \<in> A i) \<and> (\<forall>F. (\<forall>n. F n \<in> A n) \<longrightarrow> F \<longlonglongrightarrow> x)"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1595
    by (intro exI[of _ A]) (auto simp: tendsto_def)
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1596
qed
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1597
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1598
lemma (in first_countable_topology) sequentially_imp_eventually_nhds_within:
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1599
  assumes "\<forall>f. (\<forall>n. f n \<in> s) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially"
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
  1600
  shows "eventually P (inf (nhds a) (principal s))"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1601
proof (rule ccontr)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1602
  obtain A :: "nat \<Rightarrow> 'a set" where *:
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1603
    "\<And>i. open (A i)"
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1604
    "\<And>i. a \<in> A i"
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1605
    "\<And>F. \<forall>n. F n \<in> A n \<Longrightarrow> F \<longlonglongrightarrow> a"
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1606
    by (rule countable_basis) blast
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1607
  assume "\<not> ?thesis"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1608
  with * have "\<exists>F. \<forall>n. F n \<in> s \<and> F n \<in> A n \<and> \<not> P (F n)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1609
    unfolding eventually_inf_principal eventually_nhds
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1610
    by (intro choice) fastforce
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1611
  then obtain F where F: "\<forall>n. F n \<in> s" and "\<forall>n. F n \<in> A n" and F': "\<forall>n. \<not> P (F n)"
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1612
    by blast
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1613
  with * have "F \<longlonglongrightarrow> a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1614
    by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1615
  then have "eventually (\<lambda>n. P (F n)) sequentially"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1616
    using assms F by simp
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1617
  then show False
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1618
    by (simp add: F')
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1619
qed
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1620
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1621
lemma (in first_countable_topology) eventually_nhds_within_iff_sequentially:
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  1622
  "eventually P (inf (nhds a) (principal s)) \<longleftrightarrow>
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1623
    (\<forall>f. (\<forall>n. f n \<in> s) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1624
proof (safe intro!: sequentially_imp_eventually_nhds_within)
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  1625
  assume "eventually P (inf (nhds a) (principal s))"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1626
  then obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. x \<in> s \<longrightarrow> P x"
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
  1627
    by (auto simp: eventually_inf_principal eventually_nhds)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1628
  moreover
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1629
  fix f
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1630
  assume "\<forall>n. f n \<in> s" "f \<longlonglongrightarrow> a"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1631
  ultimately show "eventually (\<lambda>n. P (f n)) sequentially"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61806
diff changeset
  1632
    by (auto dest!: topological_tendstoD elim: eventually_mono)
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1633
qed
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1634
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1635
lemma (in first_countable_topology) eventually_nhds_iff_sequentially:
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1636
  "eventually P (nhds a) \<longleftrightarrow> (\<forall>f. f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially)"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1637
  using eventually_nhds_within_iff_sequentially[of P a UNIV] by simp
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1638
70723
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1639
(*Thanks to Sébastien Gouëzel*)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1640
lemma Inf_as_limit:
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1641
  fixes A::"'a::{linorder_topology, first_countable_topology, complete_linorder} set"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1642
  assumes "A \<noteq> {}"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1643
  shows "\<exists>u. (\<forall>n. u n \<in> A) \<and> u \<longlonglongrightarrow> Inf A"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1644
proof (cases "Inf A \<in> A")
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1645
  case True
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1646
  show ?thesis
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1647
    by (rule exI[of _ "\<lambda>n. Inf A"], auto simp add: True)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1648
next
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1649
  case False
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1650
  obtain y where "y \<in> A" using assms by auto
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1651
  then have "Inf A < y" using False Inf_lower less_le by auto
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1652
  obtain F :: "nat \<Rightarrow> 'a set" where F: "\<And>i. open (F i)" "\<And>i. Inf A \<in> F i"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1653
                                       "\<And>u. (\<forall>n. u n \<in> F n) \<Longrightarrow> u \<longlonglongrightarrow> Inf A"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1654
    by (metis first_countable_topology_class.countable_basis)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1655
  define u where "u = (\<lambda>n. SOME z. z \<in> F n \<and> z \<in> A)"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1656
  have "\<exists>z. z \<in> U \<and> z \<in> A" if "Inf A \<in> U" "open U" for U
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1657
  proof -
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1658
    obtain b where "b > Inf A" "{Inf A ..<b} \<subseteq> U"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1659
      using open_right[OF \<open>open U\<close> \<open>Inf A \<in> U\<close> \<open>Inf A < y\<close>] by auto
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1660
    obtain z where "z < b" "z \<in> A"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1661
      using \<open>Inf A < b\<close> Inf_less_iff by auto
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1662
    then have "z \<in> {Inf A ..<b}"
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1663
      by (simp add: Inf_lower)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1664
    then show ?thesis using \<open>z \<in> A\<close> \<open>{Inf A ..<b} \<subseteq> U\<close> by auto
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1665
  qed
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1666
  then have *: "u n \<in> F n \<and> u n \<in> A" for n
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1667
    using \<open>Inf A \<in> F n\<close> \<open>open (F n)\<close> unfolding u_def by (metis (no_types, lifting) someI_ex)
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1668
  then have "u \<longlonglongrightarrow> Inf A" using F(3) by simp
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1669
  then show ?thesis using * by auto
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1670
qed
4e39d87c9737 imported new material mostly due to Sébastien Gouëzel
paulson <lp15@cam.ac.uk>
parents: 70707
diff changeset
  1671
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1672
lemma tendsto_at_iff_sequentially:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1673
  "(f \<longlongrightarrow> a) (at x within s) \<longleftrightarrow> (\<forall>X. (\<forall>i. X i \<in> s - {x}) \<longrightarrow> X \<longlonglongrightarrow> x \<longrightarrow> ((f \<circ> X) \<longlonglongrightarrow> a))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1674
  for f :: "'a::first_countable_topology \<Rightarrow> _"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1675
  unfolding filterlim_def[of _ "nhds a"] le_filter_def eventually_filtermap
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1676
    at_within_def eventually_nhds_within_iff_sequentially comp_def
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1677
  by metis
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1678
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1679
lemma approx_from_above_dense_linorder:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1680
  fixes x::"'a::{dense_linorder, linorder_topology, first_countable_topology}"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1681
  assumes "x < y"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1682
  shows "\<exists>u. (\<forall>n. u n > x) \<and> (u \<longlonglongrightarrow> x)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1683
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1684
  obtain A :: "nat \<Rightarrow> 'a set" where A: "\<And>i. open (A i)" "\<And>i. x \<in> A i"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1685
                                      "\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F \<longlonglongrightarrow> x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1686
    by (metis first_countable_topology_class.countable_basis)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1687
  define u where "u = (\<lambda>n. SOME z. z \<in> A n \<and> z > x)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1688
  have "\<exists>z. z \<in> U \<and> x < z" if "x \<in> U" "open U" for U
67226
ec32cdaab97b isabelle update_cartouches -c -t;
wenzelm
parents: 67149
diff changeset
  1689
    using open_right[OF \<open>open U\<close> \<open>x \<in> U\<close> \<open>x < y\<close>]
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1690
    by (meson atLeastLessThan_iff dense less_imp_le subset_eq)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1691
  then have *: "u n \<in> A n \<and> x < u n" for n
67226
ec32cdaab97b isabelle update_cartouches -c -t;
wenzelm
parents: 67149
diff changeset
  1692
    using \<open>x \<in> A n\<close> \<open>open (A n)\<close> unfolding u_def by (metis (no_types, lifting) someI_ex)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1693
  then have "u \<longlonglongrightarrow> x" using A(3) by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1694
  then show ?thesis using * by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1695
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1696
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1697
lemma approx_from_below_dense_linorder:
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1698
  fixes x::"'a::{dense_linorder, linorder_topology, first_countable_topology}"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1699
  assumes "x > y"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1700
  shows "\<exists>u. (\<forall>n. u n < x) \<and> (u \<longlonglongrightarrow> x)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1701
proof -
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1702
  obtain A :: "nat \<Rightarrow> 'a set" where A: "\<And>i. open (A i)" "\<And>i. x \<in> A i"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1703
                                      "\<And>F. (\<forall>n. F n \<in> A n) \<Longrightarrow> F \<longlonglongrightarrow> x"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1704
    by (metis first_countable_topology_class.countable_basis)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1705
  define u where "u = (\<lambda>n. SOME z. z \<in> A n \<and> z < x)"
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1706
  have "\<exists>z. z \<in> U \<and> z < x" if "x \<in> U" "open U" for U
67226
ec32cdaab97b isabelle update_cartouches -c -t;
wenzelm
parents: 67149
diff changeset
  1707
    using open_left[OF \<open>open U\<close> \<open>x \<in> U\<close> \<open>x > y\<close>]
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1708
    by (meson dense greaterThanAtMost_iff less_imp_le subset_eq)
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1709
  then have *: "u n \<in> A n \<and> u n < x" for n
67226
ec32cdaab97b isabelle update_cartouches -c -t;
wenzelm
parents: 67149
diff changeset
  1710
    using \<open>x \<in> A n\<close> \<open>open (A n)\<close> unfolding u_def by (metis (no_types, lifting) someI_ex)
64283
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1711
  then have "u \<longlonglongrightarrow> x" using A(3) by simp
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1712
  then show ?thesis using * by auto
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1713
qed
979cdfdf7a79 HOL-Probability: move conditional expectation from AFP/Ergodic_Theory
hoelzl
parents: 64008
diff changeset
  1714
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1715
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1716
subsection \<open>Function limit at a point\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1717
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1718
abbreviation LIM :: "('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1719
    ("((_)/ \<midarrow>(_)/\<rightarrow> (_))" [60, 0, 60] 60)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1720
  where "f \<midarrow>a\<rightarrow> L \<equiv> (f \<longlongrightarrow> L) (at a)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1721
61976
3a27957ac658 more symbols;
wenzelm
parents: 61973
diff changeset
  1722
lemma tendsto_within_open: "a \<in> S \<Longrightarrow> open S \<Longrightarrow> (f \<longlongrightarrow> l) (at a within S) \<longleftrightarrow> (f \<midarrow>a\<rightarrow> l)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1723
  by (simp add: tendsto_def at_within_open[where S = S])
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1724
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62381
diff changeset
  1725
lemma tendsto_within_open_NO_MATCH:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1726
  "a \<in> S \<Longrightarrow> NO_MATCH UNIV S \<Longrightarrow> open S \<Longrightarrow> (f \<longlongrightarrow> l)(at a within S) \<longleftrightarrow> (f \<longlongrightarrow> l)(at a)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1727
  for f :: "'a::topological_space \<Rightarrow> 'b::topological_space"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1728
  using tendsto_within_open by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1729
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1730
lemma LIM_const_not_eq[tendsto_intros]: "k \<noteq> L \<Longrightarrow> \<not> (\<lambda>x. k) \<midarrow>a\<rightarrow> L"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1731
  for a :: "'a::perfect_space" and k L :: "'b::t2_space"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1732
  by (simp add: tendsto_const_iff)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1733
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1734
lemmas LIM_not_zero = LIM_const_not_eq [where L = 0]
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1735
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1736
lemma LIM_const_eq: "(\<lambda>x. k) \<midarrow>a\<rightarrow> L \<Longrightarrow> k = L"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1737
  for a :: "'a::perfect_space" and k L :: "'b::t2_space"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1738
  by (simp add: tendsto_const_iff)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1739
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1740
lemma LIM_unique: "f \<midarrow>a\<rightarrow> L \<Longrightarrow> f \<midarrow>a\<rightarrow> M \<Longrightarrow> L = M"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1741
  for a :: "'a::perfect_space" and L M :: "'b::t2_space"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1742
  using at_neq_bot by (rule tendsto_unique)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1743
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1744
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1745
text \<open>Limits are equal for functions equal except at limit point.\<close>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1746
lemma LIM_equal: "\<forall>x. x \<noteq> a \<longrightarrow> f x = g x \<Longrightarrow> (f \<midarrow>a\<rightarrow> l) \<longleftrightarrow> (g \<midarrow>a\<rightarrow> l)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1747
  by (simp add: tendsto_def eventually_at_topological)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1748
61976
3a27957ac658 more symbols;
wenzelm
parents: 61973
diff changeset
  1749
lemma LIM_cong: "a = b \<Longrightarrow> (\<And>x. x \<noteq> b \<Longrightarrow> f x = g x) \<Longrightarrow> l = m \<Longrightarrow> (f \<midarrow>a\<rightarrow> l) \<longleftrightarrow> (g \<midarrow>b\<rightarrow> m)"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1750
  by (simp add: LIM_equal)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1751
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  1752
lemma tendsto_cong_limit: "(f \<longlongrightarrow> l) F \<Longrightarrow> k = l \<Longrightarrow> (f \<longlongrightarrow> k) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1753
  by simp
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1754
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1755
lemma tendsto_at_iff_tendsto_nhds: "g \<midarrow>l\<rightarrow> g l \<longleftrightarrow> (g \<longlongrightarrow> g l) (nhds l)"
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
  1756
  unfolding tendsto_def eventually_at_filter
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61806
diff changeset
  1757
  by (intro ext all_cong imp_cong) (auto elim!: eventually_mono)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1758
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1759
lemma tendsto_compose: "g \<midarrow>l\<rightarrow> g l \<Longrightarrow> (f \<longlongrightarrow> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> g l) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1760
  unfolding tendsto_at_iff_tendsto_nhds by (rule filterlim_compose[of g])
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1761
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1762
lemma tendsto_compose_eventually:
61976
3a27957ac658 more symbols;
wenzelm
parents: 61973
diff changeset
  1763
  "g \<midarrow>l\<rightarrow> m \<Longrightarrow> (f \<longlongrightarrow> l) F \<Longrightarrow> eventually (\<lambda>x. f x \<noteq> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> m) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1764
  by (rule filterlim_compose[of g _ "at l"]) (auto simp add: filterlim_at)
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1765
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1766
lemma LIM_compose_eventually:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1767
  assumes "f \<midarrow>a\<rightarrow> b"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1768
    and "g \<midarrow>b\<rightarrow> c"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1769
    and "eventually (\<lambda>x. f x \<noteq> b) (at a)"
61976
3a27957ac658 more symbols;
wenzelm
parents: 61973
diff changeset
  1770
  shows "(\<lambda>x. g (f x)) \<midarrow>a\<rightarrow> c"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1771
  using assms(2,1,3) by (rule tendsto_compose_eventually)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1772
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  1773
lemma tendsto_compose_filtermap: "((g \<circ> f) \<longlongrightarrow> T) F \<longleftrightarrow> (g \<longlongrightarrow> T) (filtermap f F)"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1774
  by (simp add: filterlim_def filtermap_filtermap comp_def)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1775
64758
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1776
lemma tendsto_compose_at:
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1777
  assumes f: "(f \<longlongrightarrow> y) F" and g: "(g \<longlongrightarrow> z) (at y)" and fg: "eventually (\<lambda>w. f w = y \<longrightarrow> g y = z) F"
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1778
  shows "((g \<circ> f) \<longlongrightarrow> z) F"
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1779
proof -
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1780
  have "(\<forall>\<^sub>F a in F. f a \<noteq> y) \<or> g y = z"
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1781
    using fg by force
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1782
  moreover have "(g \<longlongrightarrow> z) (filtermap f F) \<or> \<not> (\<forall>\<^sub>F a in F. f a \<noteq> y)"
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1783
    by (metis (no_types) filterlim_atI filterlim_def tendsto_mono f g)
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1784
  ultimately show ?thesis
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1785
    by (metis (no_types) f filterlim_compose filterlim_filtermap g tendsto_at_iff_tendsto_nhds tendsto_compose_filtermap)
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1786
qed
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  1787
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1788
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1789
subsubsection \<open>Relation of \<open>LIM\<close> and \<open>LIMSEQ\<close>\<close>
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1790
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1791
lemma (in first_countable_topology) sequentially_imp_eventually_within:
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1792
  "(\<forall>f. (\<forall>n. f n \<in> s \<and> f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially) \<Longrightarrow>
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1793
    eventually P (at a within s)"
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
  1794
  unfolding at_within_def
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1795
  by (intro sequentially_imp_eventually_nhds_within) auto
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1796
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1797
lemma (in first_countable_topology) sequentially_imp_eventually_at:
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1798
  "(\<forall>f. (\<forall>n. f n \<noteq> a) \<and> f \<longlonglongrightarrow> a \<longrightarrow> eventually (\<lambda>n. P (f n)) sequentially) \<Longrightarrow> eventually P (at a)"
63092
a949b2a5f51d eliminated use of empty "assms";
wenzelm
parents: 63040
diff changeset
  1799
  using sequentially_imp_eventually_within [where s=UNIV] by simp
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1800
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1801
lemma LIMSEQ_SEQ_conv1:
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1802
  fixes f :: "'a::topological_space \<Rightarrow> 'b::topological_space"
61976
3a27957ac658 more symbols;
wenzelm
parents: 61973
diff changeset
  1803
  assumes f: "f \<midarrow>a\<rightarrow> l"
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1804
  shows "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>n. f (S n)) \<longlonglongrightarrow> l"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1805
  using tendsto_compose_eventually [OF f, where F=sequentially] by simp
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1806
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1807
lemma LIMSEQ_SEQ_conv2:
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1808
  fixes f :: "'a::first_countable_topology \<Rightarrow> 'b::topological_space"
61969
e01015e49041 more symbols;
wenzelm
parents: 61907
diff changeset
  1809
  assumes "\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>n. f (S n)) \<longlonglongrightarrow> l"
61976
3a27957ac658 more symbols;
wenzelm
parents: 61973
diff changeset
  1810
  shows "f \<midarrow>a\<rightarrow> l"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1811
  using assms unfolding tendsto_def [where l=l] by (simp add: sequentially_imp_eventually_at)
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1812
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1813
lemma LIMSEQ_SEQ_conv: "(\<forall>S. (\<forall>n. S n \<noteq> a) \<and> S \<longlonglongrightarrow> a \<longrightarrow> (\<lambda>n. X (S n)) \<longlonglongrightarrow> L) \<longleftrightarrow> X \<midarrow>a\<rightarrow> L"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1814
  for a :: "'a::first_countable_topology" and L :: "'b::topological_space"
51473
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1815
  using LIMSEQ_SEQ_conv2 LIMSEQ_SEQ_conv1 ..
1210309fddab move first_countable_topology to the HOL image
hoelzl
parents: 51471
diff changeset
  1816
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1817
lemma sequentially_imp_eventually_at_left:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1818
  fixes a :: "'a::{linorder_topology,first_countable_topology}"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1819
  assumes b[simp]: "b < a"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1820
    and *: "\<And>f. (\<And>n. b < f n) \<Longrightarrow> (\<And>n. f n < a) \<Longrightarrow> incseq f \<Longrightarrow> f \<longlonglongrightarrow> a \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1821
      eventually (\<lambda>n. P (f n)) sequentially"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1822
  shows "eventually P (at_left a)"
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1823
proof (safe intro!: sequentially_imp_eventually_within)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1824
  fix X
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1825
  assume X: "\<forall>n. X n \<in> {..< a} \<and> X n \<noteq> a" "X \<longlonglongrightarrow> a"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1826
  show "eventually (\<lambda>n. P (X n)) sequentially"
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1827
  proof (rule ccontr)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1828
    assume neg: "\<not> ?thesis"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1829
    have "\<exists>s. \<forall>n. (\<not> P (X (s n)) \<and> b < X (s n)) \<and> (X (s n) \<le> X (s (Suc n)) \<and> Suc (s n) \<le> s (Suc n))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1830
      (is "\<exists>s. ?P s")
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1831
    proof (rule dependent_nat_choice)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1832
      have "\<not> eventually (\<lambda>n. b < X n \<longrightarrow> P (X n)) sequentially"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1833
        by (intro not_eventually_impI neg order_tendstoD(1) [OF X(2) b])
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1834
      then show "\<exists>x. \<not> P (X x) \<and> b < X x"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1835
        by (auto dest!: not_eventuallyD)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1836
    next
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1837
      fix x n
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1838
      have "\<not> eventually (\<lambda>n. Suc x \<le> n \<longrightarrow> b < X n \<longrightarrow> X x < X n \<longrightarrow> P (X n)) sequentially"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1839
        using X
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1840
        by (intro not_eventually_impI order_tendstoD(1)[OF X(2)] eventually_ge_at_top neg) auto
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1841
      then show "\<exists>n. (\<not> P (X n) \<and> b < X n) \<and> (X x \<le> X n \<and> Suc x \<le> n)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1842
        by (auto dest!: not_eventuallyD)
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1843
    qed
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1844
    then obtain s where "?P s" ..
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1845
    with X have "b < X (s n)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1846
      and "X (s n) < a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1847
      and "incseq (\<lambda>n. X (s n))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1848
      and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1849
      and "\<not> P (X (s n))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1850
      for n
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1851
      by (auto simp: strict_mono_Suc_iff Suc_le_eq incseq_Suc_iff
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1852
          intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1853
    from *[OF this(1,2,3,4)] this(5) show False
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1854
      by auto
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1855
  qed
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1856
qed
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1857
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1858
lemma tendsto_at_left_sequentially:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1859
  fixes a b :: "'b::{linorder_topology,first_countable_topology}"
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1860
  assumes "b < a"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1861
  assumes *: "\<And>S. (\<And>n. S n < a) \<Longrightarrow> (\<And>n. b < S n) \<Longrightarrow> incseq S \<Longrightarrow> S \<longlonglongrightarrow> a \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1862
    (\<lambda>n. X (S n)) \<longlonglongrightarrow> L"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  1863
  shows "(X \<longlongrightarrow> L) (at_left a)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1864
  using assms by (simp add: tendsto_def [where l=L] sequentially_imp_eventually_at_left)
57025
e7fd64f82876 add various lemmas
hoelzl
parents: 56949
diff changeset
  1865
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1866
lemma sequentially_imp_eventually_at_right:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1867
  fixes a b :: "'a::{linorder_topology,first_countable_topology}"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1868
  assumes b[simp]: "a < b"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1869
  assumes *: "\<And>f. (\<And>n. a < f n) \<Longrightarrow> (\<And>n. f n < b) \<Longrightarrow> decseq f \<Longrightarrow> f \<longlonglongrightarrow> a \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1870
    eventually (\<lambda>n. P (f n)) sequentially"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1871
  shows "eventually P (at_right a)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1872
proof (safe intro!: sequentially_imp_eventually_within)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1873
  fix X
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1874
  assume X: "\<forall>n. X n \<in> {a <..} \<and> X n \<noteq> a" "X \<longlonglongrightarrow> a"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1875
  show "eventually (\<lambda>n. P (X n)) sequentially"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1876
  proof (rule ccontr)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1877
    assume neg: "\<not> ?thesis"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1878
    have "\<exists>s. \<forall>n. (\<not> P (X (s n)) \<and> X (s n) < b) \<and> (X (s (Suc n)) \<le> X (s n) \<and> Suc (s n) \<le> s (Suc n))"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1879
      (is "\<exists>s. ?P s")
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1880
    proof (rule dependent_nat_choice)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1881
      have "\<not> eventually (\<lambda>n. X n < b \<longrightarrow> P (X n)) sequentially"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1882
        by (intro not_eventually_impI neg order_tendstoD(2) [OF X(2) b])
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1883
      then show "\<exists>x. \<not> P (X x) \<and> X x < b"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1884
        by (auto dest!: not_eventuallyD)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1885
    next
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1886
      fix x n
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1887
      have "\<not> eventually (\<lambda>n. Suc x \<le> n \<longrightarrow> X n < b \<longrightarrow> X n < X x \<longrightarrow> P (X n)) sequentially"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1888
        using X
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1889
        by (intro not_eventually_impI order_tendstoD(2)[OF X(2)] eventually_ge_at_top neg) auto
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1890
      then show "\<exists>n. (\<not> P (X n) \<and> X n < b) \<and> (X n \<le> X x \<and> Suc x \<le> n)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1891
        by (auto dest!: not_eventuallyD)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1892
    qed
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1893
    then obtain s where "?P s" ..
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1894
    with X have "a < X (s n)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1895
      and "X (s n) < b"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1896
      and "decseq (\<lambda>n. X (s n))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1897
      and "(\<lambda>n. X (s n)) \<longlonglongrightarrow> a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1898
      and "\<not> P (X (s n))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1899
      for n
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  1900
      by (auto simp: strict_mono_Suc_iff Suc_le_eq decseq_Suc_iff
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1901
          intro!: LIMSEQ_subseq_LIMSEQ[OF \<open>X \<longlonglongrightarrow> a\<close>, unfolded comp_def])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1902
    from *[OF this(1,2,3,4)] this(5) show False
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1903
      by auto
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1904
  qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1905
qed
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1906
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1907
lemma tendsto_at_right_sequentially:
60172
423273355b55 rename continuous and down_continuous in Order_Continuity to sup_/inf_continuous; relate them with topological continuity
hoelzl
parents: 60150
diff changeset
  1908
  fixes a :: "_ :: {linorder_topology, first_countable_topology}"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1909
  assumes "a < b"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1910
    and *: "\<And>S. (\<And>n. a < S n) \<Longrightarrow> (\<And>n. S n < b) \<Longrightarrow> decseq S \<Longrightarrow> S \<longlonglongrightarrow> a \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1911
      (\<lambda>n. X (S n)) \<longlonglongrightarrow> L"
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  1912
  shows "(X \<longlongrightarrow> L) (at_right a)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1913
  using assms by (simp add: tendsto_def [where l=L] sequentially_imp_eventually_at_right)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1914
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  1915
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1916
subsection \<open>Continuity\<close>
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  1917
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1918
subsubsection \<open>Continuity on a set\<close>
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
  1919
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1920
definition continuous_on :: "'a set \<Rightarrow> ('a::topological_space \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1921
  where "continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. (f \<longlongrightarrow> f x) (at x within s))"
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
  1922
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1923
lemma continuous_on_cong [cong]:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1924
  "s = t \<Longrightarrow> (\<And>x. x \<in> t \<Longrightarrow> f x = g x) \<Longrightarrow> continuous_on s f \<longleftrightarrow> continuous_on t g"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1925
  unfolding continuous_on_def
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1926
  by (intro ball_cong filterlim_cong) (auto simp: eventually_at_filter)
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1927
69546
27dae626822b prefer naming convention from datatype package for strong congruence rules
haftmann
parents: 69529
diff changeset
  1928
lemma continuous_on_cong_simp:
64008
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63952
diff changeset
  1929
  "s = t \<Longrightarrow> (\<And>x. x \<in> t =simp=> f x = g x) \<Longrightarrow> continuous_on s f \<longleftrightarrow> continuous_on t g"
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63952
diff changeset
  1930
  unfolding simp_implies_def by (rule continuous_on_cong)
17a20ca86d62 HOL-Probability: more about probability, prepare for Markov processes in the AFP
hoelzl
parents: 63952
diff changeset
  1931
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
  1932
lemma continuous_on_topological:
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
  1933
  "continuous_on s f \<longleftrightarrow>
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
  1934
    (\<forall>x\<in>s. \<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))"
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
  1935
  unfolding continuous_on_def tendsto_def eventually_at_topological by metis
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
  1936
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
  1937
lemma continuous_on_open_invariant:
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
  1938
  "continuous_on s f \<longleftrightarrow> (\<forall>B. open B \<longrightarrow> (\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> 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
  1939
proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1940
  fix B :: "'b set"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1941
  assume "continuous_on s f" "open B"
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
  1942
  then have "\<forall>x\<in>f -` B \<inter> s. (\<exists>A. open A \<and> x \<in> A \<and> s \<inter> A \<subseteq> f -` B)"
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
  1943
    by (auto simp: continuous_on_topological subset_eq Ball_def imp_conjL)
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1944
  then obtain A where "\<forall>x\<in>f -` B \<inter> s. open (A x) \<and> x \<in> A x \<and> s \<inter> A x \<subseteq> f -` B"
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  1945
    unfolding bchoice_iff ..
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
  1946
  then show "\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> 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
  1947
    by (intro exI[of _ "\<Union>x\<in>f -` B \<inter> s. A x"]) 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
  1948
next
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
  1949
  assume B: "\<forall>B. open B \<longrightarrow> (\<exists>A. open A \<and> A \<inter> s = f -` B \<inter> 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
  1950
  show "continuous_on s f"
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
  1951
    unfolding continuous_on_topological
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
  1952
  proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1953
    fix x B
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1954
    assume "x \<in> s" "open B" "f x \<in> B"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1955
    with B obtain A where A: "open A" "A \<inter> s = f -` B \<inter> s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1956
      by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  1957
    with \<open>x \<in> s\<close> \<open>f x \<in> B\<close> show "\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)"
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
  1958
      by (intro exI[of _ A]) 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
  1959
  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
  1960
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
  1961
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1962
lemma continuous_on_open_vimage:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1963
  "open s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>B. open B \<longrightarrow> open (f -` B \<inter> s))"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1964
  unfolding continuous_on_open_invariant
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1965
  by (metis open_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s])
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1966
55734
3f5b2745d659 More complex-related lemmas
paulson <lp15@cam.ac.uk>
parents: 55642
diff changeset
  1967
corollary continuous_imp_open_vimage:
3f5b2745d659 More complex-related lemmas
paulson <lp15@cam.ac.uk>
parents: 55642
diff changeset
  1968
  assumes "continuous_on s f" "open s" "open B" "f -` B \<subseteq> s"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1969
  shows "open (f -` B)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1970
  by (metis assms continuous_on_open_vimage le_iff_inf)
55734
3f5b2745d659 More complex-related lemmas
paulson <lp15@cam.ac.uk>
parents: 55642
diff changeset
  1971
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
  1972
corollary open_vimage[continuous_intros]:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1973
  assumes "open s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1974
    and "continuous_on UNIV f"
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55734
diff changeset
  1975
  shows "open (f -` s)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1976
  using assms by (simp add: continuous_on_open_vimage [OF open_UNIV])
55775
1557a391a858 A bit of tidying up
paulson <lp15@cam.ac.uk>
parents: 55734
diff changeset
  1977
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
  1978
lemma continuous_on_closed_invariant:
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
  1979
  "continuous_on s f \<longleftrightarrow> (\<forall>B. closed B \<longrightarrow> (\<exists>A. closed A \<and> A \<inter> s = f -` B \<inter> 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
  1980
proof -
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1981
  have *: "(\<And>A. P A \<longleftrightarrow> Q (- A)) \<Longrightarrow> (\<forall>A. P A) \<longleftrightarrow> (\<forall>A. Q A)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1982
    for P Q :: "'b set \<Rightarrow> bool"
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
  1983
    by (metis double_compl)
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
  1984
  show ?thesis
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1985
    unfolding continuous_on_open_invariant
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1986
    by (intro *) (auto simp: open_closed[symmetric])
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
  1987
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
  1988
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1989
lemma continuous_on_closed_vimage:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1990
  "closed s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>B. closed B \<longrightarrow> closed (f -` B \<inter> s))"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1991
  unfolding continuous_on_closed_invariant
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1992
  by (metis closed_Int Int_absorb Int_commute[of s] Int_assoc[of _ _ s])
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  1993
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61342
diff changeset
  1994
corollary closed_vimage_Int[continuous_intros]:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1995
  assumes "closed s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1996
    and "continuous_on t f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1997
    and t: "closed t"
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61342
diff changeset
  1998
  shows "closed (f -` s \<inter> t)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  1999
  using assms by (simp add: continuous_on_closed_vimage [OF t])
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61342
diff changeset
  2000
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
  2001
corollary closed_vimage[continuous_intros]:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2002
  assumes "closed s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2003
    and "continuous_on UNIV f"
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
  2004
  shows "closed (f -` s)"
61426
d53db136e8fd new material on path_component_sets, inside, outside, etc. And more default simprules
paulson <lp15@cam.ac.uk>
parents: 61342
diff changeset
  2005
  using closed_vimage_Int [OF assms] by simp
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
  2006
62843
313d3b697c9a Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  2007
lemma continuous_on_empty [simp]: "continuous_on {} f"
61907
f0c894ab18c9 Liouville theorem, Fundamental Theorem of Algebra, etc.
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2008
  by (simp add: continuous_on_def)
f0c894ab18c9 Liouville theorem, Fundamental Theorem of Algebra, etc.
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2009
62843
313d3b697c9a Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  2010
lemma continuous_on_sing [simp]: "continuous_on {x} f"
61907
f0c894ab18c9 Liouville theorem, Fundamental Theorem of Algebra, etc.
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2011
  by (simp add: continuous_on_def at_within_def)
f0c894ab18c9 Liouville theorem, Fundamental Theorem of Algebra, etc.
paulson <lp15@cam.ac.uk>
parents: 61810
diff changeset
  2012
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2013
lemma continuous_on_open_Union:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2014
  "(\<And>s. s \<in> S \<Longrightarrow> open s) \<Longrightarrow> (\<And>s. s \<in> S \<Longrightarrow> continuous_on s f) \<Longrightarrow> continuous_on (\<Union>S) f"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2015
  unfolding continuous_on_def
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2016
  by safe (metis open_Union at_within_open UnionI)
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2017
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2018
lemma continuous_on_open_UN:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2019
  "(\<And>s. s \<in> S \<Longrightarrow> open (A s)) \<Longrightarrow> (\<And>s. s \<in> S \<Longrightarrow> continuous_on (A s) f) \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2020
    continuous_on (\<Union>s\<in>S. A s) f"
62343
24106dc44def prefer abbreviations for compound operators INFIMUM and SUPREMUM
haftmann
parents: 62217
diff changeset
  2021
  by (rule continuous_on_open_Union) auto
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2022
61204
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61169
diff changeset
  2023
lemma continuous_on_open_Un:
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61169
diff changeset
  2024
  "open s \<Longrightarrow> open t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t f \<Longrightarrow> continuous_on (s \<union> t) f"
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61169
diff changeset
  2025
  using continuous_on_open_Union [of "{s,t}"] by auto
3e491e34a62e new lemmas and movement of lemmas into place
paulson
parents: 61169
diff changeset
  2026
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2027
lemma continuous_on_closed_Un:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2028
  "closed s \<Longrightarrow> closed t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t f \<Longrightarrow> continuous_on (s \<union> t) f"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2029
  by (auto simp add: continuous_on_closed_vimage closed_Un Int_Un_distrib)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2030
67727
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  2031
lemma continuous_on_closed_Union:
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  2032
  assumes "finite I"
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  2033
    "\<And>i. i \<in> I \<Longrightarrow> closed (U i)"
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  2034
    "\<And>i. i \<in> I \<Longrightarrow> continuous_on (U i) f"
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  2035
  shows "continuous_on (\<Union> i \<in> I. U i) f"
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  2036
  using assms
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  2037
  by (induction I) (auto intro!: continuous_on_closed_Un)
ce3e87a51488 moved Lipschitz continuity from AFP/Ordinary_Differential_Equations and AFP/Gromov_Hyperbolicity; moved lemmas from AFP/Gromov_Hyperbolicity/Library_Complements
immler
parents: 67707
diff changeset
  2038
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2039
lemma continuous_on_If:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2040
  assumes closed: "closed s" "closed t"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2041
    and cont: "continuous_on s f" "continuous_on t g"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2042
    and P: "\<And>x. x \<in> s \<Longrightarrow> \<not> P x \<Longrightarrow> f x = g x" "\<And>x. x \<in> t \<Longrightarrow> P x \<Longrightarrow> f x = g x"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2043
  shows "continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2044
    (is "continuous_on _ ?h")
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2045
proof-
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2046
  from P have "\<forall>x\<in>s. f x = ?h x" "\<forall>x\<in>t. g x = ?h x"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2047
    by auto
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2048
  with cont have "continuous_on s ?h" "continuous_on t ?h"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2049
    by simp_all
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2050
  with closed show ?thesis
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2051
    by (rule continuous_on_closed_Un)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2052
qed
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2053
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
  2054
lemma continuous_on_cases:
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64969
diff changeset
  2055
  "closed s \<Longrightarrow> closed t \<Longrightarrow> continuous_on s f \<Longrightarrow> continuous_on t g \<Longrightarrow>
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64969
diff changeset
  2056
    \<forall>x. (x\<in>s \<and> \<not> P x) \<or> (x \<in> t \<and> P x) \<longrightarrow> f x = g x \<Longrightarrow>
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64969
diff changeset
  2057
    continuous_on (s \<union> t) (\<lambda>x. if P x then f x else g x)"
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64969
diff changeset
  2058
  by (rule continuous_on_If) auto
ab7e11730ad8 Some new lemmas. Existing lemmas modified to use uniform_limit rather than its expansion
paulson <lp15@cam.ac.uk>
parents: 64969
diff changeset
  2059
68296
69d680e94961 tidying and reorganisation around Cauchy Integral Theorem
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
  2060
lemma continuous_on_id[continuous_intros,simp]: "continuous_on s (\<lambda>x. x)"
58729
e8ecc79aee43 add tendsto_const and tendsto_ident_at as simp and intro rules
hoelzl
parents: 57953
diff changeset
  2061
  unfolding continuous_on_def by fast
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
  2062
68296
69d680e94961 tidying and reorganisation around Cauchy Integral Theorem
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
  2063
lemma continuous_on_id'[continuous_intros,simp]: "continuous_on s id"
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63295
diff changeset
  2064
  unfolding continuous_on_def id_def by fast
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63295
diff changeset
  2065
68296
69d680e94961 tidying and reorganisation around Cauchy Integral Theorem
paulson <lp15@cam.ac.uk>
parents: 68064
diff changeset
  2066
lemma continuous_on_const[continuous_intros,simp]: "continuous_on s (\<lambda>x. c)"
58729
e8ecc79aee43 add tendsto_const and tendsto_ident_at as simp and intro rules
hoelzl
parents: 57953
diff changeset
  2067
  unfolding continuous_on_def by auto
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
  2068
61738
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  2069
lemma continuous_on_subset: "continuous_on s f \<Longrightarrow> t \<subseteq> s \<Longrightarrow> continuous_on t f"
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2070
  unfolding continuous_on_def
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2071
  by (metis subset_eq tendsto_within_subset)
61738
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  2072
56371
fb9ae0727548 extend continuous_intros; remove continuous_on_intros and isCont_intros
hoelzl
parents: 56329
diff changeset
  2073
lemma continuous_on_compose[continuous_intros]:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2074
  "continuous_on s f \<Longrightarrow> continuous_on (f ` s) g \<Longrightarrow> continuous_on s (g \<circ> f)"
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
  2075
  unfolding continuous_on_topological by simp metis
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
  2076
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2077
lemma continuous_on_compose2:
61738
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  2078
  "continuous_on t g \<Longrightarrow> continuous_on s f \<Longrightarrow> f ` s \<subseteq> t \<Longrightarrow> continuous_on s (\<lambda>x. g (f x))"
c4f6031f1310 New material about paths, winding numbers, etc. Added lemmas to divide_const_simps. Misc tuning.
paulson <lp15@cam.ac.uk>
parents: 61531
diff changeset
  2079
  using continuous_on_compose[of s f g] continuous_on_subset by (force simp add: comp_def)
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2080
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2081
lemma continuous_on_generate_topology:
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2082
  assumes *: "open = generate_topology X"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2083
    and **: "\<And>B. B \<in> X \<Longrightarrow> \<exists>C. open C \<and> C \<inter> A = f -` B \<inter> A"
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2084
  shows "continuous_on A f"
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2085
  unfolding continuous_on_open_invariant
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2086
proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2087
  fix B :: "'a set"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2088
  assume "open B"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2089
  then show "\<exists>C. open C \<and> C \<inter> A = f -` B \<inter> A"
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2090
    unfolding *
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2091
  proof induct
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2092
    case (UN K)
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2093
    then obtain C where "\<And>k. k \<in> K \<Longrightarrow> open (C k)" "\<And>k. k \<in> K \<Longrightarrow> C k \<inter> A = f -` k \<inter> A"
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2094
      by metis
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2095
    then show ?case
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2096
      by (intro exI[of _ "\<Union>k\<in>K. C k"]) blast
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2097
  qed (auto intro: **)
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2098
qed
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2099
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2100
lemma continuous_onI_mono:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2101
  fixes f :: "'a::linorder_topology \<Rightarrow> 'b::{dense_order,linorder_topology}"
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2102
  assumes "open (f`A)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2103
    and mono: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> x \<le> y \<Longrightarrow> f x \<le> f y"
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2104
  shows "continuous_on A f"
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2105
proof (rule continuous_on_generate_topology[OF open_generated_order], safe)
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2106
  have monoD: "\<And>x y. x \<in> A \<Longrightarrow> y \<in> A \<Longrightarrow> f x < f y \<Longrightarrow> x < y"
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2107
    by (auto simp: not_le[symmetric] mono)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2108
  have "\<exists>x. x \<in> A \<and> f x < b \<and> a < x" if a: "a \<in> A" and fa: "f a < b" for a b
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2109
  proof -
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2110
    obtain y where "f a < y" "{f a ..< y} \<subseteq> f`A"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2111
      using open_right[OF \<open>open (f`A)\<close>, of "f a" b] a fa
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2112
      by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2113
    obtain z where z: "f a < z" "z < min b y"
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2114
      using dense[of "f a" "min b y"] \<open>f a < y\<close> \<open>f a < b\<close> by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2115
    then obtain c where "z = f c" "c \<in> A"
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2116
      using \<open>{f a ..< y} \<subseteq> f`A\<close>[THEN subsetD, of z] by (auto simp: less_imp_le)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2117
    with a z show ?thesis
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2118
      by (auto intro!: exI[of _ c] simp: monoD)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2119
  qed
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2120
  then show "\<exists>C. open C \<and> C \<inter> A = f -` {..<b} \<inter> A" for b
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2121
    by (intro exI[of _ "(\<Union>x\<in>{x\<in>A. f x < b}. {..< x})"])
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2122
       (auto intro: le_less_trans[OF mono] less_imp_le)
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2123
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2124
  have "\<exists>x. x \<in> A \<and> b < f x \<and> x < a" if a: "a \<in> A" and fa: "b < f a" for a b
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2125
  proof -
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2126
    note a fa
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2127
    moreover
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2128
    obtain y where "y < f a" "{y <.. f a} \<subseteq> f`A"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2129
      using open_left[OF \<open>open (f`A)\<close>, of "f a" b]  a fa
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2130
      by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2131
    then obtain z where z: "max b y < z" "z < f a"
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2132
      using dense[of "max b y" "f a"] \<open>y < f a\<close> \<open>b < f a\<close> by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2133
    then obtain c where "z = f c" "c \<in> A"
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2134
      using \<open>{y <.. f a} \<subseteq> f`A\<close>[THEN subsetD, of z] by (auto simp: less_imp_le)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2135
    with a z show ?thesis
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2136
      by (auto intro!: exI[of _ c] simp: monoD)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2137
  qed
60720
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2138
  then show "\<exists>C. open C \<and> C \<inter> A = f -` {b <..} \<inter> A" for b
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2139
    by (intro exI[of _ "(\<Union>x\<in>{x\<in>A. b < f x}. {x <..})"])
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2140
       (auto intro: less_le_trans[OF _ mono] less_imp_le)
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2141
qed
8c99fa3b7c44 add continuous_onI_mono
hoelzl
parents: 60585
diff changeset
  2142
65204
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2143
lemma continuous_on_IccI:
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2144
  "\<lbrakk>(f \<longlongrightarrow> f a) (at_right a);
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2145
    (f \<longlongrightarrow> f b) (at_left b);
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2146
    (\<And>x. a < x \<Longrightarrow> x < b \<Longrightarrow> f \<midarrow>x\<rightarrow> f x); a < b\<rbrakk> \<Longrightarrow>
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2147
    continuous_on {a .. b} f"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2148
  for a::"'a::linorder_topology"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2149
  using at_within_open[of _ "{a<..<b}"]
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2150
  by (auto simp: continuous_on_def at_within_Icc_at_right at_within_Icc_at_left le_less
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2151
      at_within_Icc_at)
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2152
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2153
lemma
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2154
  fixes a b::"'a::linorder_topology"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2155
  assumes "continuous_on {a .. b} f" "a < b"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2156
  shows continuous_on_Icc_at_rightD: "(f \<longlongrightarrow> f a) (at_right a)"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2157
    and continuous_on_Icc_at_leftD: "(f \<longlongrightarrow> f b) (at_left b)"
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2158
  using assms
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2159
  by (auto simp: at_within_Icc_at_right at_within_Icc_at_left continuous_on_def
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2160
      dest: bspec[where x=a] bspec[where x=b])
d23eded35a33 modernized construction of type bcontfun; base explicit theorems on Uniform_Limit.thy; added some lemmas
immler
parents: 65036
diff changeset
  2161
68965
1254f3e57fed Removed problematic rules from continuous_intros
eberlm <eberlm@in.tum.de>
parents: 68860
diff changeset
  2162
lemma continuous_on_discrete [simp]:
68860
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
  2163
  "continuous_on A (f :: 'a :: discrete_topology \<Rightarrow> _)"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
  2164
  by (auto simp: continuous_on_def at_discrete)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2165
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2166
subsubsection \<open>Continuity at a point\<close>
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
  2167
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2168
definition continuous :: "'a::t2_space filter \<Rightarrow> ('a \<Rightarrow> 'b::topological_space) \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2169
  where "continuous F f \<longleftrightarrow> (f \<longlongrightarrow> f (Lim F (\<lambda>x. x))) F"
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
  2170
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
  2171
lemma continuous_bot[continuous_intros, simp]: "continuous bot f"
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
  2172
  unfolding continuous_def 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
  2173
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
  2174
lemma continuous_trivial_limit: "trivial_limit net \<Longrightarrow> continuous net f"
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
  2175
  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
  2176
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2177
lemma continuous_within: "continuous (at x within s) f \<longleftrightarrow> (f \<longlongrightarrow> f x) (at x within s)"
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
  2178
  by (cases "trivial_limit (at x within s)") (auto simp add: Lim_ident_at continuous_def)
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
  2179
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
  2180
lemma continuous_within_topological:
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
  2181
  "continuous (at x within s) f \<longleftrightarrow>
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
  2182
    (\<forall>B. open B \<longrightarrow> f x \<in> B \<longrightarrow> (\<exists>A. open A \<and> x \<in> A \<and> (\<forall>y\<in>s. y \<in> A \<longrightarrow> f y \<in> B)))"
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
  2183
  unfolding continuous_within tendsto_def eventually_at_topological by metis
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
  2184
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
  2185
lemma continuous_within_compose[continuous_intros]:
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
  2186
  "continuous (at x within s) f \<Longrightarrow> continuous (at (f x) within f ` s) g \<Longrightarrow>
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2187
    continuous (at x within s) (g \<circ> f)"
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
  2188
  by (simp add: continuous_within_topological) metis
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
  2189
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
  2190
lemma continuous_within_compose2:
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
  2191
  "continuous (at x within s) f \<Longrightarrow> continuous (at (f x) within f ` s) g \<Longrightarrow>
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2192
    continuous (at x within s) (\<lambda>x. g (f x))"
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
  2193
  using continuous_within_compose[of x s f g] by (simp add: comp_def)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  2194
61976
3a27957ac658 more symbols;
wenzelm
parents: 61973
diff changeset
  2195
lemma continuous_at: "continuous (at x) f \<longleftrightarrow> f \<midarrow>x\<rightarrow> f x"
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
  2196
  using continuous_within[of x UNIV f] 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
  2197
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
  2198
lemma continuous_ident[continuous_intros, simp]: "continuous (at x within S) (\<lambda>x. x)"
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
  2199
  unfolding continuous_within by (rule tendsto_ident_at)
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
  2200
70707
125705f5965f A little-known material, and some tidying up
paulson <lp15@cam.ac.uk>
parents: 70367
diff changeset
  2201
lemma continuous_id[continuous_intros, simp]: "continuous (at x within S) id"
125705f5965f A little-known material, and some tidying up
paulson <lp15@cam.ac.uk>
parents: 70367
diff changeset
  2202
  by (simp add: id_def)
125705f5965f A little-known material, and some tidying up
paulson <lp15@cam.ac.uk>
parents: 70367
diff changeset
  2203
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
  2204
lemma continuous_const[continuous_intros, simp]: "continuous F (\<lambda>x. c)"
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
  2205
  unfolding continuous_def by (rule tendsto_const)
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
  2206
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
  2207
lemma continuous_on_eq_continuous_within:
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
  2208
  "continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. continuous (at x within s) f)"
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
  2209
  unfolding continuous_on_def continuous_within ..
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
  2210
68965
1254f3e57fed Removed problematic rules from continuous_intros
eberlm <eberlm@in.tum.de>
parents: 68860
diff changeset
  2211
lemma continuous_discrete [simp]:
68860
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
  2212
  "continuous (at x within A) (f :: 'a :: discrete_topology \<Rightarrow> _)"
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
  2213
  by (auto simp: continuous_def at_discrete)
f443ec10447d Some basic materials on filters and topology
Manuel Eberl <eberlm@in.tum.de>
parents: 68802
diff changeset
  2214
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2215
abbreviation isCont :: "('a::t2_space \<Rightarrow> 'b::topological_space) \<Rightarrow> 'a \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2216
  where "isCont f a \<equiv> continuous (at a) f"
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
  2217
61976
3a27957ac658 more symbols;
wenzelm
parents: 61973
diff changeset
  2218
lemma isCont_def: "isCont f a \<longleftrightarrow> f \<midarrow>a\<rightarrow> f 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
  2219
  by (rule continuous_at)
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
  2220
68721
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68532
diff changeset
  2221
lemma isContD: "isCont f x \<Longrightarrow> f \<midarrow>x\<rightarrow> f x"
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68532
diff changeset
  2222
  by (simp add: isCont_def)
53ad5c01be3f Small lemmas about analysis
eberlm <eberlm@in.tum.de>
parents: 68532
diff changeset
  2223
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2224
lemma isCont_cong:
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2225
  assumes "eventually (\<lambda>x. f x = g x) (nhds x)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2226
  shows "isCont f x \<longleftrightarrow> isCont g x"
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2227
proof -
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2228
  from assms have [simp]: "f x = g x"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2229
    by (rule eventually_nhds_x_imp_x)
63295
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2230
  from assms have "eventually (\<lambda>x. f x = g x) (at x)"
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2231
    by (auto simp: eventually_at_filter elim!: eventually_mono)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2232
  with assms have "isCont f x \<longleftrightarrow> isCont g x" unfolding isCont_def
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2233
    by (intro filterlim_cong) (auto elim!: eventually_mono)
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2234
  with assms show ?thesis by simp
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2235
qed
52792bb9126e Facts about HK integration, complex powers, Gamma function
eberlm
parents: 63171
diff changeset
  2236
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60758
diff changeset
  2237
lemma continuous_at_imp_continuous_at_within: "isCont f x \<Longrightarrow> continuous (at x within s) f"
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
  2238
  by (auto intro: tendsto_mono at_le simp: continuous_at continuous_within)
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
  2239
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2240
lemma continuous_on_eq_continuous_at: "open s \<Longrightarrow> continuous_on s f \<longleftrightarrow> (\<forall>x\<in>s. isCont f x)"
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
  2241
  by (simp add: continuous_on_def continuous_at at_within_open[of _ s])
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2242
62083
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 62049
diff changeset
  2243
lemma continuous_within_open: "a \<in> A \<Longrightarrow> open A \<Longrightarrow> continuous (at a within A) f \<longleftrightarrow> isCont f a"
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 62049
diff changeset
  2244
  by (simp add: at_within_open_NO_MATCH)
7582b39f51ed add the proof of the central limit theorem
hoelzl
parents: 62049
diff changeset
  2245
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
  2246
lemma continuous_at_imp_continuous_on: "\<forall>x\<in>s. isCont f x \<Longrightarrow> continuous_on s f"
60762
bf0c76ccee8d new material for multivariate analysis, etc.
paulson
parents: 60758
diff changeset
  2247
  by (auto intro: continuous_at_imp_continuous_at_within simp: continuous_on_eq_continuous_within)
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
  2248
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
  2249
lemma isCont_o2: "isCont f a \<Longrightarrow> isCont g (f a) \<Longrightarrow> isCont (\<lambda>x. g (f x)) a"
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
  2250
  unfolding isCont_def by (rule tendsto_compose)
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
  2251
66827
c94531b5007d Divided Topology_Euclidean_Space in two, creating new theory Connected. Also deleted some duplicate / variant theorems
paulson <lp15@cam.ac.uk>
parents: 66447
diff changeset
  2252
lemma continuous_at_compose[continuous_intros]: "isCont f a \<Longrightarrow> isCont g (f a) \<Longrightarrow> isCont (g \<circ> f) 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
  2253
  unfolding o_def by (rule isCont_o2)
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  2254
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  2255
lemma isCont_tendsto_compose: "isCont g l \<Longrightarrow> (f \<longlongrightarrow> l) F \<Longrightarrow> ((\<lambda>x. g (f x)) \<longlongrightarrow> g l) F"
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  2256
  unfolding isCont_def by (rule tendsto_compose)
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  2257
62049
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2258
lemma continuous_on_tendsto_compose:
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2259
  assumes f_cont: "continuous_on s f"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2260
    and g: "(g \<longlongrightarrow> l) F"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2261
    and l: "l \<in> s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2262
    and ev: "\<forall>\<^sub>Fx in F. g x \<in> s"
62049
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2263
  shows "((\<lambda>x. f (g x)) \<longlongrightarrow> f l) F"
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2264
proof -
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2265
  from f_cont l have f: "(f \<longlongrightarrow> f l) (at l within s)"
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2266
    by (simp add: continuous_on_def)
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2267
  have i: "((\<lambda>x. if g x = l then f l else f (g x)) \<longlongrightarrow> f l) F"
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2268
    by (rule filterlim_If)
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2269
       (auto intro!: filterlim_compose[OF f] eventually_conj tendsto_mono[OF _ g]
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2270
             simp: filterlim_at eventually_inf_principal eventually_mono[OF ev])
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2271
  show ?thesis
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2272
    by (rule filterlim_cong[THEN iffD1[OF _ i]]) auto
b0f941e207cf Added lots of material on infinite sums, convergence radii, harmonic numbers, Gamma function
eberlm
parents: 61976
diff changeset
  2273
qed
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  2274
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
  2275
lemma continuous_within_compose3:
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
  2276
  "isCont g (f x) \<Longrightarrow> continuous (at x within s) f \<Longrightarrow> continuous (at x within s) (\<lambda>x. g (f x))"
63171
a0088f1c049d tuned proofs;
wenzelm
parents: 63170
diff changeset
  2277
  using continuous_at_imp_continuous_at_within continuous_within_compose2 by blast
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  2278
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2279
lemma filtermap_nhds_open_map:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2280
  assumes cont: "isCont f a"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2281
    and open_map: "\<And>S. open S \<Longrightarrow> open (f`S)"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2282
  shows "filtermap f (nhds a) = nhds (f a)"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2283
  unfolding filter_eq_iff
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2284
proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2285
  fix P
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2286
  assume "eventually P (filtermap f (nhds a))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2287
  then obtain S where "open S" "a \<in> S" "\<forall>x\<in>S. P (f x)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2288
    by (auto simp: eventually_filtermap eventually_nhds)
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2289
  then show "eventually P (nhds (f a))"
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2290
    unfolding eventually_nhds by (intro exI[of _ "f`S"]) (auto intro!: open_map)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2291
qed (metis filterlim_iff tendsto_at_iff_tendsto_nhds isCont_def eventually_filtermap cont)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2292
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  2293
lemma continuous_at_split:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2294
  "continuous (at x) f \<longleftrightarrow> continuous (at_left x) f \<and> continuous (at_right x) f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2295
  for x :: "'a::linorder_topology"
57447
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2296
  by (simp add: continuous_within filterlim_at_split)
87429bdecad5 import more stuff from the CLT proof; base the lborel measure on interval_measure; remove lebesgue measure
hoelzl
parents: 57276
diff changeset
  2297
70365
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2298
lemma continuous_on_max [continuous_intros]:
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2299
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2300
  shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. max (f x) (g x))"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2301
  by (auto simp: continuous_on_def intro!: tendsto_max)
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2302
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2303
lemma continuous_on_min [continuous_intros]:
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2304
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2305
  shows "continuous_on A f \<Longrightarrow> continuous_on A g \<Longrightarrow> continuous_on A (\<lambda>x. min (f x) (g x))"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2306
  by (auto simp: continuous_on_def intro!: tendsto_min)
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2307
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2308
lemma continuous_max [continuous_intros]:
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2309
  fixes f :: "'a::t2_space \<Rightarrow> 'b::linorder_topology"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2310
  shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. (max (f x) (g x)))"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2311
  by (simp add: tendsto_max continuous_def)
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2312
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2313
lemma continuous_min [continuous_intros]:
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2314
  fixes f :: "'a::t2_space \<Rightarrow> 'b::linorder_topology"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2315
  shows "\<lbrakk>continuous F f; continuous F g\<rbrakk> \<Longrightarrow> continuous F (\<lambda>x. (min (f x) (g x)))"
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2316
  by (simp add: tendsto_min continuous_def)
4df0628e8545 a few new lemmas and a bit of tidying
paulson <lp15@cam.ac.uk>
parents: 69593
diff changeset
  2317
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2318
text \<open>
63495
b0f8845e3498 proper latex;
wenzelm
parents: 63494
diff changeset
  2319
  The following open/closed Collect lemmas are ported from
b0f8845e3498 proper latex;
wenzelm
parents: 63494
diff changeset
  2320
  Sébastien Gouëzel's \<open>Ergodic_Theory\<close>.
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2321
\<close>
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2322
lemma open_Collect_neq:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2323
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2324
  assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2325
  shows "open {x. f x \<noteq> g x}"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2326
proof (rule openI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2327
  fix t
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2328
  assume "t \<in> {x. f x \<noteq> g x}"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2329
  then obtain U V where *: "open U" "open V" "f t \<in> U" "g t \<in> V" "U \<inter> V = {}"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2330
    by (auto simp add: separation_t2)
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2331
  with open_vimage[OF \<open>open U\<close> f] open_vimage[OF \<open>open V\<close> g]
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2332
  show "\<exists>T. open T \<and> t \<in> T \<and> T \<subseteq> {x. f x \<noteq> g x}"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2333
    by (intro exI[of _ "f -` U \<inter> g -` V"]) auto
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2334
qed
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2335
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2336
lemma closed_Collect_eq:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2337
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::t2_space"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2338
  assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2339
  shows "closed {x. f x = g x}"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2340
  using open_Collect_neq[OF f g] by (simp add: closed_def Collect_neg_eq)
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2341
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2342
lemma open_Collect_less:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2343
  fixes f g :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2344
  assumes f: "continuous_on UNIV f" and g: "continuous_on UNIV g"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2345
  shows "open {x. f x < g x}"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2346
proof (rule openI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2347
  fix t
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2348
  assume t: "t \<in> {x. f x < g x}"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2349
  show "\<exists>T. open T \<and> t \<in> T \<and> T \<subseteq> {x. f x < g x}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2350
  proof (cases "\<exists>z. f t < z \<and> z < g t")
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2351
    case True
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2352
    then obtain z where "f t < z \<and> z < g t" by blast
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2353
    then show ?thesis
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2354
      using open_vimage[OF _ f, of "{..< z}"] open_vimage[OF _ g, of "{z <..}"]
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2355
      by (intro exI[of _ "f -` {..<z} \<inter> g -` {z<..}"]) auto
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2356
  next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2357
    case False
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2358
    then have *: "{g t ..} = {f t <..}" "{..< g t} = {.. f t}"
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2359
      using t by (auto intro: leI)
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2360
    show ?thesis
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2361
      using open_vimage[OF _ f, of "{..< g t}"] open_vimage[OF _ g, of "{f t <..}"] t
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2362
      apply (intro exI[of _ "f -` {..< g t} \<inter> g -` {f t<..}"])
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2363
      apply (simp add: open_Int)
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2364
      apply (auto simp add: *)
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2365
      done
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2366
  qed
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2367
qed
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2368
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2369
lemma closed_Collect_le:
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2370
  fixes f g :: "'a :: topological_space \<Rightarrow> 'b::linorder_topology"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2371
  assumes f: "continuous_on UNIV f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2372
    and g: "continuous_on UNIV g"
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2373
  shows "closed {x. f x \<le> g x}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2374
  using open_Collect_less [OF g f]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2375
  by (simp add: closed_def Collect_neg_eq[symmetric] not_le)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2376
63332
f164526d8727 move open_Collect_eq/less to HOL
hoelzl
parents: 63317
diff changeset
  2377
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61234
diff changeset
  2378
subsubsection \<open>Open-cover compactness\<close>
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2379
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2380
context topological_space
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2381
begin
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2382
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69260
diff changeset
  2383
definition compact :: "'a set \<Rightarrow> bool" where
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69260
diff changeset
  2384
compact_eq_Heine_Borel:  (* This name is used for backwards compatibility *)
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2385
    "compact S \<longleftrightarrow> (\<forall>C. (\<forall>c\<in>C. open c) \<and> S \<subseteq> \<Union>C \<longrightarrow> (\<exists>D\<subseteq>C. finite D \<and> S \<subseteq> \<Union>D))"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2386
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2387
lemma compactI:
60585
48fdff264eb2 tuned whitespace;
wenzelm
parents: 60182
diff changeset
  2388
  assumes "\<And>C. \<forall>t\<in>C. open t \<Longrightarrow> s \<subseteq> \<Union>C \<Longrightarrow> \<exists>C'. C' \<subseteq> C \<and> finite C' \<and> s \<subseteq> \<Union>C'"
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2389
  shows "compact s"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69260
diff changeset
  2390
  unfolding compact_eq_Heine_Borel using assms by metis
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2391
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2392
lemma compact_empty[simp]: "compact {}"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2393
  by (auto intro!: compactI)
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2394
64758
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  2395
lemma compactE: (*related to COMPACT_IMP_HEINE_BOREL in HOL Light*)
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  2396
  assumes "compact S" "S \<subseteq> \<Union>\<T>" "\<And>B. B \<in> \<T> \<Longrightarrow> open B"
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  2397
  obtains \<T>' where "\<T>' \<subseteq> \<T>" "finite \<T>'" "S \<subseteq> \<Union>\<T>'"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69260
diff changeset
  2398
  by (meson assms compact_eq_Heine_Borel)
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2399
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2400
lemma compactE_image:
64845
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2401
  assumes "compact S"
67231
754952c12293 tuned op's
nipkow
parents: 67226
diff changeset
  2402
    and opn: "\<And>T. T \<in> C \<Longrightarrow> open (f T)"
65583
8d53b3bebab4 Further new material. The simprule status of some exp and ln identities was reverted.
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2403
    and S: "S \<subseteq> (\<Union>c\<in>C. f c)"
64845
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2404
  obtains C' where "C' \<subseteq> C" and "finite C'" and "S \<subseteq> (\<Union>c\<in>C'. f c)"
65583
8d53b3bebab4 Further new material. The simprule status of some exp and ln identities was reverted.
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2405
    apply (rule compactE[OF \<open>compact S\<close> S])
67231
754952c12293 tuned op's
nipkow
parents: 67226
diff changeset
  2406
    using opn apply force
65583
8d53b3bebab4 Further new material. The simprule status of some exp and ln identities was reverted.
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2407
    by (metis finite_subset_image)
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2408
62843
313d3b697c9a Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  2409
lemma compact_Int_closed [intro]:
64845
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2410
  assumes "compact S"
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2411
    and "closed T"
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2412
  shows "compact (S \<inter> T)"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2413
proof (rule compactI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2414
  fix C
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2415
  assume C: "\<forall>c\<in>C. open c"
64845
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2416
  assume cover: "S \<inter> T \<subseteq> \<Union>C"
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2417
  from C \<open>closed T\<close> have "\<forall>c\<in>C \<union> {- T}. open c"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2418
    by auto
64845
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2419
  moreover from cover have "S \<subseteq> \<Union>(C \<union> {- T})"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2420
    by auto
64845
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2421
  ultimately have "\<exists>D\<subseteq>C \<union> {- T}. finite D \<and> S \<subseteq> \<Union>D"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69260
diff changeset
  2422
    using \<open>compact S\<close> unfolding compact_eq_Heine_Borel by auto
64845
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2423
  then obtain D where "D \<subseteq> C \<union> {- T} \<and> finite D \<and> S \<subseteq> \<Union>D" ..
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2424
  then show "\<exists>D\<subseteq>C. finite D \<and> S \<inter> T \<subseteq> \<Union>D"
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2425
    by (intro exI[of _ "D - {-T}"]) auto
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2426
qed
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2427
64845
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2428
lemma compact_diff: "\<lbrakk>compact S; open T\<rbrakk> \<Longrightarrow> compact(S - T)"
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2429
  by (simp add: Diff_eq compact_Int_closed open_closed)
e5d4bc2016a6 Advanced topology
paulson <lp15@cam.ac.uk>
parents: 64773
diff changeset
  2430
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2431
lemma inj_setminus: "inj_on uminus (A::'a set set)"
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2432
  by (auto simp: inj_on_def)
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2433
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2434
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2435
subsection \<open>Finite intersection property\<close>
63301
d3c87eb0bad2 new results about topology
paulson <lp15@cam.ac.uk>
parents: 63295
diff changeset
  2436
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2437
lemma compact_fip:
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2438
  "compact U \<longleftrightarrow>
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2439
    (\<forall>A. (\<forall>a\<in>A. closed a) \<longrightarrow> (\<forall>B \<subseteq> A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}) \<longrightarrow> U \<inter> \<Inter>A \<noteq> {})"
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2440
  (is "_ \<longleftrightarrow> ?R")
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69260
diff changeset
  2441
proof (safe intro!: compact_eq_Heine_Borel[THEN iffD2])
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2442
  fix A
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2443
  assume "compact U"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2444
  assume A: "\<forall>a\<in>A. closed a" "U \<inter> \<Inter>A = {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2445
  assume fin: "\<forall>B \<subseteq> A. finite B \<longrightarrow> U \<inter> \<Inter>B \<noteq> {}"
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2446
  from A have "(\<forall>a\<in>uminus`A. open a) \<and> U \<subseteq> \<Union>(uminus`A)"
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2447
    by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2448
  with \<open>compact U\<close> obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<subseteq> \<Union>(uminus`B)"
69529
4ab9657b3257 capitalize proper names in lemma names
nipkow
parents: 69260
diff changeset
  2449
    unfolding compact_eq_Heine_Borel by (metis subset_image_iff)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2450
  with fin[THEN spec, of B] show False
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2451
    by (auto dest: finite_imageD intro: inj_setminus)
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2452
next
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2453
  fix A
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2454
  assume ?R
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2455
  assume "\<forall>a\<in>A. open a" "U \<subseteq> \<Union>A"
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2456
  then have "U \<inter> \<Inter>(uminus`A) = {}" "\<forall>a\<in>uminus`A. closed a"
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2457
    by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2458
  with \<open>?R\<close> obtain B where "B \<subseteq> A" "finite (uminus`B)" "U \<inter> \<Inter>(uminus`B) = {}"
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2459
    by (metis subset_image_iff)
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2460
  then show "\<exists>T\<subseteq>A. finite T \<and> U \<subseteq> \<Union>T"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2461
    by (auto intro!: exI[of _ B] inj_setminus dest: finite_imageD)
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2462
qed
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2463
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2464
lemma compact_imp_fip:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2465
  assumes "compact S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2466
    and "\<And>T. T \<in> F \<Longrightarrow> closed T"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2467
    and "\<And>F'. finite F' \<Longrightarrow> F' \<subseteq> F \<Longrightarrow> S \<inter> (\<Inter>F') \<noteq> {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2468
  shows "S \<inter> (\<Inter>F) \<noteq> {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2469
  using assms unfolding compact_fip by auto
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2470
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2471
lemma compact_imp_fip_image:
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2472
  assumes "compact s"
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2473
    and P: "\<And>i. i \<in> I \<Longrightarrow> closed (f i)"
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2474
    and Q: "\<And>I'. finite I' \<Longrightarrow> I' \<subseteq> I \<Longrightarrow> (s \<inter> (\<Inter>i\<in>I'. f i) \<noteq> {})"
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2475
  shows "s \<inter> (\<Inter>i\<in>I. f i) \<noteq> {}"
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2476
proof -
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2477
  note \<open>compact s\<close>
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2478
  moreover from P have "\<forall>i \<in> f ` I. closed i"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2479
    by blast
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2480
  moreover have "\<forall>A. finite A \<and> A \<subseteq> f ` I \<longrightarrow> (s \<inter> (\<Inter>A) \<noteq> {})"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2481
    apply rule
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2482
    apply rule
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2483
    apply (erule conjE)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2484
  proof -
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2485
    fix A :: "'a set set"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2486
    assume "finite A" and "A \<subseteq> f ` I"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2487
    then obtain B where "B \<subseteq> I" and "finite B" and "A = f ` B"
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2488
      using finite_subset_image [of A f I] by blast
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2489
    with Q [of B] show "s \<inter> \<Inter>A \<noteq> {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2490
      by simp
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2491
  qed
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2492
  ultimately have "s \<inter> (\<Inter>(f ` I)) \<noteq> {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2493
    by (metis compact_imp_fip)
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2494
  then show ?thesis by simp
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 56020
diff changeset
  2495
qed
54797
be020ec8560c modernized ContNotDenum: use Set_Interval, and finite intersection property to show the nested interval property
hoelzl
parents: 54258
diff changeset
  2496
51471
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  2497
end
cad22a3cc09c move topological_space to its own theory
hoelzl
parents:
diff changeset
  2498
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2499
lemma (in t2_space) compact_imp_closed:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2500
  assumes "compact s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2501
  shows "closed s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2502
  unfolding closed_def
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2503
proof (rule openI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2504
  fix y
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2505
  assume "y \<in> - s"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2506
  let ?C = "\<Union>x\<in>s. {u. open u \<and> x \<in> u \<and> eventually (\<lambda>y. y \<notin> u) (nhds y)}"
64758
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  2507
  have "s \<subseteq> \<Union>?C"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2508
  proof
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2509
    fix x
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2510
    assume "x \<in> s"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2511
    with \<open>y \<in> - s\<close> have "x \<noteq> y" by clarsimp
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2512
    then have "\<exists>u v. open u \<and> open v \<and> x \<in> u \<and> y \<in> v \<and> u \<inter> v = {}"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2513
      by (rule hausdorff)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2514
    with \<open>x \<in> s\<close> show "x \<in> \<Union>?C"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2515
      unfolding eventually_nhds by auto
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2516
  qed
64758
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  2517
  then obtain D where "D \<subseteq> ?C" and "finite D" and "s \<subseteq> \<Union>D"
3b33d2fc5fc0 A few new lemmas and needed adaptations
paulson <lp15@cam.ac.uk>
parents: 64394
diff changeset
  2518
    by (rule compactE [OF \<open>compact s\<close>]) auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2519
  from \<open>D \<subseteq> ?C\<close> have "\<forall>x\<in>D. eventually (\<lambda>y. y \<notin> x) (nhds y)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2520
    by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2521
  with \<open>finite D\<close> have "eventually (\<lambda>y. y \<notin> \<Union>D) (nhds y)"
60040
1fa1023b13b9 move MOST and INFM in Infinite_Set to Filter; change them to abbreviations over the cofinite filter
hoelzl
parents: 60036
diff changeset
  2522
    by (simp add: eventually_ball_finite)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2523
  with \<open>s \<subseteq> \<Union>D\<close> have "eventually (\<lambda>y. y \<notin> s) (nhds y)"
61810
3c5040d5694a sorted out eventually_mono
paulson <lp15@cam.ac.uk>
parents: 61806
diff changeset
  2524
    by (auto elim!: eventually_mono)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2525
  then show "\<exists>t. open t \<and> y \<in> t \<and> t \<subseteq> - s"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2526
    by (simp add: eventually_nhds subset_eq)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2527
qed
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2528
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2529
lemma compact_continuous_image:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2530
  assumes f: "continuous_on s f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2531
    and s: "compact s"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2532
  shows "compact (f ` s)"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2533
proof (rule compactI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2534
  fix C
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2535
  assume "\<forall>c\<in>C. open c" and cover: "f`s \<subseteq> \<Union>C"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2536
  with f have "\<forall>c\<in>C. \<exists>A. open A \<and> A \<inter> s = f -` c \<inter> s"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2537
    unfolding continuous_on_open_invariant by blast
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  2538
  then obtain A where A: "\<forall>c\<in>C. open (A c) \<and> A c \<inter> s = f -` c \<inter> s"
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  2539
    unfolding bchoice_iff ..
65583
8d53b3bebab4 Further new material. The simprule status of some exp and ln identities was reverted.
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2540
  with cover have "\<And>c. c \<in> C \<Longrightarrow> open (A c)" "s \<subseteq> (\<Union>c\<in>C. A c)"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2541
    by (fastforce simp add: subset_eq set_eq_iff)+
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2542
  from compactE_image[OF s this] obtain D where "D \<subseteq> C" "finite D" "s \<subseteq> (\<Union>c\<in>D. A c)" .
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2543
  with A show "\<exists>D \<subseteq> C. finite D \<and> f`s \<subseteq> \<Union>D"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2544
    by (intro exI[of _ D]) (fastforce simp add: subset_eq set_eq_iff)+
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2545
qed
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2546
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2547
lemma continuous_on_inv:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2548
  fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2549
  assumes "continuous_on s f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2550
    and "compact s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2551
    and "\<forall>x\<in>s. g (f x) = x"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2552
  shows "continuous_on (f ` s) g"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2553
  unfolding continuous_on_topological
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2554
proof (clarsimp simp add: assms(3))
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2555
  fix x :: 'a and B :: "'a set"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2556
  assume "x \<in> s" and "open B" and "x \<in> B"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2557
  have 1: "\<forall>x\<in>s. f x \<in> f ` (s - B) \<longleftrightarrow> x \<in> s - B"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2558
    using assms(3) by (auto, metis)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2559
  have "continuous_on (s - B) f"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2560
    using \<open>continuous_on s f\<close> Diff_subset
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2561
    by (rule continuous_on_subset)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2562
  moreover have "compact (s - B)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2563
    using \<open>open B\<close> and \<open>compact s\<close>
62843
313d3b697c9a Mostly renaming (from HOL Light to Isabelle conventions), with a couple of new results
paulson <lp15@cam.ac.uk>
parents: 62533
diff changeset
  2564
    unfolding Diff_eq by (intro compact_Int_closed closed_Compl)
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2565
  ultimately have "compact (f ` (s - B))"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2566
    by (rule compact_continuous_image)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2567
  then have "closed (f ` (s - B))"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2568
    by (rule compact_imp_closed)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2569
  then have "open (- f ` (s - B))"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2570
    by (rule open_Compl)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2571
  moreover have "f x \<in> - f ` (s - B)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2572
    using \<open>x \<in> s\<close> and \<open>x \<in> B\<close> by (simp add: 1)
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2573
  moreover have "\<forall>y\<in>s. f y \<in> - f ` (s - B) \<longrightarrow> y \<in> B"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2574
    by (simp add: 1)
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2575
  ultimately show "\<exists>A. open A \<and> f x \<in> A \<and> (\<forall>y\<in>s. f y \<in> A \<longrightarrow> y \<in> B)"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2576
    by fast
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2577
qed
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2578
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2579
lemma continuous_on_inv_into:
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2580
  fixes f :: "'a::topological_space \<Rightarrow> 'b::t2_space"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2581
  assumes s: "continuous_on s f" "compact s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2582
    and f: "inj_on f s"
51481
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2583
  shows "continuous_on (f ` s) (the_inv_into s f)"
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2584
  by (rule continuous_on_inv[OF s]) (auto simp: the_inv_into_f_f[OF f])
ef949192e5d6 move continuous_on_inv to HOL image (simplifies isCont_inverse_function)
hoelzl
parents: 51480
diff changeset
  2585
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2586
lemma (in linorder_topology) compact_attains_sup:
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2587
  assumes "compact S" "S \<noteq> {}"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2588
  shows "\<exists>s\<in>S. \<forall>t\<in>S. t \<le> s"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2589
proof (rule classical)
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2590
  assume "\<not> (\<exists>s\<in>S. \<forall>t\<in>S. t \<le> s)"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2591
  then obtain t where t: "\<forall>s\<in>S. t s \<in> S" and "\<forall>s\<in>S. s < t s"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2592
    by (metis not_le)
65583
8d53b3bebab4 Further new material. The simprule status of some exp and ln identities was reverted.
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2593
  then have "\<And>s. s\<in>S \<Longrightarrow> open {..< t s}" "S \<subseteq> (\<Union>s\<in>S. {..< t s})"
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2594
    by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2595
  with \<open>compact S\<close> obtain C where "C \<subseteq> S" "finite C" and C: "S \<subseteq> (\<Union>s\<in>C. {..< t s})"
65583
8d53b3bebab4 Further new material. The simprule status of some exp and ln identities was reverted.
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2596
    by (metis compactE_image)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2597
  with \<open>S \<noteq> {}\<close> have Max: "Max (t`C) \<in> t`C" and "\<forall>s\<in>t`C. s \<le> Max (t`C)"
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2598
    by (auto intro!: Max_in)
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2599
  with C have "S \<subseteq> {..< Max (t`C)}"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2600
    by (auto intro: less_le_trans simp: subset_eq)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2601
  with t Max \<open>C \<subseteq> S\<close> show ?thesis
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2602
    by fastforce
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2603
qed
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2604
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2605
lemma (in linorder_topology) compact_attains_inf:
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2606
  assumes "compact S" "S \<noteq> {}"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2607
  shows "\<exists>s\<in>S. \<forall>t\<in>S. s \<le> t"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2608
proof (rule classical)
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2609
  assume "\<not> (\<exists>s\<in>S. \<forall>t\<in>S. s \<le> t)"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2610
  then obtain t where t: "\<forall>s\<in>S. t s \<in> S" and "\<forall>s\<in>S. t s < s"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2611
    by (metis not_le)
65583
8d53b3bebab4 Further new material. The simprule status of some exp and ln identities was reverted.
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2612
  then have "\<And>s. s\<in>S \<Longrightarrow> open {t s <..}" "S \<subseteq> (\<Union>s\<in>S. {t s <..})"
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2613
    by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2614
  with \<open>compact S\<close> obtain C where "C \<subseteq> S" "finite C" and C: "S \<subseteq> (\<Union>s\<in>C. {t s <..})"
65583
8d53b3bebab4 Further new material. The simprule status of some exp and ln identities was reverted.
paulson <lp15@cam.ac.uk>
parents: 65204
diff changeset
  2615
    by (metis compactE_image)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2616
  with \<open>S \<noteq> {}\<close> have Min: "Min (t`C) \<in> t`C" and "\<forall>s\<in>t`C. Min (t`C) \<le> s"
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2617
    by (auto intro!: Min_in)
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2618
  with C have "S \<subseteq> {Min (t`C) <..}"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2619
    by (auto intro: le_less_trans simp: subset_eq)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2620
  with t Min \<open>C \<subseteq> S\<close> show ?thesis
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2621
    by fastforce
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2622
qed
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2623
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2624
lemma continuous_attains_sup:
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2625
  fixes f :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2626
  shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f \<Longrightarrow> (\<exists>x\<in>s. \<forall>y\<in>s.  f y \<le> f x)"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2627
  using compact_attains_sup[of "f ` s"] compact_continuous_image[of s f] by auto
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2628
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2629
lemma continuous_attains_inf:
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2630
  fixes f :: "'a::topological_space \<Rightarrow> 'b::linorder_topology"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2631
  shows "compact s \<Longrightarrow> s \<noteq> {} \<Longrightarrow> continuous_on s f \<Longrightarrow> (\<exists>x\<in>s. \<forall>y\<in>s. f x \<le> f y)"
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2632
  using compact_attains_inf[of "f ` s"] compact_continuous_image[of s f] by auto
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2633
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2634
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2635
subsection \<open>Connectedness\<close>
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2636
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2637
context topological_space
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2638
begin
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2639
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2640
definition "connected S \<longleftrightarrow>
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2641
  \<not> (\<exists>A B. open A \<and> open B \<and> S \<subseteq> A \<union> B \<and> A \<inter> B \<inter> S = {} \<and> A \<inter> S \<noteq> {} \<and> B \<inter> S \<noteq> {})"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2642
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2643
lemma connectedI:
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2644
  "(\<And>A B. open A \<Longrightarrow> open B \<Longrightarrow> A \<inter> U \<noteq> {} \<Longrightarrow> B \<inter> U \<noteq> {} \<Longrightarrow> A \<inter> B \<inter> U = {} \<Longrightarrow> U \<subseteq> A \<union> B \<Longrightarrow> False)
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2645
  \<Longrightarrow> connected U"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2646
  by (auto simp: connected_def)
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2647
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2648
lemma connected_empty [simp]: "connected {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2649
  by (auto intro!: connectedI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2650
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2651
lemma connected_sing [simp]: "connected {x}"
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2652
  by (auto intro!: connectedI)
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2653
56329
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2654
lemma connectedD:
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  2655
  "connected A \<Longrightarrow> open U \<Longrightarrow> open V \<Longrightarrow> U \<inter> V \<inter> A = {} \<Longrightarrow> A \<subseteq> U \<union> V \<Longrightarrow> U \<inter> A = {} \<or> V \<inter> A = {}"
56329
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2656
  by (auto simp: connected_def)
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2657
51479
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2658
end
33db4b7189af move compact to the HOL image; prove compactness of real closed intervals; show that continuous functions attain supremum and infimum on compact sets
hoelzl
parents: 51478
diff changeset
  2659
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2660
lemma connected_closed:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2661
  "connected s \<longleftrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2662
    \<not> (\<exists>A B. closed A \<and> closed B \<and> s \<subseteq> A \<union> B \<and> A \<inter> B \<inter> s = {} \<and> A \<inter> s \<noteq> {} \<and> B \<inter> s \<noteq> {})"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2663
  apply (simp add: connected_def del: ex_simps, safe)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2664
   apply (drule_tac x="-A" in spec)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2665
   apply (drule_tac x="-B" in spec)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2666
   apply (fastforce simp add: closed_def [symmetric])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2667
  apply (drule_tac x="-A" in spec)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2668
  apply (drule_tac x="-B" in spec)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2669
  apply (fastforce simp add: open_closed [symmetric])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2670
  done
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2671
62397
5ae24f33d343 Substantial new material for multivariate analysis. Also removal of some duplicates.
paulson <lp15@cam.ac.uk>
parents: 62381
diff changeset
  2672
lemma connected_closedD:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2673
  "\<lbrakk>connected s; A \<inter> B \<inter> s = {}; s \<subseteq> A \<union> B; closed A; closed B\<rbrakk> \<Longrightarrow> A \<inter> s = {} \<or> B \<inter> s = {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2674
  by (simp add: connected_closed)
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2675
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2676
lemma connected_Union:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2677
  assumes cs: "\<And>s. s \<in> S \<Longrightarrow> connected s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2678
    and ne: "\<Inter>S \<noteq> {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2679
  shows "connected(\<Union>S)"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2680
proof (rule connectedI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2681
  fix A B
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2682
  assume A: "open A" and B: "open B" and Alap: "A \<inter> \<Union>S \<noteq> {}" and Blap: "B \<inter> \<Union>S \<noteq> {}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2683
    and disj: "A \<inter> B \<inter> \<Union>S = {}" and cover: "\<Union>S \<subseteq> A \<union> B"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2684
  have disjs:"\<And>s. s \<in> S \<Longrightarrow> A \<inter> B \<inter> s = {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2685
    using disj by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2686
  obtain sa where sa: "sa \<in> S" "A \<inter> sa \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2687
    using Alap by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2688
  obtain sb where sb: "sb \<in> S" "B \<inter> sb \<noteq> {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2689
    using Blap by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2690
  obtain x where x: "\<And>s. s \<in> S \<Longrightarrow> x \<in> s"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2691
    using ne by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2692
  then have "x \<in> \<Union>S"
61342
b98cd131e2b5 isabelle update_cartouches;
wenzelm
parents: 61306
diff changeset
  2693
    using \<open>sa \<in> S\<close> by blast
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2694
  then have "x \<in> A \<or> x \<in> B"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2695
    using cover by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2696
  then show False
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2697
    using cs [unfolded connected_def]
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2698
    by (metis A B IntI Sup_upper sa sb disjs x cover empty_iff subset_trans)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2699
qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2700
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2701
lemma connected_Un: "connected s \<Longrightarrow> connected t \<Longrightarrow> s \<inter> t \<noteq> {} \<Longrightarrow> connected (s \<union> t)"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2702
  using connected_Union [of "{s,t}"] by auto
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2703
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2704
lemma connected_diff_open_from_closed:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2705
  assumes st: "s \<subseteq> t"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2706
    and tu: "t \<subseteq> u"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2707
    and s: "open s"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2708
    and t: "closed t"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2709
    and u: "connected u"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2710
    and ts: "connected (t - s)"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2711
  shows "connected(u - s)"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2712
proof (rule connectedI)
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2713
  fix A B
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2714
  assume AB: "open A" "open B" "A \<inter> (u - s) \<noteq> {}" "B \<inter> (u - s) \<noteq> {}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2715
    and disj: "A \<inter> B \<inter> (u - s) = {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2716
    and cover: "u - s \<subseteq> A \<union> B"
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2717
  then consider "A \<inter> (t - s) = {}" | "B \<inter> (t - s) = {}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2718
    using st ts tu connectedD [of "t-s" "A" "B"] by auto
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2719
  then show False
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2720
  proof cases
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2721
    case 1
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2722
    then have "(A - t) \<inter> (B \<union> s) \<inter> u = {}"
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2723
      using disj st by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2724
    moreover have "u \<subseteq> (A - t) \<union> (B \<union> s)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2725
      using 1 cover by auto
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2726
    ultimately show False
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2727
      using connectedD [of u "A - t" "B \<union> s"] AB s t 1 u by auto
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2728
  next
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2729
    case 2
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2730
    then have "(A \<union> s) \<inter> (B - t) \<inter> u = {}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2731
      using disj st by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2732
    moreover have "u \<subseteq> (A \<union> s) \<union> (B - t)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2733
      using 2 cover by auto
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2734
    ultimately show False
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2735
      using connectedD [of u "A \<union> s" "B - t"] AB s t 2 u by auto
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2736
  qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2737
qed
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2738
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2739
lemma connected_iff_const:
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2740
  fixes S :: "'a::topological_space set"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2741
  shows "connected S \<longleftrightarrow> (\<forall>P::'a \<Rightarrow> bool. continuous_on S P \<longrightarrow> (\<exists>c. \<forall>s\<in>S. P s = c))"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2742
proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2743
  fix P :: "'a \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2744
  assume "connected S" "continuous_on S P"
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2745
  then have "\<And>b. \<exists>A. open A \<and> A \<inter> S = P -` {b} \<inter> S"
62369
acfc4ad7b76a instantiate topologies for nat, int and enat
hoelzl
parents: 62367
diff changeset
  2746
    unfolding continuous_on_open_invariant by (simp add: open_discrete)
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2747
  from this[of True] this[of False]
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2748
  obtain t f where "open t" "open f" and *: "f \<inter> S = P -` {False} \<inter> S" "t \<inter> S = P -` {True} \<inter> S"
63171
a0088f1c049d tuned proofs;
wenzelm
parents: 63170
diff changeset
  2749
    by meson
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2750
  then have "t \<inter> S = {} \<or> f \<inter> S = {}"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2751
    by (intro connectedD[OF \<open>connected S\<close>])  auto
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2752
  then show "\<exists>c. \<forall>s\<in>S. P s = c"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2753
  proof (rule disjE)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2754
    assume "t \<inter> S = {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2755
    then show ?thesis
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2756
      unfolding * by (intro exI[of _ False]) auto
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2757
  next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2758
    assume "f \<inter> S = {}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2759
    then show ?thesis
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2760
      unfolding * by (intro exI[of _ True]) auto
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2761
  qed
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2762
next
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2763
  assume P: "\<forall>P::'a \<Rightarrow> bool. continuous_on S P \<longrightarrow> (\<exists>c. \<forall>s\<in>S. P s = c)"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2764
  show "connected S"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2765
  proof (rule connectedI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2766
    fix A B
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2767
    assume *: "open A" "open B" "A \<inter> S \<noteq> {}" "B \<inter> S \<noteq> {}" "A \<inter> B \<inter> S = {}" "S \<subseteq> A \<union> B"
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2768
    have "continuous_on S (\<lambda>x. x \<in> A)"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2769
      unfolding continuous_on_open_invariant
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2770
    proof safe
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2771
      fix C :: "bool set"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2772
      have "C = UNIV \<or> C = {True} \<or> C = {False} \<or> C = {}"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2773
        using subset_UNIV[of C] unfolding UNIV_bool by auto
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2774
      with * show "\<exists>T. open T \<and> T \<inter> S = (\<lambda>x. x \<in> A) -` C \<inter> S"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2775
        by (intro exI[of _ "(if True \<in> C then A else {}) \<union> (if False \<in> C then B else {})"]) auto
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2776
    qed
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2777
    from P[rule_format, OF this] obtain c where "\<And>s. s \<in> S \<Longrightarrow> (s \<in> A) = c"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2778
      by blast
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2779
    with * show False
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2780
      by (cases c) auto
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2781
  qed
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2782
qed
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2783
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2784
lemma connectedD_const: "connected S \<Longrightarrow> continuous_on S P \<Longrightarrow> \<exists>c. \<forall>s\<in>S. P s = c"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2785
  for P :: "'a::topological_space \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2786
  by (auto simp: connected_iff_const)
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2787
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2788
lemma connectedI_const:
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2789
  "(\<And>P::'a::topological_space \<Rightarrow> bool. continuous_on S P \<Longrightarrow> \<exists>c. \<forall>s\<in>S. P s = c) \<Longrightarrow> connected S"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2790
  by (auto simp: connected_iff_const)
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2791
56329
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2792
lemma connected_local_const:
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2793
  assumes "connected A" "a \<in> A" "b \<in> A"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2794
    and *: "\<forall>a\<in>A. eventually (\<lambda>b. f a = f b) (at a within A)"
56329
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2795
  shows "f a = f b"
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2796
proof -
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2797
  obtain S where S: "\<And>a. a \<in> A \<Longrightarrow> a \<in> S a" "\<And>a. a \<in> A \<Longrightarrow> open (S a)"
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2798
    "\<And>a x. a \<in> A \<Longrightarrow> x \<in> S a \<Longrightarrow> x \<in> A \<Longrightarrow> f a = f x"
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2799
    using * unfolding eventually_at_topological by metis
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2800
  let ?P = "\<Union>b\<in>{b\<in>A. f a = f b}. S b" and ?N = "\<Union>b\<in>{b\<in>A. f a \<noteq> f b}. S b"
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2801
  have "?P \<inter> A = {} \<or> ?N \<inter> A = {}"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2802
    using \<open>connected A\<close> S \<open>a\<in>A\<close>
56329
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2803
    by (intro connectedD) (auto, metis)
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2804
  then show "f a = f b"
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2805
  proof
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2806
    assume "?N \<inter> A = {}"
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2807
    then have "\<forall>x\<in>A. f a = f x"
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2808
      using S(1) by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2809
    with \<open>b\<in>A\<close> show ?thesis by auto
56329
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2810
  next
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2811
    assume "?P \<inter> A = {}" then show ?thesis
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2812
      using \<open>a \<in> A\<close> S(1)[of a] by auto
56329
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2813
  qed
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2814
qed
9597a53b3429 add connected_local_const
hoelzl
parents: 56289
diff changeset
  2815
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2816
lemma (in linorder_topology) connectedD_interval:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2817
  assumes "connected U"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2818
    and xy: "x \<in> U" "y \<in> U"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2819
    and "x \<le> z" "z \<le> y"
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2820
  shows "z \<in> U"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2821
proof -
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2822
  have eq: "{..<z} \<union> {z<..} = - {z}"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2823
    by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2824
  have "\<not> connected U" if "z \<notin> U" "x < z" "z < y"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2825
    using xy that
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2826
    apply (simp only: connected_def simp_thms)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2827
    apply (rule_tac exI[of _ "{..< z}"])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2828
    apply (rule_tac exI[of _ "{z <..}"])
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2829
    apply (auto simp add: eq)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2830
    done
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2831
  with assms show "z \<in> U"
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2832
    by (metis less_le)
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2833
qed
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2834
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2835
lemma (in linorder_topology) not_in_connected_cases:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2836
  assumes conn: "connected S"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2837
  assumes nbdd: "x \<notin> S"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2838
  assumes ne: "S \<noteq> {}"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2839
  obtains "bdd_above S" "\<And>y. y \<in> S \<Longrightarrow> x \<ge> y" | "bdd_below S" "\<And>y. y \<in> S \<Longrightarrow> x \<le> y"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2840
proof -
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2841
  obtain s where "s \<in> S" using ne by blast
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2842
  {
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2843
    assume "s \<le> x"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2844
    have "False" if "x \<le> y" "y \<in> S" for y
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2845
      using connectedD_interval[OF conn \<open>s \<in> S\<close> \<open>y \<in> S\<close> \<open>s \<le> x\<close> \<open>x \<le> y\<close>] \<open>x \<notin> S\<close>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2846
      by simp
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2847
    then have wit: "y \<in> S \<Longrightarrow> x \<ge> y" for y
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2848
      using le_cases by blast
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2849
    then have "bdd_above S"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2850
      by (rule local.bdd_aboveI)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2851
    note this wit
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2852
  } moreover {
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2853
    assume "x \<le> s"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2854
    have "False" if "x \<ge> y" "y \<in> S" for y
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2855
      using connectedD_interval[OF conn \<open>y \<in> S\<close> \<open>s \<in> S\<close> \<open>x \<ge> y\<close> \<open>s \<ge> x\<close> ] \<open>x \<notin> S\<close>
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2856
      by simp
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2857
    then have wit: "y \<in> S \<Longrightarrow> x \<le> y" for y
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2858
      using le_cases by blast
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2859
    then have "bdd_below S"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2860
      by (rule bdd_belowI)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2861
    note this wit
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2862
  } ultimately show ?thesis
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2863
    by (meson le_cases that)
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2864
qed
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  2865
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2866
lemma connected_continuous_image:
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2867
  assumes *: "continuous_on s f"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2868
    and "connected s"
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2869
  shows "connected (f ` s)"
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2870
proof (rule connectedI_const)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2871
  fix P :: "'b \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2872
  assume "continuous_on (f ` s) P"
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2873
  then have "continuous_on s (P \<circ> f)"
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2874
    by (rule continuous_on_compose[OF *])
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2875
  from connectedD_const[OF \<open>connected s\<close> this] show "\<exists>c. \<forall>s\<in>f ` s. P s = c"
59106
af691e67f71f instance bool and enat as topologies
hoelzl
parents: 58889
diff changeset
  2876
    by auto
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2877
qed
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2878
61306
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2879
9dd394c866fc New theorems about connected sets. And pairwise moved to Set.thy.
paulson <lp15@cam.ac.uk>
parents: 61245
diff changeset
  2880
section \<open>Linear Continuum Topologies\<close>
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2881
51775
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2882
class linear_continuum_topology = linorder_topology + linear_continuum
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2883
begin
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2884
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2885
lemma Inf_notin_open:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2886
  assumes A: "open A"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2887
    and bnd: "\<forall>a\<in>A. x < a"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2888
  shows "Inf A \<notin> A"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2889
proof
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2890
  assume "Inf A \<in> A"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2891
  then obtain b where "b < Inf A" "{b <.. Inf A} \<subseteq> A"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2892
    using open_left[of A "Inf A" x] assms by auto
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2893
  with dense[of b "Inf A"] obtain c where "c < Inf A" "c \<in> A"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2894
    by (auto simp: subset_eq)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2895
  then show False
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2896
    using cInf_lower[OF \<open>c \<in> A\<close>] bnd
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2897
    by (metis not_le less_imp_le bdd_belowI)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2898
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2899
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2900
lemma Sup_notin_open:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2901
  assumes A: "open A"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2902
    and bnd: "\<forall>a\<in>A. a < x"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2903
  shows "Sup A \<notin> A"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2904
proof
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2905
  assume "Sup A \<in> A"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2906
  with assms obtain b where "Sup A < b" "{Sup A ..< b} \<subseteq> A"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2907
    using open_right[of A "Sup A" x] by auto
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2908
  with dense[of "Sup A" b] obtain c where "Sup A < c" "c \<in> A"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2909
    by (auto simp: subset_eq)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2910
  then show False
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2911
    using cSup_upper[OF \<open>c \<in> A\<close>] bnd
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2912
    by (metis less_imp_le not_le bdd_aboveI)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2913
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2914
51480
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2915
end
3793c3a11378 move connected to HOL image; used to show intermediate value theorem
hoelzl
parents: 51479
diff changeset
  2916
51775
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2917
instance linear_continuum_topology \<subseteq> perfect_space
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2918
proof
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2919
  fix x :: 'a
53381
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  2920
  obtain y where "x < y \<or> y < x"
355a4cac5440 tuned proofs -- less guessing;
wenzelm
parents: 53374
diff changeset
  2921
    using ex_gt_or_lt [of x] ..
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2922
  with Inf_notin_open[of "{x}" y] Sup_notin_open[of "{x}" y] show "\<not> open {x}"
51775
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2923
    by auto
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2924
qed
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2925
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2926
lemma connectedI_interval:
51775
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2927
  fixes U :: "'a :: linear_continuum_topology set"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2928
  assumes *: "\<And>x y z. x \<in> U \<Longrightarrow> y \<in> U \<Longrightarrow> x \<le> z \<Longrightarrow> z \<le> y \<Longrightarrow> z \<in> U"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2929
  shows "connected U"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2930
proof (rule connectedI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2931
  {
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2932
    fix A B
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2933
    assume "open A" "open B" "A \<inter> B \<inter> U = {}" "U \<subseteq> A \<union> B"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2934
    fix x y
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2935
    assume "x < y" "x \<in> A" "y \<in> B" "x \<in> U" "y \<in> U"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2936
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2937
    let ?z = "Inf (B \<inter> {x <..})"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2938
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2939
    have "x \<le> ?z" "?z \<le> y"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2940
      using \<open>y \<in> B\<close> \<open>x < y\<close> by (auto intro: cInf_lower cInf_greatest)
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2941
    with \<open>x \<in> U\<close> \<open>y \<in> U\<close> have "?z \<in> U"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2942
      by (rule *)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2943
    moreover have "?z \<notin> B \<inter> {x <..}"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2944
      using \<open>open B\<close> by (intro Inf_notin_open) auto
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2945
    ultimately have "?z \<in> A"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2946
      using \<open>x \<le> ?z\<close> \<open>A \<inter> B \<inter> U = {}\<close> \<open>x \<in> A\<close> \<open>U \<subseteq> A \<union> B\<close> by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2947
    have "\<exists>b\<in>B. b \<in> A \<and> b \<in> U" if "?z < y"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2948
    proof -
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2949
      obtain a where "?z < a" "{?z ..< a} \<subseteq> A"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2950
        using open_right[OF \<open>open A\<close> \<open>?z \<in> A\<close> \<open>?z < y\<close>] by auto
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2951
      moreover obtain b where "b \<in> B" "x < b" "b < min a y"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2952
        using cInf_less_iff[of "B \<inter> {x <..}" "min a y"] \<open>?z < a\<close> \<open>?z < y\<close> \<open>x < y\<close> \<open>y \<in> B\<close>
63171
a0088f1c049d tuned proofs;
wenzelm
parents: 63170
diff changeset
  2953
        by auto
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 53215
diff changeset
  2954
      moreover have "?z \<le> b"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2955
        using \<open>b \<in> B\<close> \<open>x < b\<close>
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 53946
diff changeset
  2956
        by (intro cInf_lower) auto
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2957
      moreover have "b \<in> U"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2958
        using \<open>x \<le> ?z\<close> \<open>?z \<le> b\<close> \<open>b < min a y\<close>
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  2959
        by (intro *[OF \<open>x \<in> U\<close> \<open>y \<in> U\<close>]) (auto simp: less_imp_le)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2960
      ultimately show ?thesis
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2961
        by (intro bexI[of _ b]) auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2962
    qed
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2963
    then have False
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2964
      using \<open>?z \<le> y\<close> \<open>?z \<in> A\<close> \<open>y \<in> B\<close> \<open>y \<in> U\<close> \<open>A \<inter> B \<inter> U = {}\<close>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2965
      unfolding le_less by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2966
  }
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2967
  note not_disjoint = this
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2968
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2969
  fix A B assume AB: "open A" "open B" "U \<subseteq> A \<union> B" "A \<inter> B \<inter> U = {}"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2970
  moreover assume "A \<inter> U \<noteq> {}" then obtain x where x: "x \<in> U" "x \<in> A" by auto
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2971
  moreover assume "B \<inter> U \<noteq> {}" then obtain y where y: "y \<in> U" "y \<in> B" by auto
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2972
  moreover note not_disjoint[of B A y x] not_disjoint[of A B x y]
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2973
  ultimately show False
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2974
    by (cases x y rule: linorder_cases) auto
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2975
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2976
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2977
lemma connected_iff_interval: "connected U \<longleftrightarrow> (\<forall>x\<in>U. \<forall>y\<in>U. \<forall>z. x \<le> z \<longrightarrow> z \<le> y \<longrightarrow> z \<in> U)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2978
  for U :: "'a::linear_continuum_topology set"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2979
  by (auto intro: connectedI_interval dest: connectedD_interval)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  2980
51775
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  2981
lemma connected_UNIV[simp]: "connected (UNIV::'a::linear_continuum_topology set)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2982
  by (simp add: connected_iff_interval)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2983
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2984
lemma connected_Ioi[simp]: "connected {a<..}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2985
  for a :: "'a::linear_continuum_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2986
  by (auto simp: connected_iff_interval)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2987
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2988
lemma connected_Ici[simp]: "connected {a..}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2989
  for a :: "'a::linear_continuum_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2990
  by (auto simp: connected_iff_interval)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2991
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2992
lemma connected_Iio[simp]: "connected {..<a}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2993
  for a :: "'a::linear_continuum_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2994
  by (auto simp: connected_iff_interval)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2995
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2996
lemma connected_Iic[simp]: "connected {..a}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2997
  for a :: "'a::linear_continuum_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2998
  by (auto simp: connected_iff_interval)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  2999
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3000
lemma connected_Ioo[simp]: "connected {a<..<b}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3001
  for a b :: "'a::linear_continuum_topology"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3002
  unfolding connected_iff_interval by auto
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3003
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3004
lemma connected_Ioc[simp]: "connected {a<..b}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3005
  for a b :: "'a::linear_continuum_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3006
  by (auto simp: connected_iff_interval)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3007
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3008
lemma connected_Ico[simp]: "connected {a..<b}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3009
  for a b :: "'a::linear_continuum_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3010
  by (auto simp: connected_iff_interval)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3011
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3012
lemma connected_Icc[simp]: "connected {a..b}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3013
  for a b :: "'a::linear_continuum_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3014
  by (auto simp: connected_iff_interval)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3015
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  3016
lemma connected_contains_Ioo:
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3017
  fixes A :: "'a :: linorder_topology set"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3018
  assumes "connected A" "a \<in> A" "b \<in> A" shows "{a <..< b} \<subseteq> A"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3019
  using connectedD_interval[OF assms] by (simp add: subset_eq Ball_def less_imp_le)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3020
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
  3021
lemma connected_contains_Icc:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3022
  fixes A :: "'a::linorder_topology set"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3023
  assumes "connected A" "a \<in> A" "b \<in> A"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3024
  shows "{a..b} \<subseteq> A"
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
  3025
proof
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
  3026
  fix x assume "x \<in> {a..b}"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3027
  then have "x = a \<or> x = b \<or> x \<in> {a<..<b}"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3028
    by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3029
  then show "x \<in> A"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3030
    using assms connected_contains_Ioo[of A a b] by auto
61531
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
  3031
qed
ab2e862263e7 Rounding function, uniform limits, cotangent, binomial identities
eberlm
parents: 61520
diff changeset
  3032
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3033
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3034
subsection \<open>Intermediate Value Theorem\<close>
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3035
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3036
lemma IVT':
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3037
  fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3038
  assumes y: "f a \<le> y" "y \<le> f b" "a \<le> b"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3039
    and *: "continuous_on {a .. b} f"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3040
  shows "\<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3041
proof -
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3042
  have "connected {a..b}"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3043
    unfolding connected_iff_interval by auto
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3044
  from connected_continuous_image[OF * this, THEN connectedD_interval, of "f a" "f b" y] y
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3045
  show ?thesis
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3046
    by (auto simp add: atLeastAtMost_def atLeast_def atMost_def)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3047
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3048
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3049
lemma IVT2':
51775
408d937c9486 revert #916271d52466; add non-topological linear_continuum type class; show linear_continuum_topology is a perfect_space
hoelzl
parents: 51774
diff changeset
  3050
  fixes f :: "'a :: linear_continuum_topology \<Rightarrow> 'b :: linorder_topology"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3051
  assumes y: "f b \<le> y" "y \<le> f a" "a \<le> b"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3052
    and *: "continuous_on {a .. b} f"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3053
  shows "\<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3054
proof -
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3055
  have "connected {a..b}"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3056
    unfolding connected_iff_interval by auto
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3057
  from connected_continuous_image[OF * this, THEN connectedD_interval, of "f b" "f a" y] y
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3058
  show ?thesis
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3059
    by (auto simp add: atLeastAtMost_def atLeast_def atMost_def)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3060
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3061
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3062
lemma IVT:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3063
  fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3064
  shows "f a \<le> y \<Longrightarrow> y \<le> f b \<Longrightarrow> a \<le> b \<Longrightarrow> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x) \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3065
    \<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3066
  by (rule IVT') (auto intro: continuous_at_imp_continuous_on)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3067
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3068
lemma IVT2:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3069
  fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3070
  shows "f b \<le> y \<Longrightarrow> y \<le> f a \<Longrightarrow> a \<le> b \<Longrightarrow> (\<forall>x. a \<le> x \<and> x \<le> b \<longrightarrow> isCont f x) \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3071
    \<exists>x. a \<le> x \<and> x \<le> b \<and> f x = y"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3072
  by (rule IVT2') (auto intro: continuous_at_imp_continuous_on)
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3073
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3074
lemma continuous_inj_imp_mono:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3075
  fixes f :: "'a::linear_continuum_topology \<Rightarrow> 'b::linorder_topology"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3076
  assumes x: "a < x" "x < b"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3077
    and cont: "continuous_on {a..b} f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3078
    and inj: "inj_on f {a..b}"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3079
  shows "(f a < f x \<and> f x < f b) \<or> (f b < f x \<and> f x < f a)"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3080
proof -
61520
8f85bb443d33 Cauchy's integral formula, required lemmas, and a bit of reorganisation
paulson <lp15@cam.ac.uk>
parents: 61426
diff changeset
  3081
  note I = inj_on_eq_iff[OF inj]
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3082
  {
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3083
    assume "f x < f a" "f x < f b"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3084
    then obtain s t where "x \<le> s" "s \<le> b" "a \<le> t" "t \<le> x" "f s = f t" "f x < f s"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3085
      using IVT'[of f x "min (f a) (f b)" b] IVT2'[of f x "min (f a) (f b)" a] x
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3086
      by (auto simp: continuous_on_subset[OF cont] less_imp_le)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3087
    with x I have False by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3088
  }
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3089
  moreover
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3090
  {
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3091
    assume "f a < f x" "f b < f x"
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3092
    then obtain s t where "x \<le> s" "s \<le> b" "a \<le> t" "t \<le> x" "f s = f t" "f s < f x"
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3093
      using IVT'[of f a "max (f a) (f b)" x] IVT2'[of f b "max (f a) (f b)" x] x
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3094
      by (auto simp: continuous_on_subset[OF cont] less_imp_le)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3095
    with x I have False by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3096
  }
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3097
  ultimately show ?thesis
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3098
    using I[of a x] I[of x b] x less_trans[OF x]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3099
    by (auto simp add: le_less less_imp_neq neq_iff)
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3100
qed
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3101
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3102
lemma continuous_at_Sup_mono:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3103
  fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3104
    'b::{linorder_topology,conditionally_complete_linorder}"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3105
  assumes "mono f"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3106
    and cont: "continuous (at_left (Sup S)) f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3107
    and S: "S \<noteq> {}" "bdd_above S"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3108
  shows "f (Sup S) = (SUP s\<in>S. f s)"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3109
proof (rule antisym)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3110
  have f: "(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3111
    using cont unfolding continuous_within .
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3112
  show "f (Sup S) \<le> (SUP s\<in>S. f s)"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3113
  proof cases
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3114
    assume "Sup S \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3115
    then show ?thesis
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3116
      by (rule cSUP_upper) (auto intro: bdd_above_image_mono S \<open>mono f\<close>)
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3117
  next
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3118
    assume "Sup S \<notin> S"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3119
    from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3120
      by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3121
    with \<open>Sup S \<notin> S\<close> S have "s < Sup S"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3122
      unfolding less_le by (blast intro: cSup_upper)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3123
    show ?thesis
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3124
    proof (rule ccontr)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3125
      assume "\<not> ?thesis"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3126
      with order_tendstoD(1)[OF f, of "SUP s\<in>S. f s"] obtain b where "b < Sup S"
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3127
        and *: "\<And>y. b < y \<Longrightarrow> y < Sup S \<Longrightarrow> (SUP s\<in>S. f s) < f y"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3128
        by (auto simp: not_le eventually_at_left[OF \<open>s < Sup S\<close>])
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3129
      with \<open>S \<noteq> {}\<close> obtain c where "c \<in> S" "b < c"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3130
        using less_cSupD[of S b] by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3131
      with \<open>Sup S \<notin> S\<close> S have "c < Sup S"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3132
        unfolding less_le by (blast intro: cSup_upper)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3133
      from *[OF \<open>b < c\<close> \<open>c < Sup S\<close>] cSUP_upper[OF \<open>c \<in> S\<close> bdd_above_image_mono[of f]]
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3134
      show False
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3135
        by (auto simp: assms)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3136
    qed
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3137
  qed
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3138
qed (intro cSUP_least \<open>mono f\<close>[THEN monoD] cSup_upper S)
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3139
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3140
lemma continuous_at_Sup_antimono:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3141
  fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3142
    'b::{linorder_topology,conditionally_complete_linorder}"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3143
  assumes "antimono f"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3144
    and cont: "continuous (at_left (Sup S)) f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3145
    and S: "S \<noteq> {}" "bdd_above S"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3146
  shows "f (Sup S) = (INF s\<in>S. f s)"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3147
proof (rule antisym)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3148
  have f: "(f \<longlongrightarrow> f (Sup S)) (at_left (Sup S))"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3149
    using cont unfolding continuous_within .
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3150
  show "(INF s\<in>S. f s) \<le> f (Sup S)"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3151
  proof cases
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3152
    assume "Sup S \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3153
    then show ?thesis
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3154
      by (intro cINF_lower) (auto intro: bdd_below_image_antimono S \<open>antimono f\<close>)
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3155
  next
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3156
    assume "Sup S \<notin> S"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3157
    from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3158
      by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3159
    with \<open>Sup S \<notin> S\<close> S have "s < Sup S"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3160
      unfolding less_le by (blast intro: cSup_upper)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3161
    show ?thesis
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3162
    proof (rule ccontr)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3163
      assume "\<not> ?thesis"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3164
      with order_tendstoD(2)[OF f, of "INF s\<in>S. f s"] obtain b where "b < Sup S"
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3165
        and *: "\<And>y. b < y \<Longrightarrow> y < Sup S \<Longrightarrow> f y < (INF s\<in>S. f s)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3166
        by (auto simp: not_le eventually_at_left[OF \<open>s < Sup S\<close>])
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3167
      with \<open>S \<noteq> {}\<close> obtain c where "c \<in> S" "b < c"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3168
        using less_cSupD[of S b] by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3169
      with \<open>Sup S \<notin> S\<close> S have "c < Sup S"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3170
        unfolding less_le by (blast intro: cSup_upper)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3171
      from *[OF \<open>b < c\<close> \<open>c < Sup S\<close>] cINF_lower[OF bdd_below_image_antimono, of f S c] \<open>c \<in> S\<close>
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3172
      show False
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3173
        by (auto simp: assms)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3174
    qed
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3175
  qed
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3176
qed (intro cINF_greatest \<open>antimono f\<close>[THEN antimonoD] cSup_upper S)
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3177
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3178
lemma continuous_at_Inf_mono:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3179
  fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3180
    'b::{linorder_topology,conditionally_complete_linorder}"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3181
  assumes "mono f"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3182
    and cont: "continuous (at_right (Inf S)) f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3183
    and S: "S \<noteq> {}" "bdd_below S"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3184
  shows "f (Inf S) = (INF s\<in>S. f s)"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3185
proof (rule antisym)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3186
  have f: "(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3187
    using cont unfolding continuous_within .
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3188
  show "(INF s\<in>S. f s) \<le> f (Inf S)"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3189
  proof cases
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3190
    assume "Inf S \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3191
    then show ?thesis
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3192
      by (rule cINF_lower[rotated]) (auto intro: bdd_below_image_mono S \<open>mono f\<close>)
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3193
  next
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3194
    assume "Inf S \<notin> S"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3195
    from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3196
      by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3197
    with \<open>Inf S \<notin> S\<close> S have "Inf S < s"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3198
      unfolding less_le by (blast intro: cInf_lower)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3199
    show ?thesis
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3200
    proof (rule ccontr)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3201
      assume "\<not> ?thesis"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3202
      with order_tendstoD(2)[OF f, of "INF s\<in>S. f s"] obtain b where "Inf S < b"
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3203
        and *: "\<And>y. Inf S < y \<Longrightarrow> y < b \<Longrightarrow> f y < (INF s\<in>S. f s)"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3204
        by (auto simp: not_le eventually_at_right[OF \<open>Inf S < s\<close>])
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3205
      with \<open>S \<noteq> {}\<close> obtain c where "c \<in> S" "c < b"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3206
        using cInf_lessD[of S b] by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3207
      with \<open>Inf S \<notin> S\<close> S have "Inf S < c"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3208
        unfolding less_le by (blast intro: cInf_lower)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3209
      from *[OF \<open>Inf S < c\<close> \<open>c < b\<close>] cINF_lower[OF bdd_below_image_mono[of f] \<open>c \<in> S\<close>]
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3210
      show False
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3211
        by (auto simp: assms)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3212
    qed
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3213
  qed
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3214
qed (intro cINF_greatest \<open>mono f\<close>[THEN monoD] cInf_lower \<open>bdd_below S\<close> \<open>S \<noteq> {}\<close>)
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3215
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3216
lemma continuous_at_Inf_antimono:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3217
  fixes f :: "'a::{linorder_topology,conditionally_complete_linorder} \<Rightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3218
    'b::{linorder_topology,conditionally_complete_linorder}"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3219
  assumes "antimono f"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3220
    and cont: "continuous (at_right (Inf S)) f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3221
    and S: "S \<noteq> {}" "bdd_below S"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3222
  shows "f (Inf S) = (SUP s\<in>S. f s)"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3223
proof (rule antisym)
61973
0c7e865fa7cb more symbols;
wenzelm
parents: 61969
diff changeset
  3224
  have f: "(f \<longlongrightarrow> f (Inf S)) (at_right (Inf S))"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3225
    using cont unfolding continuous_within .
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3226
  show "f (Inf S) \<le> (SUP s\<in>S. f s)"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3227
  proof cases
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3228
    assume "Inf S \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3229
    then show ?thesis
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3230
      by (rule cSUP_upper) (auto intro: bdd_above_image_antimono S \<open>antimono f\<close>)
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3231
  next
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3232
    assume "Inf S \<notin> S"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3233
    from \<open>S \<noteq> {}\<close> obtain s where "s \<in> S"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3234
      by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3235
    with \<open>Inf S \<notin> S\<close> S have "Inf S < s"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3236
      unfolding less_le by (blast intro: cInf_lower)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3237
    show ?thesis
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3238
    proof (rule ccontr)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3239
      assume "\<not> ?thesis"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3240
      with order_tendstoD(1)[OF f, of "SUP s\<in>S. f s"] obtain b where "Inf S < b"
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3241
        and *: "\<And>y. Inf S < y \<Longrightarrow> y < b \<Longrightarrow> (SUP s\<in>S. f s) < f y"
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3242
        by (auto simp: not_le eventually_at_right[OF \<open>Inf S < s\<close>])
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3243
      with \<open>S \<noteq> {}\<close> obtain c where "c \<in> S" "c < b"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3244
        using cInf_lessD[of S b] by auto
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3245
      with \<open>Inf S \<notin> S\<close> S have "Inf S < c"
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3246
        unfolding less_le by (blast intro: cInf_lower)
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3247
      from *[OF \<open>Inf S < c\<close> \<open>c < b\<close>] cSUP_upper[OF \<open>c \<in> S\<close> bdd_above_image_antimono[of f]]
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3248
      show False
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3249
        by (auto simp: assms)
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3250
    qed
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3251
  qed
60758
d8d85a8172b5 isabelle update_cartouches;
wenzelm
parents: 60720
diff changeset
  3252
qed (intro cSUP_least \<open>antimono f\<close>[THEN antimonoD] cInf_lower S)
59452
2538b2c51769 ereal: tuned proofs concerning continuity and suprema
hoelzl
parents: 59106
diff changeset
  3253
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3254
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3255
subsection \<open>Uniform spaces\<close>
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3256
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  3257
class uniformity =
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3258
  fixes uniformity :: "('a \<times> 'a) filter"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3259
begin
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3260
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3261
abbreviation uniformity_on :: "'a set \<Rightarrow> ('a \<times> 'a) filter"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3262
  where "uniformity_on s \<equiv> inf uniformity (principal (s\<times>s))"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3263
51518
6a56b7088a6a separate SupInf into Conditional_Complete_Lattice, move instantiation of real to RealDef
hoelzl
parents: 51481
diff changeset
  3264
end
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3265
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  3266
lemma uniformity_Abort:
62123
df65f5c27c15 setup code generation for filters as suggested by Florian
hoelzl
parents: 62102
diff changeset
  3267
  "uniformity =
df65f5c27c15 setup code generation for filters as suggested by Florian
hoelzl
parents: 62102
diff changeset
  3268
    Filter.abstract_filter (\<lambda>u. Code.abort (STR ''uniformity is not executable'') (\<lambda>u. uniformity))"
df65f5c27c15 setup code generation for filters as suggested by Florian
hoelzl
parents: 62102
diff changeset
  3269
  by simp
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  3270
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3271
class open_uniformity = "open" + uniformity +
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3272
  assumes open_uniformity:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3273
    "\<And>U. open U \<longleftrightarrow> (\<forall>x\<in>U. eventually (\<lambda>(x', y). x' = x \<longrightarrow> y \<in> U) uniformity)"
68064
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67957
diff changeset
  3274
begin
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67957
diff changeset
  3275
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67957
diff changeset
  3276
subclass topological_space
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67957
diff changeset
  3277
  by standard (force elim: eventually_mono eventually_elim2 simp: split_beta' open_uniformity)+
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67957
diff changeset
  3278
b249fab48c76 type class generalisations; some work on infinite products
paulson <lp15@cam.ac.uk>
parents: 67957
diff changeset
  3279
end
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3280
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3281
class uniform_space = open_uniformity +
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3282
  assumes uniformity_refl: "eventually E uniformity \<Longrightarrow> E (x, x)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3283
    and uniformity_sym: "eventually E uniformity \<Longrightarrow> eventually (\<lambda>(x, y). E (y, x)) uniformity"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3284
    and uniformity_trans:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3285
      "eventually E uniformity \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3286
        \<exists>D. eventually D uniformity \<and> (\<forall>x y z. D (x, y) \<longrightarrow> D (y, z) \<longrightarrow> E (x, z))"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3287
begin
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3288
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3289
lemma uniformity_bot: "uniformity \<noteq> bot"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3290
  using uniformity_refl by auto
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3291
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3292
lemma uniformity_trans':
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3293
  "eventually E uniformity \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3294
    eventually (\<lambda>((x, y), (y', z)). y = y' \<longrightarrow> E (x, z)) (uniformity \<times>\<^sub>F uniformity)"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3295
  by (drule uniformity_trans) (auto simp add: eventually_prod_same)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3296
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3297
lemma uniformity_transE:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3298
  assumes "eventually E uniformity"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3299
  obtains D where "eventually D uniformity" "\<And>x y z. D (x, y) \<Longrightarrow> D (y, z) \<Longrightarrow> E (x, z)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3300
  using uniformity_trans [OF assms] by auto
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3301
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3302
lemma eventually_nhds_uniformity:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3303
  "eventually P (nhds x) \<longleftrightarrow> eventually (\<lambda>(x', y). x' = x \<longrightarrow> P y) uniformity"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3304
  (is "_ \<longleftrightarrow> ?N P x")
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3305
  unfolding eventually_nhds
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3306
proof safe
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3307
  assume *: "?N P x"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3308
  have "?N (?N P) x" if "?N P x" for x
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3309
  proof -
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3310
    from that obtain D where ev: "eventually D uniformity"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3311
      and D: "D (a, b) \<Longrightarrow> D (b, c) \<Longrightarrow> case (a, c) of (x', y) \<Rightarrow> x' = x \<longrightarrow> P y" for a b c
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3312
      by (rule uniformity_transE) simp
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3313
    from ev show ?thesis
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3314
      by eventually_elim (insert ev D, force elim: eventually_mono split: prod.split)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3315
  qed
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3316
  then have "open {x. ?N P x}"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3317
    by (simp add: open_uniformity)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3318
  then show "\<exists>S. open S \<and> x \<in> S \<and> (\<forall>x\<in>S. P x)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3319
    by (intro exI[of _ "{x. ?N P x}"]) (auto dest: uniformity_refl simp: *)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3320
qed (force simp add: open_uniformity elim: eventually_mono)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3321
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3322
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3323
subsubsection \<open>Totally bounded sets\<close>
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3324
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3325
definition totally_bounded :: "'a set \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3326
  where "totally_bounded S \<longleftrightarrow>
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3327
    (\<forall>E. eventually E uniformity \<longrightarrow> (\<exists>X. finite X \<and> (\<forall>s\<in>S. \<exists>x\<in>X. E (x, s))))"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3328
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3329
lemma totally_bounded_empty[iff]: "totally_bounded {}"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3330
  by (auto simp add: totally_bounded_def)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3331
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3332
lemma totally_bounded_subset: "totally_bounded S \<Longrightarrow> T \<subseteq> S \<Longrightarrow> totally_bounded T"
63171
a0088f1c049d tuned proofs;
wenzelm
parents: 63170
diff changeset
  3333
  by (fastforce simp add: totally_bounded_def)
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3334
62102
877463945ce9 fix code generation for uniformity: uniformity is a non-computable pure data.
hoelzl
parents: 62101
diff changeset
  3335
lemma totally_bounded_Union[intro]:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3336
  assumes M: "finite M" "\<And>S. S \<in> M \<Longrightarrow> totally_bounded S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3337
  shows "totally_bounded (\<Union>M)"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3338
  unfolding totally_bounded_def
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3339
proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3340
  fix E
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3341
  assume "eventually E uniformity"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3342
  with M obtain X where "\<forall>S\<in>M. finite (X S) \<and> (\<forall>s\<in>S. \<exists>x\<in>X S. E (x, s))"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3343
    by (metis totally_bounded_def)
62175
8ffc4d0e652d isabelle update_cartouches -c -t;
wenzelm
parents: 62123
diff changeset
  3344
  with \<open>finite M\<close> show "\<exists>X. finite X \<and> (\<forall>s\<in>\<Union>M. \<exists>x\<in>X. E (x, s))"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3345
    by (intro exI[of _ "\<Union>S\<in>M. X S"]) force
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3346
qed
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3347
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3348
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3349
subsubsection \<open>Cauchy filter\<close>
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3350
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3351
definition cauchy_filter :: "'a filter \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3352
  where "cauchy_filter F \<longleftrightarrow> F \<times>\<^sub>F F \<le> uniformity"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3353
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3354
definition Cauchy :: "(nat \<Rightarrow> 'a) \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3355
  where Cauchy_uniform: "Cauchy X = cauchy_filter (filtermap X sequentially)"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3356
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3357
lemma Cauchy_uniform_iff:
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3358
  "Cauchy X \<longleftrightarrow> (\<forall>P. eventually P uniformity \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. P (X n, X m)))"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3359
  unfolding Cauchy_uniform cauchy_filter_def le_filter_def eventually_prod_same
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3360
    eventually_filtermap eventually_sequentially
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3361
proof safe
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3362
  let ?U = "\<lambda>P. eventually P uniformity"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3363
  {
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3364
    fix P
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3365
    assume "?U P" "\<forall>P. ?U P \<longrightarrow> (\<exists>Q. (\<exists>N. \<forall>n\<ge>N. Q (X n)) \<and> (\<forall>x y. Q x \<longrightarrow> Q y \<longrightarrow> P (x, y)))"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3366
    then obtain Q N where "\<And>n. n \<ge> N \<Longrightarrow> Q (X n)" "\<And>x y. Q x \<Longrightarrow> Q y \<Longrightarrow> P (x, y)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3367
      by metis
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3368
    then show "\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. P (X n, X m)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3369
      by blast
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3370
  next
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3371
    fix P
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3372
    assume "?U P" and P: "\<forall>P. ?U P \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. \<forall>m\<ge>N. P (X n, X m))"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3373
    then obtain Q where "?U Q" and Q: "\<And>x y z. Q (x, y) \<Longrightarrow> Q (y, z) \<Longrightarrow> P (x, z)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3374
      by (auto elim: uniformity_transE)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3375
    then have "?U (\<lambda>x. Q x \<and> (\<lambda>(x, y). Q (y, x)) x)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3376
      unfolding eventually_conj_iff by (simp add: uniformity_sym)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3377
    from P[rule_format, OF this]
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3378
    obtain N where N: "\<And>n m. n \<ge> N \<Longrightarrow> m \<ge> N \<Longrightarrow> Q (X n, X m) \<and> Q (X m, X n)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3379
      by auto
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3380
    show "\<exists>Q. (\<exists>N. \<forall>n\<ge>N. Q (X n)) \<and> (\<forall>x y. Q x \<longrightarrow> Q y \<longrightarrow> P (x, y))"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3381
    proof (safe intro!: exI[of _ "\<lambda>x. \<forall>n\<ge>N. Q (x, X n) \<and> Q (X n, x)"] exI[of _ N] N)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3382
      fix x y
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3383
      assume "\<forall>n\<ge>N. Q (x, X n) \<and> Q (X n, x)" "\<forall>n\<ge>N. Q (y, X n) \<and> Q (X n, y)"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3384
      then have "Q (x, X N)" "Q (X N, y)" by auto
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3385
      then show "P (x, y)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3386
        by (rule Q)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3387
    qed
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3388
  }
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3389
qed
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3390
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3391
lemma nhds_imp_cauchy_filter:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3392
  assumes *: "F \<le> nhds x"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3393
  shows "cauchy_filter F"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3394
proof -
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3395
  have "F \<times>\<^sub>F F \<le> nhds x \<times>\<^sub>F nhds x"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3396
    by (intro prod_filter_mono *)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3397
  also have "\<dots> \<le> uniformity"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3398
    unfolding le_filter_def eventually_nhds_uniformity eventually_prod_same
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3399
  proof safe
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3400
    fix P
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3401
    assume "eventually P uniformity"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3402
    then obtain Ql where ev: "eventually Ql uniformity"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3403
      and "Ql (x, y) \<Longrightarrow> Ql (y, z) \<Longrightarrow> P (x, z)" for x y z
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3404
      by (rule uniformity_transE) simp
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3405
    with ev[THEN uniformity_sym]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3406
    show "\<exists>Q. eventually (\<lambda>(x', y). x' = x \<longrightarrow> Q y) uniformity \<and>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3407
        (\<forall>x y. Q x \<longrightarrow> Q y \<longrightarrow> P (x, y))"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3408
      by (rule_tac exI[of _ "\<lambda>y. Ql (y, x) \<and> Ql (x, y)"]) (fastforce elim: eventually_elim2)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3409
  qed
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3410
  finally show ?thesis
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3411
    by (simp add: cauchy_filter_def)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3412
qed
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3413
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3414
lemma LIMSEQ_imp_Cauchy: "X \<longlonglongrightarrow> x \<Longrightarrow> Cauchy X"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3415
  unfolding Cauchy_uniform filterlim_def by (intro nhds_imp_cauchy_filter)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3416
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3417
lemma Cauchy_subseq_Cauchy:
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  3418
  assumes "Cauchy X" "strict_mono f"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3419
  shows "Cauchy (X \<circ> f)"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3420
  unfolding Cauchy_uniform comp_def filtermap_filtermap[symmetric] cauchy_filter_def
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3421
  by (rule order_trans[OF _ \<open>Cauchy X\<close>[unfolded Cauchy_uniform cauchy_filter_def]])
66447
a1f5c5c26fa6 Replaced subseq with strict_mono
eberlm <eberlm@in.tum.de>
parents: 66162
diff changeset
  3422
     (intro prod_filter_mono filtermap_mono filterlim_subseq[OF \<open>strict_mono f\<close>, unfolded filterlim_def])
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3423
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3424
lemma convergent_Cauchy: "convergent X \<Longrightarrow> Cauchy X"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3425
  unfolding convergent_def by (erule exE, erule LIMSEQ_imp_Cauchy)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3426
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3427
definition complete :: "'a set \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3428
  where complete_uniform: "complete S \<longleftrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3429
    (\<forall>F \<le> principal S. F \<noteq> bot \<longrightarrow> cauchy_filter F \<longrightarrow> (\<exists>x\<in>S. F \<le> nhds x))"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3430
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3431
end
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3432
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3433
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3434
subsubsection \<open>Uniformly continuous functions\<close>
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3435
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3436
definition uniformly_continuous_on :: "'a set \<Rightarrow> ('a::uniform_space \<Rightarrow> 'b::uniform_space) \<Rightarrow> bool"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3437
  where uniformly_continuous_on_uniformity: "uniformly_continuous_on s f \<longleftrightarrow>
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3438
    (LIM (x, y) (uniformity_on s). (f x, f y) :> uniformity)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3439
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3440
lemma uniformly_continuous_onD:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3441
  "uniformly_continuous_on s f \<Longrightarrow> eventually E uniformity \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3442
    eventually (\<lambda>(x, y). x \<in> s \<longrightarrow> y \<in> s \<longrightarrow> E (f x, f y)) uniformity"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3443
  by (simp add: uniformly_continuous_on_uniformity filterlim_iff
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3444
      eventually_inf_principal split_beta' mem_Times_iff imp_conjL)
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3445
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3446
lemma uniformly_continuous_on_const[continuous_intros]: "uniformly_continuous_on s (\<lambda>x. c)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3447
  by (auto simp: uniformly_continuous_on_uniformity filterlim_iff uniformity_refl)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3448
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3449
lemma uniformly_continuous_on_id[continuous_intros]: "uniformly_continuous_on s (\<lambda>x. x)"
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3450
  by (auto simp: uniformly_continuous_on_uniformity filterlim_def)
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3451
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3452
lemma uniformly_continuous_on_compose[continuous_intros]:
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3453
  "uniformly_continuous_on s g \<Longrightarrow> uniformly_continuous_on (g`s) f \<Longrightarrow>
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3454
    uniformly_continuous_on s (\<lambda>x. f (g x))"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3455
  using filterlim_compose[of "\<lambda>(x, y). (f x, f y)" uniformity
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3456
      "uniformity_on (g`s)"  "\<lambda>(x, y). (g x, g y)" "uniformity_on s"]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3457
  by (simp add: split_beta' uniformly_continuous_on_uniformity
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3458
      filterlim_inf filterlim_principal eventually_inf_principal mem_Times_iff)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3459
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3460
lemma uniformly_continuous_imp_continuous:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3461
  assumes f: "uniformly_continuous_on s f"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3462
  shows "continuous_on s f"
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3463
  by (auto simp: filterlim_iff eventually_at_filter eventually_nhds_uniformity continuous_on_def
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3464
           elim: eventually_mono dest!: uniformly_continuous_onD[OF f])
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3465
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3466
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3467
section \<open>Product Topology\<close>
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3468
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3469
subsection \<open>Product is a topological space\<close>
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3470
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3471
instantiation prod :: (topological_space, topological_space) topological_space
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3472
begin
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3473
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3474
definition open_prod_def[code del]:
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3475
  "open (S :: ('a \<times> 'b) set) \<longleftrightarrow>
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3476
    (\<forall>x\<in>S. \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S)"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3477
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3478
lemma open_prod_elim:
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3479
  assumes "open S" and "x \<in> S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3480
  obtains A B where "open A" and "open B" and "x \<in> A \<times> B" and "A \<times> B \<subseteq> S"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3481
  using assms unfolding open_prod_def by fast
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3482
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3483
lemma open_prod_intro:
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3484
  assumes "\<And>x. x \<in> S \<Longrightarrow> \<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3485
  shows "open S"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3486
  using assms unfolding open_prod_def by fast
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3487
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3488
instance
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3489
proof
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3490
  show "open (UNIV :: ('a \<times> 'b) set)"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3491
    unfolding open_prod_def by auto
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3492
next
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3493
  fix S T :: "('a \<times> 'b) set"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3494
  assume "open S" "open T"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3495
  show "open (S \<inter> T)"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3496
  proof (rule open_prod_intro)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3497
    fix x
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3498
    assume x: "x \<in> S \<inter> T"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3499
    from x have "x \<in> S" by simp
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3500
    obtain Sa Sb where A: "open Sa" "open Sb" "x \<in> Sa \<times> Sb" "Sa \<times> Sb \<subseteq> S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3501
      using \<open>open S\<close> and \<open>x \<in> S\<close> by (rule open_prod_elim)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3502
    from x have "x \<in> T" by simp
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3503
    obtain Ta Tb where B: "open Ta" "open Tb" "x \<in> Ta \<times> Tb" "Ta \<times> Tb \<subseteq> T"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3504
      using \<open>open T\<close> and \<open>x \<in> T\<close> by (rule open_prod_elim)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3505
    let ?A = "Sa \<inter> Ta" and ?B = "Sb \<inter> Tb"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3506
    have "open ?A \<and> open ?B \<and> x \<in> ?A \<times> ?B \<and> ?A \<times> ?B \<subseteq> S \<inter> T"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3507
      using A B by (auto simp add: open_Int)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3508
    then show "\<exists>A B. open A \<and> open B \<and> x \<in> A \<times> B \<and> A \<times> B \<subseteq> S \<inter> T"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3509
      by fast
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3510
  qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3511
next
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3512
  fix K :: "('a \<times> 'b) set set"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3513
  assume "\<forall>S\<in>K. open S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3514
  then show "open (\<Union>K)"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3515
    unfolding open_prod_def by fast
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3516
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3517
62101
26c0a70f78a3 add uniform spaces
hoelzl
parents: 62083
diff changeset
  3518
end
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3519
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3520
declare [[code abort: "open :: ('a::topological_space \<times> 'b::topological_space) set \<Rightarrow> bool"]]
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3521
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3522
lemma open_Times: "open S \<Longrightarrow> open T \<Longrightarrow> open (S \<times> T)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3523
  unfolding open_prod_def by auto
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3524
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3525
lemma fst_vimage_eq_Times: "fst -` S = S \<times> UNIV"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3526
  by auto
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3527
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3528
lemma snd_vimage_eq_Times: "snd -` S = UNIV \<times> S"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3529
  by auto
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3530
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3531
lemma open_vimage_fst: "open S \<Longrightarrow> open (fst -` S)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3532
  by (simp add: fst_vimage_eq_Times open_Times)
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3533
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3534
lemma open_vimage_snd: "open S \<Longrightarrow> open (snd -` S)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3535
  by (simp add: snd_vimage_eq_Times open_Times)
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3536
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3537
lemma closed_vimage_fst: "closed S \<Longrightarrow> closed (fst -` S)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3538
  unfolding closed_open vimage_Compl [symmetric]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3539
  by (rule open_vimage_fst)
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3540
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3541
lemma closed_vimage_snd: "closed S \<Longrightarrow> closed (snd -` S)"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3542
  unfolding closed_open vimage_Compl [symmetric]
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3543
  by (rule open_vimage_snd)
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3544
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3545
lemma closed_Times: "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3546
proof -
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3547
  have "S \<times> T = (fst -` S) \<inter> (snd -` T)"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3548
    by auto
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3549
  then show "closed S \<Longrightarrow> closed T \<Longrightarrow> closed (S \<times> T)"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3550
    by (simp add: closed_vimage_fst closed_vimage_snd closed_Int)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3551
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3552
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3553
lemma subset_fst_imageI: "A \<times> B \<subseteq> S \<Longrightarrow> y \<in> B \<Longrightarrow> A \<subseteq> fst ` S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3554
  unfolding image_def subset_eq by force
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3555
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3556
lemma subset_snd_imageI: "A \<times> B \<subseteq> S \<Longrightarrow> x \<in> A \<Longrightarrow> B \<subseteq> snd ` S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3557
  unfolding image_def subset_eq by force
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3558
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3559
lemma open_image_fst:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3560
  assumes "open S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3561
  shows "open (fst ` S)"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3562
proof (rule openI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3563
  fix x
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3564
  assume "x \<in> fst ` S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3565
  then obtain y where "(x, y) \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3566
    by auto
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3567
  then obtain A B where "open A" "open B" "x \<in> A" "y \<in> B" "A \<times> B \<subseteq> S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3568
    using \<open>open S\<close> unfolding open_prod_def by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3569
  from \<open>A \<times> B \<subseteq> S\<close> \<open>y \<in> B\<close> have "A \<subseteq> fst ` S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3570
    by (rule subset_fst_imageI)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3571
  with \<open>open A\<close> \<open>x \<in> A\<close> have "open A \<and> x \<in> A \<and> A \<subseteq> fst ` S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3572
    by simp
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3573
  then show "\<exists>T. open T \<and> x \<in> T \<and> T \<subseteq> fst ` S" ..
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3574
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3575
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3576
lemma open_image_snd:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3577
  assumes "open S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3578
  shows "open (snd ` S)"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3579
proof (rule openI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3580
  fix y
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3581
  assume "y \<in> snd ` S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3582
  then obtain x where "(x, y) \<in> S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3583
    by auto
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3584
  then obtain A B where "open A" "open B" "x \<in> A" "y \<in> B" "A \<times> B \<subseteq> S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3585
    using \<open>open S\<close> unfolding open_prod_def by auto
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3586
  from \<open>A \<times> B \<subseteq> S\<close> \<open>x \<in> A\<close> have "B \<subseteq> snd ` S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3587
    by (rule subset_snd_imageI)
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3588
  with \<open>open B\<close> \<open>y \<in> B\<close> have "open B \<and> y \<in> B \<and> B \<subseteq> snd ` S"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3589
    by simp
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3590
  then show "\<exists>T. open T \<and> y \<in> T \<and> T \<subseteq> snd ` S" ..
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3591
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3592
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3593
lemma nhds_prod: "nhds (a, b) = nhds a \<times>\<^sub>F nhds b"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3594
  unfolding nhds_def
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3595
proof (subst prod_filter_INF, auto intro!: antisym INF_greatest simp: principal_prod_principal)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3596
  fix S T
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3597
  assume "open S" "a \<in> S" "open T" "b \<in> T"
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3598
  then show "(INF x \<in> {S. open S \<and> (a, b) \<in> S}. principal x) \<le> principal (S \<times> T)"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3599
    by (intro INF_lower) (auto intro!: open_Times)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3600
next
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3601
  fix S'
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3602
  assume "open S'" "(a, b) \<in> S'"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3603
  then obtain S T where "open S" "a \<in> S" "open T" "b \<in> T" "S \<times> T \<subseteq> S'"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3604
    by (auto elim: open_prod_elim)
69260
0a9688695a1b removed relics of ASCII syntax for indexed big operators
haftmann
parents: 69164
diff changeset
  3605
  then show "(INF x \<in> {S. open S \<and> a \<in> S}. INF y \<in> {S. open S \<and> b \<in> S}.
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3606
      principal (x \<times> y)) \<le> principal S'"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3607
    by (auto intro!: INF_lower2)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3608
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3609
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3610
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3611
subsubsection \<open>Continuity of operations\<close>
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3612
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3613
lemma tendsto_fst [tendsto_intros]:
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3614
  assumes "(f \<longlongrightarrow> a) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3615
  shows "((\<lambda>x. fst (f x)) \<longlongrightarrow> fst a) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3616
proof (rule topological_tendstoI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3617
  fix S
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3618
  assume "open S" and "fst a \<in> S"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3619
  then have "open (fst -` S)" and "a \<in> fst -` S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3620
    by (simp_all add: open_vimage_fst)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3621
  with assms have "eventually (\<lambda>x. f x \<in> fst -` S) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3622
    by (rule topological_tendstoD)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3623
  then show "eventually (\<lambda>x. fst (f x) \<in> S) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3624
    by simp
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3625
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3626
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3627
lemma tendsto_snd [tendsto_intros]:
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3628
  assumes "(f \<longlongrightarrow> a) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3629
  shows "((\<lambda>x. snd (f x)) \<longlongrightarrow> snd a) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3630
proof (rule topological_tendstoI)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3631
  fix S
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3632
  assume "open S" and "snd a \<in> S"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3633
  then have "open (snd -` S)" and "a \<in> snd -` S"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3634
    by (simp_all add: open_vimage_snd)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3635
  with assms have "eventually (\<lambda>x. f x \<in> snd -` S) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3636
    by (rule topological_tendstoD)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3637
  then show "eventually (\<lambda>x. snd (f x) \<in> S) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3638
    by simp
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3639
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3640
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3641
lemma tendsto_Pair [tendsto_intros]:
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3642
  assumes "(f \<longlongrightarrow> a) F" and "(g \<longlongrightarrow> b) F"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3643
  shows "((\<lambda>x. (f x, g x)) \<longlongrightarrow> (a, b)) F"
67957
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3644
  unfolding nhds_prod using assms by (rule filterlim_Pair)
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3645
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3646
lemma continuous_fst[continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. fst (f x))"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3647
  unfolding continuous_def by (rule tendsto_fst)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3648
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3649
lemma continuous_snd[continuous_intros]: "continuous F f \<Longrightarrow> continuous F (\<lambda>x. snd (f x))"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3650
  unfolding continuous_def by (rule tendsto_snd)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3651
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3652
lemma continuous_Pair[continuous_intros]:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3653
  "continuous F f \<Longrightarrow> continuous F g \<Longrightarrow> continuous F (\<lambda>x. (f x, g x))"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3654
  unfolding continuous_def by (rule tendsto_Pair)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3655
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3656
lemma continuous_on_fst[continuous_intros]:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3657
  "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. fst (f x))"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3658
  unfolding continuous_on_def by (auto intro: tendsto_fst)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3659
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3660
lemma continuous_on_snd[continuous_intros]:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3661
  "continuous_on s f \<Longrightarrow> continuous_on s (\<lambda>x. snd (f x))"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3662
  unfolding continuous_on_def by (auto intro: tendsto_snd)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3663
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3664
lemma continuous_on_Pair[continuous_intros]:
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3665
  "continuous_on s f \<Longrightarrow> continuous_on s g \<Longrightarrow> continuous_on s (\<lambda>x. (f x, g x))"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3666
  unfolding continuous_on_def by (auto intro: tendsto_Pair)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3667
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3668
lemma continuous_on_swap[continuous_intros]: "continuous_on A prod.swap"
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3669
  by (simp add: prod.swap_def continuous_on_fst continuous_on_snd
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3670
      continuous_on_Pair continuous_on_id)
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3671
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3672
lemma continuous_on_swap_args:
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3673
  assumes "continuous_on (A\<times>B) (\<lambda>(x,y). d x y)"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3674
    shows "continuous_on (B\<times>A) (\<lambda>(x,y). d y x)"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3675
proof -
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3676
  have "(\<lambda>(x,y). d y x) = (\<lambda>(x,y). d x y) \<circ> prod.swap"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3677
    by force
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3678
  then show ?thesis
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
  3679
    by (metis assms continuous_on_compose continuous_on_swap product_swap)
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3680
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3681
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3682
lemma isCont_fst [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. fst (f x)) a"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3683
  by (fact continuous_fst)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3684
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3685
lemma isCont_snd [simp]: "isCont f a \<Longrightarrow> isCont (\<lambda>x. snd (f x)) a"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3686
  by (fact continuous_snd)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3687
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3688
lemma isCont_Pair [simp]: "\<lbrakk>isCont f a; isCont g a\<rbrakk> \<Longrightarrow> isCont (\<lambda>x. (f x, g x)) a"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3689
  by (fact continuous_Pair)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3690
67685
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3691
lemma continuous_on_compose_Pair:
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3692
  assumes f: "continuous_on (Sigma A B) (\<lambda>(a, b). f a b)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3693
  assumes g: "continuous_on C g"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3694
  assumes h: "continuous_on C h"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3695
  assumes subset: "\<And>c. c \<in> C \<Longrightarrow> g c \<in> A" "\<And>c. c \<in> C \<Longrightarrow> h c \<in> B (g c)"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3696
  shows "continuous_on C (\<lambda>c. f (g c) (h c))"
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3697
  using continuous_on_compose2[OF f continuous_on_Pair[OF g h]] subset
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3698
  by auto
bdff8bf0a75b moved theorems from AFP/Affine_Arithmetic and AFP/Ordinary_Differential_Equations
immler
parents: 67577
diff changeset
  3699
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3700
67577
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3701
subsubsection \<open>Connectedness of products\<close>
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3702
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3703
proposition connected_Times:
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3704
  assumes S: "connected S" and T: "connected T"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3705
  shows "connected (S \<times> T)"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3706
proof (rule connectedI_const)
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3707
  fix P::"'a \<times> 'b \<Rightarrow> bool"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3708
  assume P[THEN continuous_on_compose2, continuous_intros]: "continuous_on (S \<times> T) P"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3709
  have "continuous_on S (\<lambda>s. P (s, t))" if "t \<in> T" for t
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3710
    by (auto intro!: continuous_intros that)
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3711
  from connectedD_const[OF S this]
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3712
  obtain c1 where c1: "\<And>s t. t \<in> T \<Longrightarrow> s \<in> S \<Longrightarrow> P (s, t) = c1 t"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3713
    by metis
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3714
  moreover
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3715
  have "continuous_on T (\<lambda>t. P (s, t))" if "s \<in> S" for s
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3716
    by (auto intro!: continuous_intros that)
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3717
  from connectedD_const[OF T this]
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3718
  obtain c2 where "\<And>s t. t \<in> T \<Longrightarrow> s \<in> S \<Longrightarrow> P (s, t) = c2 s"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3719
    by metis
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3720
  ultimately show "\<exists>c. \<forall>s\<in>S \<times> T. P s = c"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3721
    by auto
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3722
qed
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3723
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3724
corollary connected_Times_eq [simp]:
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3725
   "connected (S \<times> T) \<longleftrightarrow> S = {} \<or> T = {} \<or> connected S \<and> connected T"  (is "?lhs = ?rhs")
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3726
proof
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3727
  assume L: ?lhs
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3728
  show ?rhs
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3729
  proof cases
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3730
    assume "S \<noteq> {} \<and> T \<noteq> {}"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3731
    moreover
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3732
    have "connected (fst ` (S \<times> T))" "connected (snd ` (S \<times> T))"
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3733
      using continuous_on_fst continuous_on_snd continuous_on_id
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3734
      by (blast intro: connected_continuous_image [OF _ L])+
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3735
    ultimately show ?thesis
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3736
      by auto
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3737
  qed auto
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3738
qed (auto simp: connected_Times)
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3739
0ac53b666228 more elementary proof of connected_Times, earlier
immler
parents: 67454
diff changeset
  3740
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3741
subsubsection \<open>Separation axioms\<close>
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3742
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3743
instance prod :: (t0_space, t0_space) t0_space
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3744
proof
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3745
  fix x y :: "'a \<times> 'b"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3746
  assume "x \<noteq> y"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3747
  then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3748
    by (simp add: prod_eq_iff)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3749
  then show "\<exists>U. open U \<and> (x \<in> U) \<noteq> (y \<in> U)"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3750
    by (fast dest: t0_space elim: open_vimage_fst open_vimage_snd)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3751
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3752
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3753
instance prod :: (t1_space, t1_space) t1_space
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3754
proof
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3755
  fix x y :: "'a \<times> 'b"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3756
  assume "x \<noteq> y"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3757
  then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3758
    by (simp add: prod_eq_iff)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3759
  then show "\<exists>U. open U \<and> x \<in> U \<and> y \<notin> U"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3760
    by (fast dest: t1_space elim: open_vimage_fst open_vimage_snd)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3761
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3762
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3763
instance prod :: (t2_space, t2_space) t2_space
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3764
proof
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3765
  fix x y :: "'a \<times> 'b"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3766
  assume "x \<noteq> y"
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3767
  then have "fst x \<noteq> fst y \<or> snd x \<noteq> snd y"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3768
    by (simp add: prod_eq_iff)
63494
ac0a3b9c6dae misc tuning and modernization;
wenzelm
parents: 63332
diff changeset
  3769
  then show "\<exists>U V. open U \<and> open V \<and> x \<in> U \<and> y \<in> V \<and> U \<inter> V = {}"
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3770
    by (fast dest: hausdorff elim: open_vimage_fst open_vimage_snd)
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3771
qed
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3772
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3773
lemma isCont_swap[continuous_intros]: "isCont prod.swap a"
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3774
  using continuous_on_eq_continuous_within continuous_on_swap by blast
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3775
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3776
lemma open_diagonal_complement:
67957
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3777
  "open {(x,y) |x y. x \<noteq> (y::('a::t2_space))}"
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3778
proof -
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3779
  have "open {(x, y). x \<noteq> (y::'a)}"
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3780
    unfolding split_def by (intro open_Collect_neq continuous_intros)
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3781
  also have "{(x, y). x \<noteq> (y::'a)} = {(x, y) |x y. x \<noteq> (y::'a)}"
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3782
    by auto
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3783
  finally show ?thesis .
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3784
qed
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3785
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3786
lemma closed_diagonal:
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3787
  "closed {y. \<exists> x::('a::t2_space). y = (x,x)}"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3788
proof -
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3789
  have "{y. \<exists> x::'a. y = (x,x)} = UNIV - {(x,y) | x y. x \<noteq> y}" by auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3790
  then show ?thesis using open_diagonal_complement closed_Diff by auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3791
qed
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3792
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3793
lemma open_superdiagonal:
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3794
  "open {(x,y) | x y. x > (y::'a::{linorder_topology})}"
67957
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3795
proof -
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3796
  have "open {(x, y). x > (y::'a)}"
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3797
    unfolding split_def by (intro open_Collect_less continuous_intros)
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3798
  also have "{(x, y). x > (y::'a)} = {(x, y) |x y. x > (y::'a)}"
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3799
    by auto
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3800
  finally show ?thesis .
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3801
qed
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3802
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3803
lemma closed_subdiagonal:
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3804
  "closed {(x,y) | x y. x \<le> (y::'a::{linorder_topology})}"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3805
proof -
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3806
  have "{(x,y) | x y. x \<le> (y::'a)} = UNIV - {(x,y) | x y. x > (y::'a)}" by auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3807
  then show ?thesis using open_superdiagonal closed_Diff by auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3808
qed
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3809
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3810
lemma open_subdiagonal:
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3811
  "open {(x,y) | x y. x < (y::'a::{linorder_topology})}"
67957
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3812
proof -
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3813
  have "open {(x, y). x < (y::'a)}"
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3814
    unfolding split_def by (intro open_Collect_less continuous_intros)
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3815
  also have "{(x, y). x < (y::'a)} = {(x, y) |x y. x < (y::'a)}"
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3816
    by auto
55f00429da84 tuned some proofs
huffman
parents: 67950
diff changeset
  3817
  finally show ?thesis .
64284
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3818
qed
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3819
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3820
lemma closed_superdiagonal:
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3821
  "closed {(x,y) | x y. x \<ge> (y::('a::{linorder_topology}))}"
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3822
proof -
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3823
  have "{(x,y) | x y. x \<ge> (y::'a)} = UNIV - {(x,y) | x y. x < y}" by auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3824
  then show ?thesis using open_subdiagonal closed_Diff by auto
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3825
qed
f3b905b2eee2 HOL-Analysis: more theorems from Sébastien Gouëzel's Ergodic_Theory
hoelzl
parents: 64283
diff changeset
  3826
62367
d2bc8a7e5fec move product topology to HOL-Complex_Main
hoelzl
parents: 62343
diff changeset
  3827
end