121 |
121 |
122 subsection {* Monadic unit and plus *} |
122 subsection {* Monadic unit and plus *} |
123 |
123 |
124 definition |
124 definition |
125 lower_unit :: "'a \<rightarrow> 'a lower_pd" where |
125 lower_unit :: "'a \<rightarrow> 'a lower_pd" where |
126 "lower_unit = compact_basis.basis_fun (\<lambda>a. lower_principal (PDUnit a))" |
126 "lower_unit = compact_basis.extension (\<lambda>a. lower_principal (PDUnit a))" |
127 |
127 |
128 definition |
128 definition |
129 lower_plus :: "'a lower_pd \<rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd" where |
129 lower_plus :: "'a lower_pd \<rightarrow> 'a lower_pd \<rightarrow> 'a lower_pd" where |
130 "lower_plus = lower_pd.basis_fun (\<lambda>t. lower_pd.basis_fun (\<lambda>u. |
130 "lower_plus = lower_pd.extension (\<lambda>t. lower_pd.extension (\<lambda>u. |
131 lower_principal (PDPlus t u)))" |
131 lower_principal (PDPlus t u)))" |
132 |
132 |
133 abbreviation |
133 abbreviation |
134 lower_add :: "'a lower_pd \<Rightarrow> 'a lower_pd \<Rightarrow> 'a lower_pd" |
134 lower_add :: "'a lower_pd \<Rightarrow> 'a lower_pd \<Rightarrow> 'a lower_pd" |
135 (infixl "+\<flat>" 65) where |
135 (infixl "+\<flat>" 65) where |
143 "{x}\<flat>" == "CONST lower_unit\<cdot>x" |
143 "{x}\<flat>" == "CONST lower_unit\<cdot>x" |
144 |
144 |
145 lemma lower_unit_Rep_compact_basis [simp]: |
145 lemma lower_unit_Rep_compact_basis [simp]: |
146 "{Rep_compact_basis a}\<flat> = lower_principal (PDUnit a)" |
146 "{Rep_compact_basis a}\<flat> = lower_principal (PDUnit a)" |
147 unfolding lower_unit_def |
147 unfolding lower_unit_def |
148 by (simp add: compact_basis.basis_fun_principal PDUnit_lower_mono) |
148 by (simp add: compact_basis.extension_principal PDUnit_lower_mono) |
149 |
149 |
150 lemma lower_plus_principal [simp]: |
150 lemma lower_plus_principal [simp]: |
151 "lower_principal t +\<flat> lower_principal u = lower_principal (PDPlus t u)" |
151 "lower_principal t +\<flat> lower_principal u = lower_principal (PDPlus t u)" |
152 unfolding lower_plus_def |
152 unfolding lower_plus_def |
153 by (simp add: lower_pd.basis_fun_principal |
153 by (simp add: lower_pd.extension_principal |
154 lower_pd.basis_fun_mono PDPlus_lower_mono) |
154 lower_pd.extension_mono PDPlus_lower_mono) |
155 |
155 |
156 interpretation lower_add: semilattice lower_add proof |
156 interpretation lower_add: semilattice lower_add proof |
157 fix xs ys zs :: "'a lower_pd" |
157 fix xs ys zs :: "'a lower_pd" |
158 show "(xs +\<flat> ys) +\<flat> zs = xs +\<flat> (ys +\<flat> zs)" |
158 show "(xs +\<flat> ys) +\<flat> zs = xs +\<flat> (ys +\<flat> zs)" |
159 apply (induct xs ys arbitrary: zs rule: lower_pd.principal_induct2, simp, simp) |
159 apply (induct xs ys arbitrary: zs rule: lower_pd.principal_induct2, simp, simp) |
333 apply simp |
333 apply simp |
334 done |
334 done |
335 |
335 |
336 definition |
336 definition |
337 lower_bind :: "'a lower_pd \<rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where |
337 lower_bind :: "'a lower_pd \<rightarrow> ('a \<rightarrow> 'b lower_pd) \<rightarrow> 'b lower_pd" where |
338 "lower_bind = lower_pd.basis_fun lower_bind_basis" |
338 "lower_bind = lower_pd.extension lower_bind_basis" |
339 |
339 |
340 syntax |
340 syntax |
341 "_lower_bind" :: "[logic, logic, logic] \<Rightarrow> logic" |
341 "_lower_bind" :: "[logic, logic, logic] \<Rightarrow> logic" |
342 ("(3\<Union>\<flat>_\<in>_./ _)" [0, 0, 10] 10) |
342 ("(3\<Union>\<flat>_\<in>_./ _)" [0, 0, 10] 10) |
343 |
343 |
345 "\<Union>\<flat>x\<in>xs. e" == "CONST lower_bind\<cdot>xs\<cdot>(\<Lambda> x. e)" |
345 "\<Union>\<flat>x\<in>xs. e" == "CONST lower_bind\<cdot>xs\<cdot>(\<Lambda> x. e)" |
346 |
346 |
347 lemma lower_bind_principal [simp]: |
347 lemma lower_bind_principal [simp]: |
348 "lower_bind\<cdot>(lower_principal t) = lower_bind_basis t" |
348 "lower_bind\<cdot>(lower_principal t) = lower_bind_basis t" |
349 unfolding lower_bind_def |
349 unfolding lower_bind_def |
350 apply (rule lower_pd.basis_fun_principal) |
350 apply (rule lower_pd.extension_principal) |
351 apply (erule lower_bind_basis_mono) |
351 apply (erule lower_bind_basis_mono) |
352 done |
352 done |
353 |
353 |
354 lemma lower_bind_unit [simp]: |
354 lemma lower_bind_unit [simp]: |
355 "lower_bind\<cdot>{x}\<flat>\<cdot>f = f\<cdot>x" |
355 "lower_bind\<cdot>{x}\<flat>\<cdot>f = f\<cdot>x" |