|
3 | 3 | use ustr::ustr; |
4 | 4 |
|
5 | 5 | use crate::dbl::theory::*; |
6 | | -use crate::one::{Path, fp_category::UstrFpCategory}; |
| 6 | +use crate::one::{fp_category::UstrFpCategory, Path}; |
7 | 7 |
|
8 | 8 | /** The empty theory, which has a single model, the empty model. |
9 | 9 |
|
@@ -151,6 +151,11 @@ pub fn th_sym_monoidal_category() -> UstrModalDblTheory { |
151 | 151 | th_list_algebra(List::Symmetric) |
152 | 152 | } |
153 | 153 |
|
| 154 | +/// |
| 155 | +pub fn th_modal_state_aux() -> UstrModalDblTheory { |
| 156 | + th_modal_sf(List::Plain) |
| 157 | +} |
| 158 | + |
154 | 159 | /** The theory of a strict algebra of a list monad. |
155 | 160 |
|
156 | 161 | This is a modal double theory, parametric over which variant of the double list |
@@ -194,6 +199,22 @@ fn th_list_lax_algebra(list: List) -> UstrModalDblTheory { |
194 | 199 | th |
195 | 200 | } |
196 | 201 |
|
| 202 | +/// |
| 203 | +fn th_modal_sf(list: List) -> UstrModalDblTheory { |
| 204 | + let m = Modality::List(list); |
| 205 | + let mut th: UstrModalDblTheory = Default::default(); |
| 206 | + let (state, aux) = (ustr("State"), ustr("Auxiliary")); |
| 207 | + th.add_ob_type(state); |
| 208 | + th.add_ob_type(aux); |
| 209 | + let function = ustr("function"); |
| 210 | + th.add_mor_type(function, ModeApp::new(aux).apply(m), ModeApp::new(aux)); |
| 211 | + let (borrow, outpos, outneg) = (ustr("borrow"), ustr("out-pos"), ustr("out-neg")); |
| 212 | + th.add_mor_type(borrow, ModeApp::new(state), ModeApp::new(aux)); |
| 213 | + th.add_mor_type(outpos, ModeApp::new(aux), ModeApp::new(state)); |
| 214 | + th.add_mor_type(outneg, ModeApp::new(aux), ModeApp::new(state)); |
| 215 | + th |
| 216 | +} |
| 217 | + |
197 | 218 | #[cfg(test)] |
198 | 219 | mod tests { |
199 | 220 | use super::*; |
@@ -221,6 +242,7 @@ mod tests { |
221 | 242 | fn validate_modal_theories() { |
222 | 243 | assert!(th_monoidal_category().validate().is_ok()); |
223 | 244 | assert!(th_lax_monoidal_category().validate().is_ok()); |
| 245 | + assert!(th_modal_state_aux().validate().is_ok()); |
224 | 246 | } |
225 | 247 |
|
226 | 248 | #[test] |
|
0 commit comments