Jon Sterling on Nostr: The code is kind of specific to my type theory, but the idea is the following: 1. ...
The code is kind of specific to my type theory, but the idea is the following:
1. Usually at the mode shift, you use conversion to check type equality. Here, we do that and stop if it succeeds.
2. If that doesn't succeed, we look at the goal type. If it is a type that has an eta law, then we can just blindly apply an introduction rule, and append the corresponding elimination form to the term we are trying to coerce. We do this recursively.
The goal of an algorithm like this is to support "deep" subtyping through all negative types, without having *actual* subtyping in the core language. Forms of subtyping where this is useful include things like singleton types, extension types, or partially instantiated record types (as in Arend or ML modules, and as in my own depicted experimental code).
Published at
2025-02-22 21:57:07Event JSON
{
"id": "163dcc32f5741c4a8bf758f554c995342eb5b2e4dbf51308e8e58a4efe13b38f",
"pubkey": "ba51d3bb7fc92891016b5873c0b4f7c6a0550c964ec565ece24b6fc2dcf93301",
"created_at": 1740261427,
"kind": 1,
"tags": [
[
"e",
"90db7f340366f1b5595af2b504c64a3f042674200f6bcad12ecf2c20f979c2b0",
"wss://relay.mostr.pub",
"reply"
],
[
"proxy",
"https://mathstodon.xyz/users/jonmsterling/statuses/114049772942200068",
"activitypub"
]
],
"content": "The code is kind of specific to my type theory, but the idea is the following:\n\n1. Usually at the mode shift, you use conversion to check type equality. Here, we do that and stop if it succeeds.\n\n2. If that doesn't succeed, we look at the goal type. If it is a type that has an eta law, then we can just blindly apply an introduction rule, and append the corresponding elimination form to the term we are trying to coerce. We do this recursively.\n\nThe goal of an algorithm like this is to support \"deep\" subtyping through all negative types, without having *actual* subtyping in the core language. Forms of subtyping where this is useful include things like singleton types, extension types, or partially instantiated record types (as in Arend or ML modules, and as in my own depicted experimental code).",
"sig": "4bc024812055070f705ce9b4e8530cc19a544215b5c38236f7233bfa2db1d66fcdf77f4c057921b0b38b741c23fbcf0e3882a5f183054ef06fda180f558d0d60"
}