src/HOL/Multivariate_Analysis/Extended_Real_Limits.thy
author hoelzl
Fri, 25 Sep 2015 16:54:31 +0200
changeset 61245 b77bf45efe21
parent 61169 4de9ff3ea29a
child 61560 7c985fd653c5
permissions -rw-r--r--
prove Liminf_inverse_ereal
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41983
2dc6e382a58b standardized headers;
wenzelm
parents: 41981
diff changeset
     1
(*  Title:      HOL/Multivariate_Analysis/Extended_Real_Limits.thy
2dc6e382a58b standardized headers;
wenzelm
parents: 41981
diff changeset
     2
    Author:     Johannes Hölzl, TU München
2dc6e382a58b standardized headers;
wenzelm
parents: 41981
diff changeset
     3
    Author:     Robert Himmelmann, TU München
2dc6e382a58b standardized headers;
wenzelm
parents: 41981
diff changeset
     4
    Author:     Armin Heller, TU München
2dc6e382a58b standardized headers;
wenzelm
parents: 41981
diff changeset
     5
    Author:     Bogdan Grechuk, University of Edinburgh
2dc6e382a58b standardized headers;
wenzelm
parents: 41981
diff changeset
     6
*)
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
     7
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
     8
section \<open>Limits on the Extended real number line\<close>
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
     9
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
    10
theory Extended_Real_Limits
57446
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
    11
  imports Topology_Euclidean_Space "~~/src/HOL/Library/Extended_Real" "~~/src/HOL/Library/Indicator_Function"
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
    12
begin
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
    13
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    14
lemma compact_UNIV:
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    15
  "compact (UNIV :: 'a::{complete_linorder,linorder_topology,second_countable_topology} set)"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    16
  using compact_complete_linorder
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    17
  by (auto simp: seq_compact_eq_compact[symmetric] seq_compact_def)
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    18
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    19
lemma compact_eq_closed:
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    20
  fixes S :: "'a::{complete_linorder,linorder_topology,second_countable_topology} set"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    21
  shows "compact S \<longleftrightarrow> closed S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    22
  using closed_inter_compact[of S, OF _ compact_UNIV] compact_imp_closed
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    23
  by auto
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    24
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    25
lemma closed_contains_Sup_cl:
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    26
  fixes S :: "'a::{complete_linorder,linorder_topology,second_countable_topology} set"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    27
  assumes "closed S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    28
    and "S \<noteq> {}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    29
  shows "Sup S \<in> S"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    30
proof -
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    31
  from compact_eq_closed[of S] compact_attains_sup[of S] assms
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    32
  obtain s where S: "s \<in> S" "\<forall>t\<in>S. t \<le> s"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    33
    by auto
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51641
diff changeset
    34
  then have "Sup S = s"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    35
    by (auto intro!: Sup_eqI)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51641
diff changeset
    36
  with S show ?thesis
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    37
    by simp
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    38
qed
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    39
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    40
lemma closed_contains_Inf_cl:
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    41
  fixes S :: "'a::{complete_linorder,linorder_topology,second_countable_topology} set"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    42
  assumes "closed S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    43
    and "S \<noteq> {}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    44
  shows "Inf S \<in> S"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    45
proof -
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    46
  from compact_eq_closed[of S] compact_attains_inf[of S] assms
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    47
  obtain s where S: "s \<in> S" "\<forall>t\<in>S. s \<le> t"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    48
    by auto
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51641
diff changeset
    49
  then have "Inf S = s"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    50
    by (auto intro!: Inf_eqI)
53374
a14d2a854c02 tuned proofs -- clarified flow of facts wrt. calculation;
wenzelm
parents: 51641
diff changeset
    51
  with S show ?thesis
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    52
    by simp
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    53
qed
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    54
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    55
instance ereal :: second_countable_topology
61169
4de9ff3ea29a tuned proofs -- less legacy;
wenzelm
parents: 60771
diff changeset
    56
proof (standard, intro exI conjI)
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    57
  let ?B = "(\<Union>r\<in>\<rat>. {{..< r}, {r <..}} :: ereal set set)"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    58
  show "countable ?B"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    59
    by (auto intro: countable_rat)
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    60
  show "open = generate_topology ?B"
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    61
  proof (intro ext iffI)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    62
    fix S :: "ereal set"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    63
    assume "open S"
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    64
    then show "generate_topology ?B S"
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    65
      unfolding open_generated_order
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    66
    proof induct
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    67
      case (Basis b)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    68
      then obtain e where "b = {..<e} \<or> b = {e<..}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    69
        by auto
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    70
      moreover have "{..<e} = \<Union>{{..<x}|x. x \<in> \<rat> \<and> x < e}" "{e<..} = \<Union>{{x<..}|x. x \<in> \<rat> \<and> e < x}"
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    71
        by (auto dest: ereal_dense3
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    72
                 simp del: ex_simps
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    73
                 simp add: ex_simps[symmetric] conj_commute Rats_def image_iff)
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    74
      ultimately show ?case
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    75
        by (auto intro: generate_topology.intros)
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    76
    qed (auto intro: generate_topology.intros)
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    77
  next
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    78
    fix S
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    79
    assume "generate_topology ?B S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    80
    then show "open S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    81
      by induct auto
51351
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    82
  qed
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    83
qed
dd1dd470690b generalized lemmas in Extended_Real_Limits
hoelzl
parents: 51340
diff changeset
    84
43920
cedb5cb948fd Rename extreal => ereal
hoelzl
parents: 42950
diff changeset
    85
lemma ereal_open_closed_aux:
cedb5cb948fd Rename extreal => ereal
hoelzl
parents: 42950
diff changeset
    86
  fixes S :: "ereal set"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    87
  assumes "open S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    88
    and "closed S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    89
    and S: "(-\<infinity>) \<notin> S"
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
    90
  shows "S = {}"
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
    91
proof (rule ccontr)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    92
  assume "\<not> ?thesis"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    93
  then have *: "Inf S \<in> S"
60771
8558e4a37b48 reorganized Extended_Real
hoelzl
parents: 60420
diff changeset
    94
    
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    95
    by (metis assms(2) closed_contains_Inf_cl)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    96
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    97
    assume "Inf S = -\<infinity>"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    98
    then have False
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
    99
      using * assms(3) by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   100
  }
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   101
  moreover
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   102
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   103
    assume "Inf S = \<infinity>"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   104
    then have "S = {\<infinity>}"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
   105
      by (metis Inf_eq_PInfty \<open>S \<noteq> {}\<close>)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   106
    then have False
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   107
      by (metis assms(1) not_open_singleton)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   108
  }
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   109
  moreover
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   110
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   111
    assume fin: "\<bar>Inf S\<bar> \<noteq> \<infinity>"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   112
    from ereal_open_cont_interval[OF assms(1) * fin]
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   113
    obtain e where e: "e > 0" "{Inf S - e<..<Inf S + e} \<subseteq> S" .
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   114
    then obtain b where b: "Inf S - e < b" "b < Inf S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   115
      using fin ereal_between[of "Inf S" e] dense[of "Inf S - e"]
44918
6a80fbc4e72c tune simpset for Complete_Lattices
noschinl
parents: 44571
diff changeset
   116
      by auto
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   117
    then have "b: {Inf S - e <..< Inf S + e}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   118
      using e fin ereal_between[of "Inf S" e]
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   119
      by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   120
    then have "b \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   121
      using e by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   122
    then have False
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   123
      using b by (metis complete_lattice_class.Inf_lower leD)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   124
  }
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   125
  ultimately show False
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   126
    by auto
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   127
qed
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   128
43920
cedb5cb948fd Rename extreal => ereal
hoelzl
parents: 42950
diff changeset
   129
lemma ereal_open_closed:
cedb5cb948fd Rename extreal => ereal
hoelzl
parents: 42950
diff changeset
   130
  fixes S :: "ereal set"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   131
  shows "open S \<and> closed S \<longleftrightarrow> S = {} \<or> S = UNIV"
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   132
proof -
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   133
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   134
    assume lhs: "open S \<and> closed S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   135
    {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   136
      assume "-\<infinity> \<notin> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   137
      then have "S = {}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   138
        using lhs ereal_open_closed_aux by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   139
    }
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   140
    moreover
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   141
    {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   142
      assume "-\<infinity> \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   143
      then have "- S = {}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   144
        using lhs ereal_open_closed_aux[of "-S"] by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   145
    }
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   146
    ultimately have "S = {} \<or> S = UNIV"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   147
      by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   148
  }
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   149
  then show ?thesis
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   150
    by auto
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   151
qed
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   152
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   153
lemma ereal_open_atLeast:
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   154
  fixes x :: ereal
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   155
  shows "open {x..} \<longleftrightarrow> x = -\<infinity>"
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   156
proof
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   157
  assume "x = -\<infinity>"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   158
  then have "{x..} = UNIV"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   159
    by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   160
  then show "open {x..}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   161
    by auto
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   162
next
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   163
  assume "open {x..}"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   164
  then have "open {x..} \<and> closed {x..}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   165
    by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   166
  then have "{x..} = UNIV"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   167
    unfolding ereal_open_closed by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   168
  then show "x = -\<infinity>"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   169
    by (simp add: bot_ereal_def atLeast_eq_UNIV_iff)
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   170
qed
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   171
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   172
lemma mono_closed_real:
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   173
  fixes S :: "real set"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   174
  assumes mono: "\<forall>y z. y \<in> S \<and> y \<le> z \<longrightarrow> z \<in> S"
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   175
    and "closed S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   176
  shows "S = {} \<or> S = UNIV \<or> (\<exists>a. S = {a..})"
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   177
proof -
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   178
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   179
    assume "S \<noteq> {}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   180
    { assume ex: "\<exists>B. \<forall>x\<in>S. B \<le> x"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   181
      then have *: "\<forall>x\<in>S. Inf S \<le> x"
54258
adfc759263ab use bdd_above and bdd_below for conditionally complete lattices
hoelzl
parents: 54257
diff changeset
   182
        using cInf_lower[of _ S] ex by (metis bdd_below_def)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   183
      then have "Inf S \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   184
        apply (subst closed_contains_Inf)
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
   185
        using ex \<open>S \<noteq> {}\<close> \<open>closed S\<close>
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   186
        apply auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   187
        done
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   188
      then have "\<forall>x. Inf S \<le> x \<longleftrightarrow> x \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   189
        using mono[rule_format, of "Inf S"] *
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   190
        by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   191
      then have "S = {Inf S ..}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   192
        by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   193
      then have "\<exists>a. S = {a ..}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   194
        by auto
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   195
    }
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   196
    moreover
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   197
    {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   198
      assume "\<not> (\<exists>B. \<forall>x\<in>S. B \<le> x)"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   199
      then have nex: "\<forall>B. \<exists>x\<in>S. x < B"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   200
        by (simp add: not_le)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   201
      {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   202
        fix y
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   203
        obtain x where "x\<in>S" and "x < y"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   204
          using nex by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   205
        then have "y \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   206
          using mono[rule_format, of x y] by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   207
      }
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   208
      then have "S = UNIV"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   209
        by auto
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   210
    }
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   211
    ultimately have "S = UNIV \<or> (\<exists>a. S = {a ..})"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   212
      by blast
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   213
  }
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   214
  then show ?thesis
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   215
    by blast
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   216
qed
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   217
43920
cedb5cb948fd Rename extreal => ereal
hoelzl
parents: 42950
diff changeset
   218
lemma mono_closed_ereal:
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   219
  fixes S :: "real set"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   220
  assumes mono: "\<forall>y z. y \<in> S \<and> y \<le> z \<longrightarrow> z \<in> S"
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   221
    and "closed S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   222
  shows "\<exists>a. S = {x. a \<le> ereal x}"
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   223
proof -
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   224
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   225
    assume "S = {}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   226
    then have ?thesis
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   227
      apply (rule_tac x=PInfty in exI)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   228
      apply auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   229
      done
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   230
  }
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   231
  moreover
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   232
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   233
    assume "S = UNIV"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   234
    then have ?thesis
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   235
      apply (rule_tac x="-\<infinity>" in exI)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   236
      apply auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   237
      done
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   238
  }
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   239
  moreover
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   240
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   241
    assume "\<exists>a. S = {a ..}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   242
    then obtain a where "S = {a ..}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   243
      by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   244
    then have ?thesis
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   245
      apply (rule_tac x="ereal a" in exI)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   246
      apply auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   247
      done
49664
f099b8006a3c tuned proofs;
wenzelm
parents: 47761
diff changeset
   248
  }
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   249
  ultimately show ?thesis
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   250
    using mono_closed_real[of S] assms by auto
41980
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   251
qed
28b51effc5ed split Extended_Reals into parts for Library and Multivariate_Analysis
hoelzl
parents:
diff changeset
   252
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   253
lemma Liminf_within:
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   254
  fixes f :: "'a::metric_space \<Rightarrow> 'b::complete_lattice"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   255
  shows "Liminf (at x within S) f = (SUP e:{0<..}. INF y:(S \<inter> ball x e - {x}). f y)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
   256
  unfolding Liminf_def eventually_at
56212
3253aaf73a01 consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
haftmann
parents: 56166
diff changeset
   257
proof (rule SUP_eq, simp_all add: Ball_def Bex_def, safe)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   258
  fix P d
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   259
  assume "0 < d" and "\<forall>y. y \<in> S \<longrightarrow> y \<noteq> x \<and> dist y x < d \<longrightarrow> P y"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   260
  then have "S \<inter> ball x d - {x} \<subseteq> {x. P x}"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   261
    by (auto simp: zero_less_dist_iff dist_commute)
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   262
  then show "\<exists>r>0. INFIMUM (Collect P) f \<le> INFIMUM (S \<inter> ball x r - {x}) f"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
   263
    by (intro exI[of _ d] INF_mono conjI \<open>0 < d\<close>) auto
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   264
next
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   265
  fix d :: real
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   266
  assume "0 < d"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
   267
  then show "\<exists>P. (\<exists>d>0. \<forall>xa. xa \<in> S \<longrightarrow> xa \<noteq> x \<and> dist xa x < d \<longrightarrow> P xa) \<and>
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   268
    INFIMUM (S \<inter> ball x d - {x}) f \<le> INFIMUM (Collect P) f"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   269
    by (intro exI[of _ "\<lambda>y. y \<in> S \<inter> ball x d - {x}"])
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   270
       (auto intro!: INF_mono exI[of _ d] simp: dist_commute)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   271
qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   272
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   273
lemma Limsup_within:
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   274
  fixes f :: "'a::metric_space \<Rightarrow> 'b::complete_lattice"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   275
  shows "Limsup (at x within S) f = (INF e:{0<..}. SUP y:(S \<inter> ball x e - {x}). f y)"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
   276
  unfolding Limsup_def eventually_at
56212
3253aaf73a01 consolidated theorem names containing INFI and SUPR: have INF and SUP instead uniformly
haftmann
parents: 56166
diff changeset
   277
proof (rule INF_eq, simp_all add: Ball_def Bex_def, safe)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   278
  fix P d
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   279
  assume "0 < d" and "\<forall>y. y \<in> S \<longrightarrow> y \<noteq> x \<and> dist y x < d \<longrightarrow> P y"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   280
  then have "S \<inter> ball x d - {x} \<subseteq> {x. P x}"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   281
    by (auto simp: zero_less_dist_iff dist_commute)
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   282
  then show "\<exists>r>0. SUPREMUM (S \<inter> ball x r - {x}) f \<le> SUPREMUM (Collect P) f"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
   283
    by (intro exI[of _ d] SUP_mono conjI \<open>0 < d\<close>) auto
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   284
next
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   285
  fix d :: real
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   286
  assume "0 < d"
51641
cd05e9fcc63d remove the within-filter, replace "at" by "at _ within UNIV" (This allows to remove a couple of redundant lemmas)
hoelzl
parents: 51530
diff changeset
   287
  then show "\<exists>P. (\<exists>d>0. \<forall>xa. xa \<in> S \<longrightarrow> xa \<noteq> x \<and> dist xa x < d \<longrightarrow> P xa) \<and>
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   288
    SUPREMUM (Collect P) f \<le> SUPREMUM (S \<inter> ball x d - {x}) f"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   289
    by (intro exI[of _ "\<lambda>y. y \<in> S \<inter> ball x d - {x}"])
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   290
       (auto intro!: SUP_mono exI[of _ d] simp: dist_commute)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   291
qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   292
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   293
lemma Liminf_at:
54257
5c7a3b6b05a9 generalize SUP and INF to the syntactic type classes Sup and Inf
hoelzl
parents: 53788
diff changeset
   294
  fixes f :: "'a::metric_space \<Rightarrow> 'b::complete_lattice"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   295
  shows "Liminf (at x) f = (SUP e:{0<..}. INF y:(ball x e - {x}). f y)"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   296
  using Liminf_within[of x UNIV f] by simp
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   297
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   298
lemma Limsup_at:
54257
5c7a3b6b05a9 generalize SUP and INF to the syntactic type classes Sup and Inf
hoelzl
parents: 53788
diff changeset
   299
  fixes f :: "'a::metric_space \<Rightarrow> 'b::complete_lattice"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   300
  shows "Limsup (at x) f = (INF e:{0<..}. SUP y:(ball x e - {x}). f y)"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   301
  using Limsup_within[of x UNIV f] by simp
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   302
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   303
lemma min_Liminf_at:
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   304
  fixes f :: "'a::metric_space \<Rightarrow> 'b::complete_linorder"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   305
  shows "min (f x) (Liminf (at x) f) = (SUP e:{0<..}. INF y:ball x e. f y)"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   306
  unfolding inf_min[symmetric] Liminf_at
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   307
  apply (subst inf_commute)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   308
  apply (subst SUP_inf)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   309
  apply (intro SUP_cong[OF refl])
54260
6a967667fd45 use INF and SUP on conditionally complete lattices in multivariate analysis
hoelzl
parents: 54258
diff changeset
   310
  apply (cut_tac A="ball x xa - {x}" and B="{x}" and M=f in INF_union)
56166
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 55522
diff changeset
   311
  apply (drule sym)
9a241bc276cd normalising simp rules for compound operators
haftmann
parents: 55522
diff changeset
   312
  apply auto
57865
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57447
diff changeset
   313
  apply (metis INF_absorb centre_in_ball)
dcfb33c26f50 tuned proofs -- fewer warnings;
wenzelm
parents: 57447
diff changeset
   314
  done
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   315
61245
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   316
lemma continuous_on_inverse_ereal: "continuous_on {0::ereal ..} inverse"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   317
  unfolding continuous_on_def
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   318
proof clarsimp
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   319
  fix x :: ereal assume "0 \<le> x"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   320
  moreover have "at 0 within {0 ..} = at_right (0::ereal)"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   321
    by (auto simp: filter_eq_iff eventually_at_filter le_less)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   322
  moreover have "0 < x \<Longrightarrow> at x within {0 ..} = at x"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   323
    using at_within_interior[of x "{0 ..}"] by (simp add: interior_Ici[of "- \<infinity>"])
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   324
  ultimately show "(inverse ---> inverse x) (at x within {0..})"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   325
    by (auto simp: le_less inverse_ereal_tendsto_at_right_0 inverse_ereal_tendsto_pos)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   326
qed
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   327
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   328
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   329
lemma Liminf_inverse_ereal:
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   330
  assumes nneg: "\<forall>\<^sub>F x in F. f x \<ge> (0 :: ereal)" and "F \<noteq> bot"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   331
  shows "Liminf F (\<lambda>n. inverse (f n)) = inverse (Limsup F f)"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   332
proof -
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   333
  def I \<equiv> "\<lambda>x::ereal. if x \<le> 0 then \<infinity> else inverse x"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   334
  have "Liminf F (\<lambda>n. I (f n)) = I (Limsup F f)"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   335
  proof (rule Liminf_compose_continuous_antimono)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   336
    have "continuous_on ({.. 0} \<union> {0 ..}) I"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   337
      unfolding I_def by (intro continuous_on_cases) (auto intro: continuous_on_const continuous_on_inverse_ereal)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   338
    also have "{.. 0} \<union> {0::ereal ..} = UNIV"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   339
      by auto
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   340
    finally show "continuous_on UNIV I" .
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   341
    show "antimono I"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   342
      unfolding antimono_def I_def by (auto intro: ereal_inverse_antimono)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   343
  qed fact
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   344
  also have "Liminf F (\<lambda>n. I (f n)) = Liminf F (\<lambda>n. inverse (f n))"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   345
  proof (rule Liminf_eq)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   346
    show "\<forall>\<^sub>F x in F. I (f x) = inverse (f x)"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   347
      using nneg by eventually_elim (auto simp: I_def)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   348
  qed
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   349
  also have "0 \<le> Limsup F f"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   350
    by (intro le_Limsup) fact+
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   351
  then have "I (Limsup F f) = inverse (Limsup F f)"
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   352
    by (auto simp: I_def)
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   353
  finally show ?thesis .
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   354
qed
b77bf45efe21 prove Liminf_inverse_ereal
hoelzl
parents: 61169
diff changeset
   355
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
   356
subsection \<open>monoset\<close>
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   357
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   358
definition (in order) mono_set:
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   359
  "mono_set S \<longleftrightarrow> (\<forall>x y. x \<le> y \<longrightarrow> x \<in> S \<longrightarrow> y \<in> S)"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   360
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   361
lemma (in order) mono_greaterThan [intro, simp]: "mono_set {B<..}" unfolding mono_set by auto
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   362
lemma (in order) mono_atLeast [intro, simp]: "mono_set {B..}" unfolding mono_set by auto
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   363
lemma (in order) mono_UNIV [intro, simp]: "mono_set UNIV" unfolding mono_set by auto
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   364
lemma (in order) mono_empty [intro, simp]: "mono_set {}" unfolding mono_set by auto
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   365
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   366
lemma (in complete_linorder) mono_set_iff:
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   367
  fixes S :: "'a set"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   368
  defines "a \<equiv> Inf S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   369
  shows "mono_set S \<longleftrightarrow> S = {a <..} \<or> S = {a..}" (is "_ = ?c")
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   370
proof
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   371
  assume "mono_set S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   372
  then have mono: "\<And>x y. x \<le> y \<Longrightarrow> x \<in> S \<Longrightarrow> y \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   373
    by (auto simp: mono_set)
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   374
  show ?c
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   375
  proof cases
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   376
    assume "a \<in> S"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   377
    show ?c
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
   378
      using mono[OF _ \<open>a \<in> S\<close>]
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   379
      by (auto intro: Inf_lower simp: a_def)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   380
  next
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   381
    assume "a \<notin> S"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   382
    have "S = {a <..}"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   383
    proof safe
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   384
      fix x assume "x \<in> S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   385
      then have "a \<le> x"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   386
        unfolding a_def by (rule Inf_lower)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   387
      then show "a < x"
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
   388
        using \<open>x \<in> S\<close> \<open>a \<notin> S\<close> by (cases "a = x") auto
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   389
    next
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   390
      fix x assume "a < x"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   391
      then obtain y where "y < x" "y \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   392
        unfolding a_def Inf_less_iff ..
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   393
      with mono[of y x] show "x \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   394
        by auto
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   395
    qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   396
    then show ?c ..
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   397
  qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   398
qed auto
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   399
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   400
lemma ereal_open_mono_set:
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   401
  fixes S :: "ereal set"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   402
  shows "open S \<and> mono_set S \<longleftrightarrow> S = UNIV \<or> S = {Inf S <..}"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   403
  by (metis Inf_UNIV atLeast_eq_UNIV_iff ereal_open_atLeast
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   404
    ereal_open_closed mono_set_iff open_ereal_greaterThan)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   405
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   406
lemma ereal_closed_mono_set:
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   407
  fixes S :: "ereal set"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   408
  shows "closed S \<and> mono_set S \<longleftrightarrow> S = {} \<or> S = {Inf S ..}"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   409
  by (metis Inf_UNIV atLeast_eq_UNIV_iff closed_ereal_atLeast
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   410
    ereal_open_closed mono_empty mono_set_iff open_ereal_greaterThan)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   411
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   412
lemma ereal_Liminf_Sup_monoset:
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   413
  fixes f :: "'a \<Rightarrow> ereal"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   414
  shows "Liminf net f =
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   415
    Sup {l. \<forall>S. open S \<longrightarrow> mono_set S \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net}"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   416
    (is "_ = Sup ?A")
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   417
proof (safe intro!: Liminf_eqI complete_lattice_class.Sup_upper complete_lattice_class.Sup_least)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   418
  fix P
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   419
  assume P: "eventually P net"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   420
  fix S
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   421
  assume S: "mono_set S" "INFIMUM (Collect P) f \<in> S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   422
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   423
    fix x
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   424
    assume "P x"
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   425
    then have "INFIMUM (Collect P) f \<le> f x"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   426
      by (intro complete_lattice_class.INF_lower) simp
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   427
    with S have "f x \<in> S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   428
      by (simp add: mono_set)
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   429
  }
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   430
  with P show "eventually (\<lambda>x. f x \<in> S) net"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   431
    by (auto elim: eventually_elim1)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   432
next
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   433
  fix y l
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   434
  assume S: "\<forall>S. open S \<longrightarrow> mono_set S \<longrightarrow> l \<in> S \<longrightarrow> eventually  (\<lambda>x. f x \<in> S) net"
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   435
  assume P: "\<forall>P. eventually P net \<longrightarrow> INFIMUM (Collect P) f \<le> y"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   436
  show "l \<le> y"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   437
  proof (rule dense_le)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   438
    fix B
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   439
    assume "B < l"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   440
    then have "eventually (\<lambda>x. f x \<in> {B <..}) net"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   441
      by (intro S[rule_format]) auto
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   442
    then have "INFIMUM {x. B < f x} f \<le> y"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   443
      using P by auto
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   444
    moreover have "B \<le> INFIMUM {x. B < f x} f"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   445
      by (intro INF_greatest) auto
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   446
    ultimately show "B \<le> y"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   447
      by simp
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   448
  qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   449
qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   450
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   451
lemma ereal_Limsup_Inf_monoset:
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   452
  fixes f :: "'a \<Rightarrow> ereal"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   453
  shows "Limsup net f =
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   454
    Inf {l. \<forall>S. open S \<longrightarrow> mono_set (uminus ` S) \<longrightarrow> l \<in> S \<longrightarrow> eventually (\<lambda>x. f x \<in> S) net}"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   455
    (is "_ = Inf ?A")
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   456
proof (safe intro!: Limsup_eqI complete_lattice_class.Inf_lower complete_lattice_class.Inf_greatest)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   457
  fix P
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   458
  assume P: "eventually P net"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   459
  fix S
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   460
  assume S: "mono_set (uminus`S)" "SUPREMUM (Collect P) f \<in> S"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   461
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   462
    fix x
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   463
    assume "P x"
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   464
    then have "f x \<le> SUPREMUM (Collect P) f"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   465
      by (intro complete_lattice_class.SUP_upper) simp
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   466
    with S(1)[unfolded mono_set, rule_format, of "- SUPREMUM (Collect P) f" "- f x"] S(2)
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   467
    have "f x \<in> S"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   468
      by (simp add: inj_image_mem_iff) }
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   469
  with P show "eventually (\<lambda>x. f x \<in> S) net"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   470
    by (auto elim: eventually_elim1)
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   471
next
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   472
  fix y l
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   473
  assume S: "\<forall>S. open S \<longrightarrow> mono_set (uminus ` S) \<longrightarrow> l \<in> S \<longrightarrow> eventually  (\<lambda>x. f x \<in> S) net"
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   474
  assume P: "\<forall>P. eventually P net \<longrightarrow> y \<le> SUPREMUM (Collect P) f"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   475
  show "y \<le> l"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   476
  proof (rule dense_ge)
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   477
    fix B
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   478
    assume "l < B"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   479
    then have "eventually (\<lambda>x. f x \<in> {..< B}) net"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   480
      by (intro S[rule_format]) auto
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   481
    then have "y \<le> SUPREMUM {x. f x < B} f"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   482
      using P by auto
56218
1c3f1f2431f9 elongated INFI and SUPR, to reduced risk of confusing theorems names in the future while still being consistent with INTER and UNION
haftmann
parents: 56212
diff changeset
   483
    moreover have "SUPREMUM {x. f x < B} f \<le> B"
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   484
      by (intro SUP_least) auto
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   485
    ultimately show "y \<le> B"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   486
      by simp
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   487
  qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   488
qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   489
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   490
lemma liminf_bounded_open:
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   491
  fixes x :: "nat \<Rightarrow> ereal"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   492
  shows "x0 \<le> liminf x \<longleftrightarrow> (\<forall>S. open S \<longrightarrow> mono_set S \<longrightarrow> x0 \<in> S \<longrightarrow> (\<exists>N. \<forall>n\<ge>N. x n \<in> S))"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   493
  (is "_ \<longleftrightarrow> ?P x0")
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   494
proof
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   495
  assume "?P x0"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   496
  then show "x0 \<le> liminf x"
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   497
    unfolding ereal_Liminf_Sup_monoset eventually_sequentially
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   498
    by (intro complete_lattice_class.Sup_upper) auto
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   499
next
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   500
  assume "x0 \<le> liminf x"
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   501
  {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   502
    fix S :: "ereal set"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   503
    assume om: "open S" "mono_set S" "x0 \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   504
    {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   505
      assume "S = UNIV"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   506
      then have "\<exists>N. \<forall>n\<ge>N. x n \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   507
        by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   508
    }
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   509
    moreover
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   510
    {
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   511
      assume "S \<noteq> UNIV"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   512
      then obtain B where B: "S = {B<..}"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   513
        using om ereal_open_mono_set by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   514
      then have "B < x0"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   515
        using om by auto
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   516
      then have "\<exists>N. \<forall>n\<ge>N. x n \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   517
        unfolding B
60420
884f54e01427 isabelle update_cartouches;
wenzelm
parents: 59452
diff changeset
   518
        using \<open>x0 \<le> liminf x\<close> liminf_bounded_iff
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   519
        by auto
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   520
    }
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   521
    ultimately have "\<exists>N. \<forall>n\<ge>N. x n \<in> S"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   522
      by auto
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   523
  }
53788
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   524
  then show "?P x0"
b319a0c8b8a2 tuned proofs;
wenzelm
parents: 53374
diff changeset
   525
    by auto
51340
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   526
qed
5e6296afe08d move Liminf / Limsup lemmas on complete_lattices to its own file
hoelzl
parents: 51329
diff changeset
   527
57446
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   528
subsection "Relate extended reals and the indicator function"
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   529
59000
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58877
diff changeset
   530
lemma ereal_indicator_le_0: "(indicator S x::ereal) \<le> 0 \<longleftrightarrow> x \<notin> S"
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58877
diff changeset
   531
  by (auto split: split_indicator simp: one_ereal_def)
6eb0725503fc import general theorems from AFP/Markov_Models
hoelzl
parents: 58877
diff changeset
   532
57446
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   533
lemma ereal_indicator: "ereal (indicator A x) = indicator A x"
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   534
  by (auto simp: indicator_def one_ereal_def)
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   535
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   536
lemma ereal_mult_indicator: "ereal (x * indicator A y) = ereal x * indicator A y"
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   537
  by (simp split: split_indicator)
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   538
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   539
lemma ereal_indicator_mult: "ereal (indicator A y * x) = indicator A y * ereal x"
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   540
  by (simp split: split_indicator)
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   541
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   542
lemma ereal_indicator_nonneg[simp, intro]: "0 \<le> (indicator A x ::ereal)"
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   543
  unfolding indicator_def by auto
06e195515deb some lemmas about the indicator function; removed lemma sums_def2
hoelzl
parents: 57418
diff changeset
   544
59425
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59000
diff changeset
   545
lemma indicator_inter_arith_ereal: "indicator A x * indicator B x = (indicator (A \<inter> B) x :: ereal)"
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59000
diff changeset
   546
  by (simp split: split_indicator)
c5e79df8cc21 import general thms from Density_Compiler
hoelzl
parents: 59000
diff changeset
   547
44125
230a8665c919 mark some redundant theorems as legacy
huffman
parents: 43923
diff changeset
   548
end