src/HOL/Library/Continuity.thy
author wenzelm
Thu May 31 20:52:51 2001 +0200 (2001-05-31)
changeset 11355 778c369559d9
parent 11351 c5c403d30c77
child 11461 ffeac9aa1967
permissions -rw-r--r--
tuned
oheimb@11351
     1
(*  Title:      HOL/Library/Continuity.thy
wenzelm@11355
     2
    ID:         $Id$
wenzelm@11355
     3
    Author:     David von Oheimb, TU Muenchen
oheimb@11351
     4
    License:    GPL (GNU GENERAL PUBLIC LICENSE)
oheimb@11351
     5
*)
oheimb@11351
     6
oheimb@11351
     7
header {*
wenzelm@11355
     8
  \title{Continuity and iterations (of set transformers)}
oheimb@11351
     9
  \author{David von Oheimb}
oheimb@11351
    10
*}
oheimb@11351
    11
wenzelm@11355
    12
theory Continuity = Main:
oheimb@11351
    13
oheimb@11351
    14
subsection "Chains"
oheimb@11351
    15
oheimb@11351
    16
constdefs
wenzelm@11355
    17
  up_chain :: "(nat => 'a set) => bool"
wenzelm@11355
    18
  "up_chain F == \<forall>i. F i \<subseteq> F (Suc i)"
oheimb@11351
    19
wenzelm@11355
    20
lemma up_chainI: "(!!i. F i \<subseteq> F (Suc i)) ==> up_chain F"
wenzelm@11355
    21
  by (simp add: up_chain_def)
oheimb@11351
    22
wenzelm@11355
    23
lemma up_chainD: "up_chain F ==> F i \<subseteq> F (Suc i)"
wenzelm@11355
    24
  by (simp add: up_chain_def)
oheimb@11351
    25
wenzelm@11355
    26
lemma up_chain_less_mono [rule_format]:
wenzelm@11355
    27
    "up_chain F ==> x < y --> F x \<subseteq> F y"
wenzelm@11355
    28
  apply (induct_tac y)
wenzelm@11355
    29
  apply (blast dest: up_chainD elim: less_SucE)+
wenzelm@11355
    30
  done
oheimb@11351
    31
wenzelm@11355
    32
lemma up_chain_mono: "up_chain F ==> x \<le> y ==> F x \<subseteq> F y"
wenzelm@11355
    33
  apply (drule le_imp_less_or_eq)
wenzelm@11355
    34
  apply (blast dest: up_chain_less_mono)
wenzelm@11355
    35
  done
oheimb@11351
    36
oheimb@11351
    37
oheimb@11351
    38
constdefs
wenzelm@11355
    39
  down_chain :: "(nat => 'a set) => bool"
wenzelm@11355
    40
  "down_chain F == \<forall>i. F (Suc i) \<subseteq> F i"
oheimb@11351
    41
wenzelm@11355
    42
lemma down_chainI: "(!!i. F (Suc i) \<subseteq> F i) ==> down_chain F"
wenzelm@11355
    43
  by (simp add: down_chain_def)
oheimb@11351
    44
wenzelm@11355
    45
lemma down_chainD: "down_chain F ==> F (Suc i) \<subseteq> F i"
wenzelm@11355
    46
  by (simp add: down_chain_def)
oheimb@11351
    47
wenzelm@11355
    48
lemma down_chain_less_mono [rule_format]:
wenzelm@11355
    49
    "down_chain F ==> x < y --> F y \<subseteq> F x"
wenzelm@11355
    50
  apply (induct_tac y)
wenzelm@11355
    51
  apply (blast dest: down_chainD elim: less_SucE)+
wenzelm@11355
    52
  done
oheimb@11351
    53
wenzelm@11355
    54
lemma down_chain_mono: "down_chain F ==> x \<le> y ==> F y \<subseteq> F x"
wenzelm@11355
    55
  apply (drule le_imp_less_or_eq)
wenzelm@11355
    56
  apply (blast dest: down_chain_less_mono)
wenzelm@11355
    57
  done
oheimb@11351
    58
oheimb@11351
    59
oheimb@11351
    60
subsection "Continuity"
oheimb@11351
    61
oheimb@11351
    62
constdefs
oheimb@11351
    63
  up_cont :: "('a set => 'a set) => bool"
wenzelm@11355
    64
  "up_cont f == \<forall>F. up_chain F --> f (\<Union>(range F)) = \<Union>(f ` range F)"
oheimb@11351
    65
wenzelm@11355
    66
lemma up_contI:
wenzelm@11355
    67
    "(!!F. up_chain F ==> f (\<Union>(range F)) = \<Union>(f ` range F)) ==> up_cont f"
wenzelm@11355
    68
  apply (unfold up_cont_def)
wenzelm@11355
    69
  apply blast
wenzelm@11355
    70
  done
oheimb@11351
    71
wenzelm@11355
    72
lemma up_contD:
wenzelm@11355
    73
    "up_cont f ==> up_chain F ==> f (\<Union>(range F)) = \<Union>(f ` range F)"
wenzelm@11355
    74
  apply (unfold up_cont_def)
wenzelm@11355
    75
  apply auto
wenzelm@11355
    76
  done
oheimb@11351
    77
oheimb@11351
    78
oheimb@11351
    79
lemma up_cont_mono: "up_cont f ==> mono f"
wenzelm@11355
    80
  apply (rule monoI)
wenzelm@11355
    81
  apply (drule_tac F = "\<lambda>i. if i = 0 then A else B" in up_contD)
wenzelm@11355
    82
   apply (rule up_chainI)
wenzelm@11355
    83
   apply  simp+
wenzelm@11355
    84
  apply (drule Un_absorb1)
wenzelm@11355
    85
  apply auto
wenzelm@11355
    86
  done
oheimb@11351
    87
oheimb@11351
    88
oheimb@11351
    89
constdefs
oheimb@11351
    90
  down_cont :: "('a set => 'a set) => bool"
wenzelm@11355
    91
  "down_cont f ==
wenzelm@11355
    92
    \<forall>F. down_chain F --> f (Inter (range F)) = Inter (f ` range F)"
oheimb@11351
    93
wenzelm@11355
    94
lemma down_contI:
wenzelm@11355
    95
  "(!!F. down_chain F ==> f (Inter (range F)) = Inter (f ` range F)) ==>
wenzelm@11355
    96
    down_cont f"
wenzelm@11355
    97
  apply (unfold down_cont_def)
wenzelm@11355
    98
  apply blast
wenzelm@11355
    99
  done
oheimb@11351
   100
wenzelm@11355
   101
lemma down_contD: "down_cont f ==> down_chain F ==>
wenzelm@11355
   102
    f (Inter (range F)) = Inter (f ` range F)"
wenzelm@11355
   103
  apply (unfold down_cont_def)
wenzelm@11355
   104
  apply auto
wenzelm@11355
   105
  done
oheimb@11351
   106
oheimb@11351
   107
lemma down_cont_mono: "down_cont f ==> mono f"
wenzelm@11355
   108
  apply (rule monoI)
wenzelm@11355
   109
  apply (drule_tac F = "\<lambda>i. if i = 0 then B else A" in down_contD)
wenzelm@11355
   110
   apply (rule down_chainI)
wenzelm@11355
   111
   apply simp+
wenzelm@11355
   112
  apply (drule Int_absorb1)
wenzelm@11355
   113
  apply auto
wenzelm@11355
   114
  done
oheimb@11351
   115
oheimb@11351
   116
oheimb@11351
   117
subsection "Iteration"
oheimb@11351
   118
oheimb@11351
   119
constdefs
oheimb@11351
   120
  up_iterate :: "('a set => 'a set) => nat => 'a set"
wenzelm@11355
   121
  "up_iterate f n == (f^n) {}"
oheimb@11351
   122
oheimb@11351
   123
lemma up_iterate_0 [simp]: "up_iterate f 0 = {}"
wenzelm@11355
   124
  by (simp add: up_iterate_def)
oheimb@11351
   125
wenzelm@11355
   126
lemma up_iterate_Suc [simp]: "up_iterate f (Suc i) = f (up_iterate f i)"
wenzelm@11355
   127
  by (simp add: up_iterate_def)
oheimb@11351
   128
oheimb@11351
   129
lemma up_iterate_chain: "mono F ==> up_chain (up_iterate F)"
wenzelm@11355
   130
  apply (rule up_chainI)
wenzelm@11355
   131
  apply (induct_tac i)
wenzelm@11355
   132
   apply simp+
wenzelm@11355
   133
  apply (erule (1) monoD)
wenzelm@11355
   134
  done
oheimb@11351
   135
wenzelm@11355
   136
lemma UNION_up_iterate_is_fp:
wenzelm@11355
   137
  "up_cont F ==>
wenzelm@11355
   138
    F (UNION UNIV (up_iterate F)) = UNION UNIV (up_iterate F)"
wenzelm@11355
   139
  apply (frule up_cont_mono [THEN up_iterate_chain])
wenzelm@11355
   140
  apply (drule (1) up_contD)
wenzelm@11355
   141
  apply simp
wenzelm@11355
   142
  apply (auto simp del: up_iterate_Suc simp add: up_iterate_Suc [symmetric])
wenzelm@11355
   143
  apply (case_tac xa)
wenzelm@11355
   144
   apply auto
wenzelm@11355
   145
  done
oheimb@11351
   146
wenzelm@11355
   147
lemma UNION_up_iterate_lowerbound:
wenzelm@11355
   148
    "mono F ==> F P = P ==> UNION UNIV (up_iterate F) \<subseteq> P"
wenzelm@11355
   149
  apply (subgoal_tac "(!!i. up_iterate F i \<subseteq> P)")
wenzelm@11355
   150
   apply fast
wenzelm@11355
   151
  apply (induct_tac i)
wenzelm@11355
   152
  prefer 2 apply (drule (1) monoD)
wenzelm@11355
   153
   apply auto
wenzelm@11355
   154
  done
oheimb@11351
   155
wenzelm@11355
   156
lemma UNION_up_iterate_is_lfp:
wenzelm@11355
   157
    "up_cont F ==> lfp F = UNION UNIV (up_iterate F)"
wenzelm@11355
   158
  apply (rule set_eq_subset [THEN iffD2])
wenzelm@11355
   159
  apply (rule conjI)
wenzelm@11355
   160
   prefer 2
wenzelm@11355
   161
   apply (drule up_cont_mono)
wenzelm@11355
   162
   apply (rule UNION_up_iterate_lowerbound)
wenzelm@11355
   163
    apply assumption
wenzelm@11355
   164
   apply (erule lfp_unfold [symmetric])
wenzelm@11355
   165
  apply (rule lfp_lowerbound)
wenzelm@11355
   166
  apply (rule set_eq_subset [THEN iffD1, THEN conjunct2])
wenzelm@11355
   167
  apply (erule UNION_up_iterate_is_fp [symmetric])
wenzelm@11355
   168
  done
oheimb@11351
   169
oheimb@11351
   170
oheimb@11351
   171
constdefs
oheimb@11351
   172
  down_iterate :: "('a set => 'a set) => nat => 'a set"
wenzelm@11355
   173
  "down_iterate f n == (f^n) UNIV"
oheimb@11351
   174
oheimb@11351
   175
lemma down_iterate_0 [simp]: "down_iterate f 0 = UNIV"
wenzelm@11355
   176
  by (simp add: down_iterate_def)
oheimb@11351
   177
wenzelm@11355
   178
lemma down_iterate_Suc [simp]:
wenzelm@11355
   179
    "down_iterate f (Suc i) = f (down_iterate f i)"
wenzelm@11355
   180
  by (simp add: down_iterate_def)
oheimb@11351
   181
oheimb@11351
   182
lemma down_iterate_chain: "mono F ==> down_chain (down_iterate F)"
wenzelm@11355
   183
  apply (rule down_chainI)
wenzelm@11355
   184
  apply (induct_tac i)
wenzelm@11355
   185
   apply simp+
wenzelm@11355
   186
  apply (erule (1) monoD)
wenzelm@11355
   187
  done
oheimb@11351
   188
wenzelm@11355
   189
lemma INTER_down_iterate_is_fp:
wenzelm@11355
   190
  "down_cont F ==>
wenzelm@11355
   191
    F (INTER UNIV (down_iterate F)) = INTER UNIV (down_iterate F)"
wenzelm@11355
   192
  apply (frule down_cont_mono [THEN down_iterate_chain])
wenzelm@11355
   193
  apply (drule (1) down_contD)
wenzelm@11355
   194
  apply simp
wenzelm@11355
   195
  apply (auto simp del: down_iterate_Suc simp add: down_iterate_Suc [symmetric])
wenzelm@11355
   196
  apply (case_tac xa)
wenzelm@11355
   197
   apply auto
wenzelm@11355
   198
  done
oheimb@11351
   199
wenzelm@11355
   200
lemma INTER_down_iterate_upperbound:
wenzelm@11355
   201
    "mono F ==> F P = P ==> P \<subseteq> INTER UNIV (down_iterate F)"
wenzelm@11355
   202
  apply (subgoal_tac "(!!i. P \<subseteq> down_iterate F i)")
wenzelm@11355
   203
   apply fast
wenzelm@11355
   204
  apply (induct_tac i)
wenzelm@11355
   205
  prefer 2 apply (drule (1) monoD)
wenzelm@11355
   206
   apply auto
wenzelm@11355
   207
  done
oheimb@11351
   208
wenzelm@11355
   209
lemma INTER_down_iterate_is_gfp:
wenzelm@11355
   210
    "down_cont F ==> gfp F = INTER UNIV (down_iterate F)"
wenzelm@11355
   211
  apply (rule set_eq_subset [THEN iffD2])
wenzelm@11355
   212
  apply (rule conjI)
wenzelm@11355
   213
   apply (drule down_cont_mono)
wenzelm@11355
   214
   apply (rule INTER_down_iterate_upperbound)
wenzelm@11355
   215
    apply assumption
wenzelm@11355
   216
   apply (erule gfp_unfold [symmetric])
wenzelm@11355
   217
  apply (rule gfp_upperbound)
wenzelm@11355
   218
  apply (rule set_eq_subset [THEN iffD1, THEN conjunct2])
wenzelm@11355
   219
  apply (erule INTER_down_iterate_is_fp)
wenzelm@11355
   220
  done
oheimb@11351
   221
oheimb@11351
   222
end