src/HOL/Library/Continuity.thy
author nipkow
Sun, 19 Aug 2007 21:21:37 +0200
changeset 24331 76f7a8c6e842
parent 23752 15839159f8b6
child 25076 a50b36401c61
permissions -rw-r--r--
Made UN_Un simp
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
     1
(*  Title:      HOL/Library/Continuity.thy
11355
wenzelm
parents: 11351
diff changeset
     2
    ID:         $Id$
wenzelm
parents: 11351
diff changeset
     3
    Author:     David von Oheimb, TU Muenchen
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
     4
*)
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
     5
14706
71590b7733b7 tuned document;
wenzelm
parents: 11461
diff changeset
     6
header {* Continuity and iterations (of set transformers) *}
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
     7
15131
c69542757a4d New theory header syntax.
nipkow
parents: 14981
diff changeset
     8
theory Continuity
15140
322485b816ac import -> imports
nipkow
parents: 15131
diff changeset
     9
imports Main
15131
c69542757a4d New theory header syntax.
nipkow
parents: 14981
diff changeset
    10
begin
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
    11
22367
6860f09242bf tuned document;
wenzelm
parents: 21404
diff changeset
    12
subsection {* Continuity for complete lattices *}
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    13
22367
6860f09242bf tuned document;
wenzelm
parents: 21404
diff changeset
    14
definition
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22431
diff changeset
    15
  chain :: "(nat \<Rightarrow> 'a::complete_lattice) \<Rightarrow> bool" where
22367
6860f09242bf tuned document;
wenzelm
parents: 21404
diff changeset
    16
  "chain M \<longleftrightarrow> (\<forall>i. M i \<le> M (Suc i))"
6860f09242bf tuned document;
wenzelm
parents: 21404
diff changeset
    17
6860f09242bf tuned document;
wenzelm
parents: 21404
diff changeset
    18
definition
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22431
diff changeset
    19
  continuous :: "('a::complete_lattice \<Rightarrow> 'a::complete_lattice) \<Rightarrow> bool" where
22367
6860f09242bf tuned document;
wenzelm
parents: 21404
diff changeset
    20
  "continuous F \<longleftrightarrow> (\<forall>M. chain M \<longrightarrow> F (SUP i. M i) = (SUP i. F (M i)))"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    21
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    22
lemma SUP_nat_conv:
22431
28344ccffc35 Adapted to changes in definition of SUP.
berghofe
parents: 22422
diff changeset
    23
  "(SUP n. M n) = sup (M 0) (SUP n. M(Suc n))"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    24
apply(rule order_antisym)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    25
 apply(rule SUP_leI)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    26
 apply(case_tac n)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    27
  apply simp
22431
28344ccffc35 Adapted to changes in definition of SUP.
berghofe
parents: 22422
diff changeset
    28
 apply (fast intro:le_SUPI le_supI2)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    29
apply(simp)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    30
apply (blast intro:SUP_leI le_SUPI)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    31
done
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    32
22452
8a86fd2a1bf0 adjusted to new lattice theory developement in Lattices.thy / FixedPoint.thy
haftmann
parents: 22431
diff changeset
    33
lemma continuous_mono: fixes F :: "'a::complete_lattice \<Rightarrow> 'a::complete_lattice"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    34
  assumes "continuous F" shows "mono F"
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    35
proof
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    36
  fix A B :: "'a" assume "A <= B"
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    37
  let ?C = "%i::nat. if i=0 then A else B"
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    38
  have "chain ?C" using `A <= B` by(simp add:chain_def)
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22367
diff changeset
    39
  have "F B = sup (F A) (F B)"
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    40
  proof -
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22367
diff changeset
    41
    have "sup A B = B" using `A <= B` by (simp add:sup_absorb2)
22431
28344ccffc35 Adapted to changes in definition of SUP.
berghofe
parents: 22422
diff changeset
    42
    hence "F B = F(SUP i. ?C i)" by (subst SUP_nat_conv) simp
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    43
    also have "\<dots> = (SUP i. F(?C i))"
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    44
      using `chain ?C` `continuous F` by(simp add:continuous_def)
22431
28344ccffc35 Adapted to changes in definition of SUP.
berghofe
parents: 22422
diff changeset
    45
    also have "\<dots> = sup (F A) (F B)" by (subst SUP_nat_conv) simp
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    46
    finally show ?thesis .
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    47
  qed
22422
ee19cdb07528 stepping towards uniform lattice theory development in HOL
haftmann
parents: 22367
diff changeset
    48
  thus "F A \<le> F B" by(subst le_iff_sup, simp)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    49
qed
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    50
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    51
lemma continuous_lfp:
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    52
 assumes "continuous F" shows "lfp F = (SUP i. (F^i) bot)"
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    53
proof -
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    54
  note mono = continuous_mono[OF `continuous F`]
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    55
  { fix i have "(F^i) bot \<le> lfp F"
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    56
    proof (induct i)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    57
      show "(F^0) bot \<le> lfp F" by simp
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    58
    next
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    59
      case (Suc i)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    60
      have "(F^(Suc i)) bot = F((F^i) bot)" by simp
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    61
      also have "\<dots> \<le> F(lfp F)" by(rule monoD[OF mono Suc])
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    62
      also have "\<dots> = lfp F" by(simp add:lfp_unfold[OF mono, symmetric])
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    63
      finally show ?case .
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    64
    qed }
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    65
  hence "(SUP i. (F^i) bot) \<le> lfp F" by (blast intro!:SUP_leI)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    66
  moreover have "lfp F \<le> (SUP i. (F^i) bot)" (is "_ \<le> ?U")
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    67
  proof (rule lfp_lowerbound)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    68
    have "chain(%i. (F^i) bot)"
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    69
    proof -
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    70
      { fix i have "(F^i) bot \<le> (F^(Suc i)) bot"
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    71
	proof (induct i)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    72
	  case 0 show ?case by simp
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    73
	next
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    74
	  case Suc thus ?case using monoD[OF mono Suc] by auto
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    75
	qed }
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    76
      thus ?thesis by(auto simp add:chain_def)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    77
    qed
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    78
    hence "F ?U = (SUP i. (F^(i+1)) bot)" using `continuous F` by (simp add:continuous_def)
22431
28344ccffc35 Adapted to changes in definition of SUP.
berghofe
parents: 22422
diff changeset
    79
    also have "\<dots> \<le> ?U" by(fast intro:SUP_leI le_SUPI)
21312
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    80
    finally show "F ?U \<le> ?U" .
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    81
  qed
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    82
  ultimately show ?thesis by (blast intro:order_antisym)
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    83
qed
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    84
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    85
text{* The following development is just for sets but presents an up
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    86
and a down version of chains and continuity and covers @{const gfp}. *}
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    87
1d39091a3208 started reorgnization of lattice theories
nipkow
parents: 19736
diff changeset
    88
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
    89
subsection "Chains"
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
    90
19736
wenzelm
parents: 15140
diff changeset
    91
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21312
diff changeset
    92
  up_chain :: "(nat => 'a set) => bool" where
19736
wenzelm
parents: 15140
diff changeset
    93
  "up_chain F = (\<forall>i. F i \<subseteq> F (Suc i))"
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
    94
11355
wenzelm
parents: 11351
diff changeset
    95
lemma up_chainI: "(!!i. F i \<subseteq> F (Suc i)) ==> up_chain F"
wenzelm
parents: 11351
diff changeset
    96
  by (simp add: up_chain_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
    97
11355
wenzelm
parents: 11351
diff changeset
    98
lemma up_chainD: "up_chain F ==> F i \<subseteq> F (Suc i)"
wenzelm
parents: 11351
diff changeset
    99
  by (simp add: up_chain_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   100
19736
wenzelm
parents: 15140
diff changeset
   101
lemma up_chain_less_mono:
wenzelm
parents: 15140
diff changeset
   102
    "up_chain F ==> x < y ==> F x \<subseteq> F y"
wenzelm
parents: 15140
diff changeset
   103
  apply (induct y)
wenzelm
parents: 15140
diff changeset
   104
   apply (blast dest: up_chainD elim: less_SucE)+
11355
wenzelm
parents: 11351
diff changeset
   105
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   106
11355
wenzelm
parents: 11351
diff changeset
   107
lemma up_chain_mono: "up_chain F ==> x \<le> y ==> F x \<subseteq> F y"
wenzelm
parents: 11351
diff changeset
   108
  apply (drule le_imp_less_or_eq)
wenzelm
parents: 11351
diff changeset
   109
  apply (blast dest: up_chain_less_mono)
wenzelm
parents: 11351
diff changeset
   110
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   111
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   112
19736
wenzelm
parents: 15140
diff changeset
   113
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21312
diff changeset
   114
  down_chain :: "(nat => 'a set) => bool" where
19736
wenzelm
parents: 15140
diff changeset
   115
  "down_chain F = (\<forall>i. F (Suc i) \<subseteq> F i)"
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   116
11355
wenzelm
parents: 11351
diff changeset
   117
lemma down_chainI: "(!!i. F (Suc i) \<subseteq> F i) ==> down_chain F"
wenzelm
parents: 11351
diff changeset
   118
  by (simp add: down_chain_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   119
11355
wenzelm
parents: 11351
diff changeset
   120
lemma down_chainD: "down_chain F ==> F (Suc i) \<subseteq> F i"
wenzelm
parents: 11351
diff changeset
   121
  by (simp add: down_chain_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   122
19736
wenzelm
parents: 15140
diff changeset
   123
lemma down_chain_less_mono:
wenzelm
parents: 15140
diff changeset
   124
    "down_chain F ==> x < y ==> F y \<subseteq> F x"
wenzelm
parents: 15140
diff changeset
   125
  apply (induct y)
wenzelm
parents: 15140
diff changeset
   126
   apply (blast dest: down_chainD elim: less_SucE)+
11355
wenzelm
parents: 11351
diff changeset
   127
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   128
11355
wenzelm
parents: 11351
diff changeset
   129
lemma down_chain_mono: "down_chain F ==> x \<le> y ==> F y \<subseteq> F x"
wenzelm
parents: 11351
diff changeset
   130
  apply (drule le_imp_less_or_eq)
wenzelm
parents: 11351
diff changeset
   131
  apply (blast dest: down_chain_less_mono)
wenzelm
parents: 11351
diff changeset
   132
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   133
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   134
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   135
subsection "Continuity"
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   136
19736
wenzelm
parents: 15140
diff changeset
   137
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21312
diff changeset
   138
  up_cont :: "('a set => 'a set) => bool" where
19736
wenzelm
parents: 15140
diff changeset
   139
  "up_cont f = (\<forall>F. up_chain F --> f (\<Union>(range F)) = \<Union>(f ` range F))"
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   140
11355
wenzelm
parents: 11351
diff changeset
   141
lemma up_contI:
24331
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   142
  "(!!F. up_chain F ==> f (\<Union>(range F)) = \<Union>(f ` range F)) ==> up_cont f"
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   143
apply (unfold up_cont_def)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   144
apply blast
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   145
done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   146
11355
wenzelm
parents: 11351
diff changeset
   147
lemma up_contD:
24331
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   148
  "up_cont f ==> up_chain F ==> f (\<Union>(range F)) = \<Union>(f ` range F)"
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   149
apply (unfold up_cont_def)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   150
apply auto
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   151
done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   152
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   153
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   154
lemma up_cont_mono: "up_cont f ==> mono f"
24331
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   155
apply (rule monoI)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   156
apply (drule_tac F = "\<lambda>i. if i = 0 then A else B" in up_contD)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   157
 apply (rule up_chainI)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   158
 apply simp
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   159
apply (drule Un_absorb1)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   160
apply (auto simp add: nat_not_singleton)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   161
done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   162
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   163
19736
wenzelm
parents: 15140
diff changeset
   164
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21312
diff changeset
   165
  down_cont :: "('a set => 'a set) => bool" where
19736
wenzelm
parents: 15140
diff changeset
   166
  "down_cont f =
wenzelm
parents: 15140
diff changeset
   167
    (\<forall>F. down_chain F --> f (Inter (range F)) = Inter (f ` range F))"
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   168
11355
wenzelm
parents: 11351
diff changeset
   169
lemma down_contI:
wenzelm
parents: 11351
diff changeset
   170
  "(!!F. down_chain F ==> f (Inter (range F)) = Inter (f ` range F)) ==>
wenzelm
parents: 11351
diff changeset
   171
    down_cont f"
wenzelm
parents: 11351
diff changeset
   172
  apply (unfold down_cont_def)
wenzelm
parents: 11351
diff changeset
   173
  apply blast
wenzelm
parents: 11351
diff changeset
   174
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   175
11355
wenzelm
parents: 11351
diff changeset
   176
lemma down_contD: "down_cont f ==> down_chain F ==>
wenzelm
parents: 11351
diff changeset
   177
    f (Inter (range F)) = Inter (f ` range F)"
wenzelm
parents: 11351
diff changeset
   178
  apply (unfold down_cont_def)
wenzelm
parents: 11351
diff changeset
   179
  apply auto
wenzelm
parents: 11351
diff changeset
   180
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   181
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   182
lemma down_cont_mono: "down_cont f ==> mono f"
24331
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   183
apply (rule monoI)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   184
apply (drule_tac F = "\<lambda>i. if i = 0 then B else A" in down_contD)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   185
 apply (rule down_chainI)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   186
 apply simp
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   187
apply (drule Int_absorb1)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   188
apply (auto simp add: nat_not_singleton)
76f7a8c6e842 Made UN_Un simp
nipkow
parents: 23752
diff changeset
   189
done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   190
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   191
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   192
subsection "Iteration"
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   193
19736
wenzelm
parents: 15140
diff changeset
   194
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21312
diff changeset
   195
  up_iterate :: "('a set => 'a set) => nat => 'a set" where
19736
wenzelm
parents: 15140
diff changeset
   196
  "up_iterate f n = (f^n) {}"
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   197
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   198
lemma up_iterate_0 [simp]: "up_iterate f 0 = {}"
11355
wenzelm
parents: 11351
diff changeset
   199
  by (simp add: up_iterate_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   200
11355
wenzelm
parents: 11351
diff changeset
   201
lemma up_iterate_Suc [simp]: "up_iterate f (Suc i) = f (up_iterate f i)"
wenzelm
parents: 11351
diff changeset
   202
  by (simp add: up_iterate_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   203
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   204
lemma up_iterate_chain: "mono F ==> up_chain (up_iterate F)"
11355
wenzelm
parents: 11351
diff changeset
   205
  apply (rule up_chainI)
wenzelm
parents: 11351
diff changeset
   206
  apply (induct_tac i)
wenzelm
parents: 11351
diff changeset
   207
   apply simp+
wenzelm
parents: 11351
diff changeset
   208
  apply (erule (1) monoD)
wenzelm
parents: 11351
diff changeset
   209
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   210
11355
wenzelm
parents: 11351
diff changeset
   211
lemma UNION_up_iterate_is_fp:
wenzelm
parents: 11351
diff changeset
   212
  "up_cont F ==>
wenzelm
parents: 11351
diff changeset
   213
    F (UNION UNIV (up_iterate F)) = UNION UNIV (up_iterate F)"
wenzelm
parents: 11351
diff changeset
   214
  apply (frule up_cont_mono [THEN up_iterate_chain])
wenzelm
parents: 11351
diff changeset
   215
  apply (drule (1) up_contD)
wenzelm
parents: 11351
diff changeset
   216
  apply simp
wenzelm
parents: 11351
diff changeset
   217
  apply (auto simp del: up_iterate_Suc simp add: up_iterate_Suc [symmetric])
wenzelm
parents: 11351
diff changeset
   218
  apply (case_tac xa)
wenzelm
parents: 11351
diff changeset
   219
   apply auto
wenzelm
parents: 11351
diff changeset
   220
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   221
11355
wenzelm
parents: 11351
diff changeset
   222
lemma UNION_up_iterate_lowerbound:
wenzelm
parents: 11351
diff changeset
   223
    "mono F ==> F P = P ==> UNION UNIV (up_iterate F) \<subseteq> P"
wenzelm
parents: 11351
diff changeset
   224
  apply (subgoal_tac "(!!i. up_iterate F i \<subseteq> P)")
wenzelm
parents: 11351
diff changeset
   225
   apply fast
wenzelm
parents: 11351
diff changeset
   226
  apply (induct_tac i)
wenzelm
parents: 11351
diff changeset
   227
  prefer 2 apply (drule (1) monoD)
wenzelm
parents: 11351
diff changeset
   228
   apply auto
wenzelm
parents: 11351
diff changeset
   229
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   230
11355
wenzelm
parents: 11351
diff changeset
   231
lemma UNION_up_iterate_is_lfp:
wenzelm
parents: 11351
diff changeset
   232
    "up_cont F ==> lfp F = UNION UNIV (up_iterate F)"
wenzelm
parents: 11351
diff changeset
   233
  apply (rule set_eq_subset [THEN iffD2])
wenzelm
parents: 11351
diff changeset
   234
  apply (rule conjI)
wenzelm
parents: 11351
diff changeset
   235
   prefer 2
wenzelm
parents: 11351
diff changeset
   236
   apply (drule up_cont_mono)
wenzelm
parents: 11351
diff changeset
   237
   apply (rule UNION_up_iterate_lowerbound)
wenzelm
parents: 11351
diff changeset
   238
    apply assumption
wenzelm
parents: 11351
diff changeset
   239
   apply (erule lfp_unfold [symmetric])
wenzelm
parents: 11351
diff changeset
   240
  apply (rule lfp_lowerbound)
wenzelm
parents: 11351
diff changeset
   241
  apply (rule set_eq_subset [THEN iffD1, THEN conjunct2])
wenzelm
parents: 11351
diff changeset
   242
  apply (erule UNION_up_iterate_is_fp [symmetric])
wenzelm
parents: 11351
diff changeset
   243
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   244
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   245
19736
wenzelm
parents: 15140
diff changeset
   246
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 21312
diff changeset
   247
  down_iterate :: "('a set => 'a set) => nat => 'a set" where
19736
wenzelm
parents: 15140
diff changeset
   248
  "down_iterate f n = (f^n) UNIV"
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   249
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   250
lemma down_iterate_0 [simp]: "down_iterate f 0 = UNIV"
11355
wenzelm
parents: 11351
diff changeset
   251
  by (simp add: down_iterate_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   252
11355
wenzelm
parents: 11351
diff changeset
   253
lemma down_iterate_Suc [simp]:
wenzelm
parents: 11351
diff changeset
   254
    "down_iterate f (Suc i) = f (down_iterate f i)"
wenzelm
parents: 11351
diff changeset
   255
  by (simp add: down_iterate_def)
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   256
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   257
lemma down_iterate_chain: "mono F ==> down_chain (down_iterate F)"
11355
wenzelm
parents: 11351
diff changeset
   258
  apply (rule down_chainI)
wenzelm
parents: 11351
diff changeset
   259
  apply (induct_tac i)
wenzelm
parents: 11351
diff changeset
   260
   apply simp+
wenzelm
parents: 11351
diff changeset
   261
  apply (erule (1) monoD)
wenzelm
parents: 11351
diff changeset
   262
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   263
11355
wenzelm
parents: 11351
diff changeset
   264
lemma INTER_down_iterate_is_fp:
wenzelm
parents: 11351
diff changeset
   265
  "down_cont F ==>
wenzelm
parents: 11351
diff changeset
   266
    F (INTER UNIV (down_iterate F)) = INTER UNIV (down_iterate F)"
wenzelm
parents: 11351
diff changeset
   267
  apply (frule down_cont_mono [THEN down_iterate_chain])
wenzelm
parents: 11351
diff changeset
   268
  apply (drule (1) down_contD)
wenzelm
parents: 11351
diff changeset
   269
  apply simp
wenzelm
parents: 11351
diff changeset
   270
  apply (auto simp del: down_iterate_Suc simp add: down_iterate_Suc [symmetric])
wenzelm
parents: 11351
diff changeset
   271
  apply (case_tac xa)
wenzelm
parents: 11351
diff changeset
   272
   apply auto
wenzelm
parents: 11351
diff changeset
   273
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   274
11355
wenzelm
parents: 11351
diff changeset
   275
lemma INTER_down_iterate_upperbound:
wenzelm
parents: 11351
diff changeset
   276
    "mono F ==> F P = P ==> P \<subseteq> INTER UNIV (down_iterate F)"
wenzelm
parents: 11351
diff changeset
   277
  apply (subgoal_tac "(!!i. P \<subseteq> down_iterate F i)")
wenzelm
parents: 11351
diff changeset
   278
   apply fast
wenzelm
parents: 11351
diff changeset
   279
  apply (induct_tac i)
wenzelm
parents: 11351
diff changeset
   280
  prefer 2 apply (drule (1) monoD)
wenzelm
parents: 11351
diff changeset
   281
   apply auto
wenzelm
parents: 11351
diff changeset
   282
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   283
11355
wenzelm
parents: 11351
diff changeset
   284
lemma INTER_down_iterate_is_gfp:
wenzelm
parents: 11351
diff changeset
   285
    "down_cont F ==> gfp F = INTER UNIV (down_iterate F)"
wenzelm
parents: 11351
diff changeset
   286
  apply (rule set_eq_subset [THEN iffD2])
wenzelm
parents: 11351
diff changeset
   287
  apply (rule conjI)
wenzelm
parents: 11351
diff changeset
   288
   apply (drule down_cont_mono)
wenzelm
parents: 11351
diff changeset
   289
   apply (rule INTER_down_iterate_upperbound)
wenzelm
parents: 11351
diff changeset
   290
    apply assumption
wenzelm
parents: 11351
diff changeset
   291
   apply (erule gfp_unfold [symmetric])
wenzelm
parents: 11351
diff changeset
   292
  apply (rule gfp_upperbound)
wenzelm
parents: 11351
diff changeset
   293
  apply (rule set_eq_subset [THEN iffD1, THEN conjunct2])
wenzelm
parents: 11351
diff changeset
   294
  apply (erule INTER_down_iterate_is_fp)
wenzelm
parents: 11351
diff changeset
   295
  done
11351
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   296
c5c403d30c77 added Library/Nat_Infinity.thy and Library/Continuity.thy
oheimb
parents:
diff changeset
   297
end