35 \<close> |
35 \<close> |
36 |
36 |
37 subsection \<open>Continuity for complete lattices\<close> |
37 subsection \<open>Continuity for complete lattices\<close> |
38 |
38 |
39 definition |
39 definition |
40 sup_continuous :: "('a::complete_lattice \<Rightarrow> 'a::complete_lattice) \<Rightarrow> bool" where |
40 sup_continuous :: "('a::complete_lattice \<Rightarrow> 'b::complete_lattice) \<Rightarrow> bool" where |
41 "sup_continuous F \<longleftrightarrow> (\<forall>M::nat \<Rightarrow> 'a. mono M \<longrightarrow> F (SUP i. M i) = (SUP i. F (M i)))" |
41 "sup_continuous F \<longleftrightarrow> (\<forall>M::nat \<Rightarrow> 'a. mono M \<longrightarrow> F (SUP i. M i) = (SUP i. F (M i)))" |
42 |
42 |
43 lemma sup_continuousD: "sup_continuous F \<Longrightarrow> mono M \<Longrightarrow> F (SUP i::nat. M i) = (SUP i. F (M i))" |
43 lemma sup_continuousD: "sup_continuous F \<Longrightarrow> mono M \<Longrightarrow> F (SUP i::nat. M i) = (SUP i. F (M i))" |
44 by (auto simp: sup_continuous_def) |
44 by (auto simp: sup_continuous_def) |
45 |
45 |
46 lemma sup_continuous_mono: |
46 lemma sup_continuous_mono: |
47 fixes F :: "'a::complete_lattice \<Rightarrow> 'a::complete_lattice" |
|
48 assumes [simp]: "sup_continuous F" shows "mono F" |
47 assumes [simp]: "sup_continuous F" shows "mono F" |
49 proof |
48 proof |
50 fix A B :: "'a" assume [simp]: "A \<le> B" |
49 fix A B :: "'a" assume [simp]: "A \<le> B" |
51 have "F B = F (SUP n::nat. if n = 0 then A else B)" |
50 have "F B = F (SUP n::nat. if n = 0 then A else B)" |
52 by (simp add: sup_absorb2 SUP_nat_binary) |
51 by (simp add: sup_absorb2 SUP_nat_binary) |
53 also have "\<dots> = (SUP n::nat. if n = 0 then F A else F B)" |
52 also have "\<dots> = (SUP n::nat. if n = 0 then F A else F B)" |
54 by (auto simp: sup_continuousD mono_def intro!: SUP_cong) |
53 by (auto simp: sup_continuousD mono_def intro!: SUP_cong) |
55 finally show "F A \<le> F B" |
54 finally show "F A \<le> F B" |
56 by (simp add: SUP_nat_binary le_iff_sup) |
55 by (simp add: SUP_nat_binary le_iff_sup) |
|
56 qed |
|
57 |
|
58 lemma sup_continuous_intros: |
|
59 shows sup_continuous_const: "sup_continuous (\<lambda>x. c)" |
|
60 and sup_continuous_id: "sup_continuous (\<lambda>x. x)" |
|
61 and sup_continuous_apply: "sup_continuous (\<lambda>f. f x)" |
|
62 and sup_continuous_fun: "(\<And>s. sup_continuous (\<lambda>x. P x s)) \<Longrightarrow> sup_continuous P" |
|
63 by (auto simp: sup_continuous_def) |
|
64 |
|
65 lemma sup_continuous_compose: |
|
66 assumes f: "sup_continuous f" and g: "sup_continuous g" |
|
67 shows "sup_continuous (\<lambda>x. f (g x))" |
|
68 unfolding sup_continuous_def |
|
69 proof safe |
|
70 fix M :: "nat \<Rightarrow> 'c" assume "mono M" |
|
71 moreover then have "mono (\<lambda>i. g (M i))" |
|
72 using sup_continuous_mono[OF g] by (auto simp: mono_def) |
|
73 ultimately show "f (g (SUPREMUM UNIV M)) = (SUP i. f (g (M i)))" |
|
74 by (auto simp: sup_continuous_def g[THEN sup_continuousD] f[THEN sup_continuousD]) |
57 qed |
75 qed |
58 |
76 |
59 lemma sup_continuous_lfp: |
77 lemma sup_continuous_lfp: |
60 assumes "sup_continuous F" shows "lfp F = (SUP i. (F ^^ i) bot)" (is "lfp F = ?U") |
78 assumes "sup_continuous F" shows "lfp F = (SUP i. (F ^^ i) bot)" (is "lfp F = ?U") |
61 proof (rule antisym) |
79 proof (rule antisym) |
103 ultimately show ?thesis |
121 ultimately show ?thesis |
104 unfolding sup_continuous_lfp[OF g] by simp |
122 unfolding sup_continuous_lfp[OF g] by simp |
105 qed |
123 qed |
106 |
124 |
107 definition |
125 definition |
108 inf_continuous :: "('a::complete_lattice \<Rightarrow> 'a::complete_lattice) \<Rightarrow> bool" where |
126 inf_continuous :: "('a::complete_lattice \<Rightarrow> 'b::complete_lattice) \<Rightarrow> bool" where |
109 "inf_continuous F \<longleftrightarrow> (\<forall>M::nat \<Rightarrow> 'a. antimono M \<longrightarrow> F (INF i. M i) = (INF i. F (M i)))" |
127 "inf_continuous F \<longleftrightarrow> (\<forall>M::nat \<Rightarrow> 'a. antimono M \<longrightarrow> F (INF i. M i) = (INF i. F (M i)))" |
110 |
128 |
111 lemma inf_continuousD: "inf_continuous F \<Longrightarrow> antimono M \<Longrightarrow> F (INF i::nat. M i) = (INF i. F (M i))" |
129 lemma inf_continuousD: "inf_continuous F \<Longrightarrow> antimono M \<Longrightarrow> F (INF i::nat. M i) = (INF i. F (M i))" |
112 by (auto simp: inf_continuous_def) |
130 by (auto simp: inf_continuous_def) |
113 |
131 |
114 lemma inf_continuous_mono: |
132 lemma inf_continuous_mono: |
115 fixes F :: "'a::complete_lattice \<Rightarrow> 'a::complete_lattice" |
|
116 assumes [simp]: "inf_continuous F" shows "mono F" |
133 assumes [simp]: "inf_continuous F" shows "mono F" |
117 proof |
134 proof |
118 fix A B :: "'a" assume [simp]: "A \<le> B" |
135 fix A B :: "'a" assume [simp]: "A \<le> B" |
119 have "F A = F (INF n::nat. if n = 0 then B else A)" |
136 have "F A = F (INF n::nat. if n = 0 then B else A)" |
120 by (simp add: inf_absorb2 INF_nat_binary) |
137 by (simp add: inf_absorb2 INF_nat_binary) |
121 also have "\<dots> = (INF n::nat. if n = 0 then F B else F A)" |
138 also have "\<dots> = (INF n::nat. if n = 0 then F B else F A)" |
122 by (auto simp: inf_continuousD antimono_def intro!: INF_cong) |
139 by (auto simp: inf_continuousD antimono_def intro!: INF_cong) |
123 finally show "F A \<le> F B" |
140 finally show "F A \<le> F B" |
124 by (simp add: INF_nat_binary le_iff_inf inf_commute) |
141 by (simp add: INF_nat_binary le_iff_inf inf_commute) |
|
142 qed |
|
143 |
|
144 lemma inf_continuous_intros: |
|
145 shows inf_continuous_const: "inf_continuous (\<lambda>x. c)" |
|
146 and inf_continuous_id: "inf_continuous (\<lambda>x. x)" |
|
147 and inf_continuous_apply: "inf_continuous (\<lambda>f. f x)" |
|
148 and inf_continuous_fun: "(\<And>s. inf_continuous (\<lambda>x. P x s)) \<Longrightarrow> inf_continuous P" |
|
149 by (auto simp: inf_continuous_def) |
|
150 |
|
151 lemma inf_continuous_compose: |
|
152 assumes f: "inf_continuous f" and g: "inf_continuous g" |
|
153 shows "inf_continuous (\<lambda>x. f (g x))" |
|
154 unfolding inf_continuous_def |
|
155 proof safe |
|
156 fix M :: "nat \<Rightarrow> 'c" assume "antimono M" |
|
157 moreover then have "antimono (\<lambda>i. g (M i))" |
|
158 using inf_continuous_mono[OF g] by (auto simp: mono_def antimono_def) |
|
159 ultimately show "f (g (INFIMUM UNIV M)) = (INF i. f (g (M i)))" |
|
160 by (auto simp: inf_continuous_def g[THEN inf_continuousD] f[THEN inf_continuousD]) |
125 qed |
161 qed |
126 |
162 |
127 lemma inf_continuous_gfp: |
163 lemma inf_continuous_gfp: |
128 assumes "inf_continuous F" shows "gfp F = (INF i. (F ^^ i) top)" (is "gfp F = ?U") |
164 assumes "inf_continuous F" shows "gfp F = (INF i. (F ^^ i) top)" (is "gfp F = ?U") |
129 proof (rule antisym) |
165 proof (rule antisym) |