1276 \item @{command (HOL) "print_quotmaps"} prints quotient map functions. |
1276 \item @{command (HOL) "print_quotmaps"} prints quotient map functions. |
1277 |
1277 |
1278 \item @{command (HOL) "print_quotients"} prints quotients. |
1278 \item @{command (HOL) "print_quotients"} prints quotients. |
1279 |
1279 |
1280 \item @{command (HOL) "print_quotconsts"} prints quotient constants. |
1280 \item @{command (HOL) "print_quotconsts"} prints quotient constants. |
|
1281 |
|
1282 \end{description} |
|
1283 |
|
1284 *} |
|
1285 |
|
1286 section {* Coercive subtyping *} |
|
1287 |
|
1288 text {* |
|
1289 \begin{matharray}{rcl} |
|
1290 @{attribute_def (HOL) coercion} & : & @{text attribute} \\ |
|
1291 @{attribute_def (HOL) coercion_enabled} & : & @{text attribute} \\ |
|
1292 @{attribute_def (HOL) coercion_map} & : & @{text attribute} \\ |
|
1293 \end{matharray} |
|
1294 |
|
1295 @{rail " |
|
1296 @@{attribute (HOL) coercion} (@{syntax term})? |
|
1297 ; |
|
1298 "} |
|
1299 @{rail " |
|
1300 @@{attribute (HOL) coercion_map} (@{syntax term})? |
|
1301 ; |
|
1302 "} |
|
1303 |
|
1304 Coercive subtyping allows the user to omit explicit type conversions, |
|
1305 also called \emph{coercions}. Type inference will add them as |
|
1306 necessary when parsing a term. See |
|
1307 \cite{traytel-berghofer-nipkow-2011} for details. |
|
1308 |
|
1309 \begin{description} |
|
1310 |
|
1311 \item @{attribute (HOL) "coercion"}~@{text "f"} registers a new |
|
1312 coercion function @{text "f :: \<sigma>\<^isub>1 \<Rightarrow> |
|
1313 \<sigma>\<^isub>2"} where @{text "\<sigma>\<^isub>1"} and @{text |
|
1314 "\<sigma>\<^isub>2"} are nullary type constructors. Coercions are |
|
1315 composed by the inference algorithm if needed. Note that the type |
|
1316 inference algorithm is complete only if the registered coercions form |
|
1317 a lattice. |
|
1318 |
|
1319 |
|
1320 \item @{attribute (HOL) "coercion_map"}~@{text "map"} registers a new |
|
1321 map function to lift coercions through type constructors. The function |
|
1322 @{text "map"} must conform to the following type pattern |
|
1323 |
|
1324 \begin{matharray}{lll} |
|
1325 @{text "map"} & @{text "::"} & |
|
1326 @{text "f\<^isub>1 \<Rightarrow> \<dots> \<Rightarrow> f\<^isub>n \<Rightarrow> (\<alpha>\<^isub>1, \<dots>, \<alpha>\<^isub>n) t \<Rightarrow> (\<beta>\<^isub>1, \<dots>, \<beta>\<^isub>n) t"} \\ |
|
1327 \end{matharray} |
|
1328 |
|
1329 where @{text "t"} is a type constructor and @{text "f\<^isub>i"} is of |
|
1330 type @{text "\<alpha>\<^isub>i \<Rightarrow> \<beta>\<^isub>i"} or |
|
1331 @{text "\<beta>\<^isub>i \<Rightarrow> \<alpha>\<^isub>i"}. |
|
1332 Registering a map function overwrites any existing map function for |
|
1333 this particular type constructor. |
|
1334 |
|
1335 |
|
1336 \item @{attribute (HOL) "coercion_enabled"} enables the coercion |
|
1337 inference algorithm. |
1281 |
1338 |
1282 \end{description} |
1339 \end{description} |
1283 |
1340 |
1284 *} |
1341 *} |
1285 |
1342 |