Concepts
The Subsumption Rule
The Subtype Relation
Slide QA1
Record Subtyping…
row type
index? record impl as list
width/depth/permulation
- multiple step rules
Java
- class - no index (thinking about offset)
having both width/permulation subtyping make impl slow
- OOP - hmm
- ML has no permulation - for perf reason (static structure) as C
ML has depth?
- a little bit by equality
OCaml objection has all three
Slide QA2
Looking at Contravariant!
-
(2)
{i1:S,i2:T}→U <: {i1:S,i2:T,i3:V}→U -
(4)
{i1:T,i2:V,i3:V} <: {i1:S,i2:U} * {i3:V}is interesting:
the interesting thing is, why don’t we make some subtyping rules for that as well?
- there are definitely code can do that
- their runtime semantics are different tho they carry same information
- coercion can used for that
3 and 4. (5) …
A <: Top => Top -> A <: A -> A – contravariant
if we only care (A*T), can use T:Top
but to type the whole thing : A
Top -> A?
but noticed that we said \z:A.z
can we pass A -> A into Top -> A?
more specific more general
smallest -> most specific -> A -> A
largest -> most specific -> Top -> A
- “The type Bool has no proper subtypes.” (I.e., the only type smaller than Bool is Bool itself.) Ture unless we have Bottom
hmm seems like Bottom in subtyping is different with Empty/Void, which is closer to logical Bottom ⊥ since Bottom here is subtyping of everything..
OH they are the same: (nice)
- True
Inversion Lemmas for Subtyping
inversion doesn’t lose information, induction does.
auto rememeber?? — dependent induction hetergeous equaltiy
In soundness proof
- subtyping only affects Canonical Forms + T_Sub case in induction
Lemma: If Gamma ⊢ \x:S1.t2 ∈ T, then there is a type S2 such that x⊢>S1; Gamma ⊢ t2 ∈ S2 and S1 → S2 <: T.
why T not arrow? Top…
if including Bottom…many proof becomes hard, canonical form need to say…might be Bottom?
no, no value has type Bottom (Void)…
What readers say
先看读者反馈,再直接在当前页面继续讨论。公共留言需要 Waline 服务端;配置后访客只填昵称即可发布。
这类长文如果结构清楚,我会一路读到底。这里最好的地方是把概念、公式和代码示例放在同一篇里。
数据库和工程文档的风格很实用,截图、SQL 和说明都能直接拿去复盘项目。
强化学习相关文章密度很高,但排版如果更清楚,回看体验会更好。这个新版方向是对的。
我更喜欢能快速扫到标签、修改时间和文章重点的首页,现在这种卡片视图会比纯列表更容易选读。
代码块只要语言标识和层级做好,技术博客的专业感会立刻上来。
评论区不用社交账号强绑定会更愿意留言,尤其是这种偏学习记录的网站。
Quick Identity
Pick a preset and leave a note
留言方式:先选择一个预设身份,再在下方输入评论。当前若显示“需要配置 Waline”,说明站点还缺少可写评论后端。
当前未选择预设身份