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