etb: entailment of BBQ under assumption OMG in the WTF system (omgwtfbbq)
[personal profile] etb
The usual story (e.g. TAPL chapter 20) is that either:
  • You have explicit "roll" and "unroll" term constructors (or "fold" and "unfold" if, unlike a cat, you don't enjoy rolling around on the ground) to introduce and eliminate the μ connective. This means that μα. 1 + α is definitely not the same type as [(μα.1+α) / α](1 + α) = 1 + (μα. 1+α): the type μα. 1 + α is inhabited by

    roll (inj1 ())

    (but not by inj1()) and 1 + (μα. 1+α) is inhabited by inj1(), but not by roll (inj1 ()). And then you call what you have "iso-recursive", because (μα. 1 + α) ≠ 1 + (μα. 1 + α), though there is an isomorphism between them. Or…
  • You don't have "roll" and "unroll", so you make μα. A(α) ~definitionally equal~ to A(μα. A(α)), meaning that you can't tell them apart, they're just different ways of notating exactly the same type.
But I think there's a sleight-of-hand in the "so" in the last sentence there. Why should those types have to be definitionally equal? It's perfectly fine for intersection type systems to have types that are "equivalent", in the sense of being mutual subtypes—like (A∧B) ≤ (B∧A) and (B∧A) ≤ (A∧B)—without waving around definitional equality and legislating that A ∧ B and B ∧ A are the same type expression. What I'm reading about recursive types seems to jump from "no explicit rolls" to "these types have the same inhabitants"—yes, sure—and then to "these are indistinguishable type expressions", which seems…anti-motivated (TAPL: "induction on type expressions…naturally no longer works").

I'm looking at this now because the "All Your Evaluation Order" draft currently has no rolls and unrolls in the source language, which led me to write in the draft that it's "equi-recursive", which led me to go back to TAPL to make sure I'm talking about it correctly. And now I guess I'm not, because I don't intend to wave a mace around just so I can declare that two types connected only by some isomorphism are "equal".

If I don't get this sorted, I'm just going to start rolling around: the draft's target language does have "roll", and the value of saying "ha ha bidirectional typing doesn't need any silly explicit 'rolls' in the source language" is low thanks to some other design decisions I've made, so silly explicit "rolls" are The Construction to Which No One Will Object. (I have no implementation of any of the four type systems who have walked into this bardraft, anyway, so it shouldn't matter too much if the source language is clunky in this respect.)

Date: 2015-02-23 11:46 am (UTC)
From: [personal profile] neelk
I think it's motivated, but you may simply not agree with the motivation.

The motivation for decreeing the type expressions to be the same is the Church-style view of types:

(a) expressions are intrinsically typed, and so
(b) it is not even grammatical to consider comparing terms of different type, meaning that
(c) if you can compare terms of apparently-different type, then they must actually be definitionally equal types.

If you are slightly heterodox (hi, Noam!) then you might relax "type equality" to "a subtype relation satisfying the refinement restriction", which means that two types in a subtype relation are actually refinements of the same base type.

Heretics like John Reynolds think it can make sense to take the intersection of any two types at all, which fully abandons the Church-style typing. So there's no longer any reason to assume that types with comparable inhabitants have even a refinement-style relationship.

Personally, I am agnostic about which view is the right one. Probably Noam is right as usual, but when I asked him about it at POPL, he gave me an answer involving Isbell duality.

Date: 2015-02-24 10:27 am (UTC)
From: [personal profile] neelk
There are some things I don't understand about implicit rolls. The obvious thing to do is to write:

Γ ⊢ e ⇐ A(μa. A(a))
————————————————————
Γ ⊢ e ⇐ μa. A(a)

Which isn't obviously algorithmic. What do you do instead?

Date: 2015-02-24 11:59 am (UTC)
From: [identity profile] fancybred.livejournal.com
Hello Joshua (and Neel!),


I'm not looking for a right view; intersection types (no refinement restriction) and intersection sorts (refinement restriction) are both perfectly sensible. Plus, whether something is a refinement seems to be a matter of perspective.


I agree completely that refinement is just a matter of perspective. What I would argue in the case of "intersections", though, is that it useful to have a single technical word that picks out what is in common between "intersection types" and "intersection sorts". And here the usual definition of intersections with a refinement restriction will do the job, because it is actually useful to view classical intersection types as combining two refinements of the universal type $U$ of pure lambda terms.


Are V►A and N►A refinements of the same type? Not by the usual understanding of refinement: not only do they have different operational behaviour, one can be a value while the other isn't. However, they have exactly the same structure apart from the …► connectives.


So I don't know enough about your system, but my inclination would be to try to think about V►A and N►A as refinements of the same type (at least temporarily) and see where that goes. The really nice idea of Reynolds 2000 (which Paul-André and I tried to explain in terms of refinement in our POPL paper) is that sometimes it's possible to relate intrinsic and extrinsic semantics in a very clean way. In Reynolds' paper, that meant that he first gave a semantics where subtyping was elaborated into coercions, but then he showed how to factor this via another semantics where terms were interpreted as maps from an environment to the universal domain. ("Factor" here is meant in the extensional sense, that given knowledge of a typing derivation alpha for a term t, the intrinsic semantics of alpha is equivalent to the untyped semantics of t wrapped in coercions -- though in terms of efficiency these interpretations might be different.)


Is V►A definitionally equal to A? No, and I see no reason to do that. It's true that V►A and A have the same inhabitants, but I'm intentionally not putting in subtyping (instead I have a section where I wave my hands about η-expansion). Even if I had subtyping I wouldn't be forced to make V►A ≤ A and A ≤ V►A, because subtyping need not be complete!


Could you explain what is the reason you do not want to have subtyping?


So maybe what I'm really asking is: assuming that I keep the current formulation with implicit "roll" but no definitional equality, what should I call it? "Implicit iso-recursive types"?


I don't have recommendations for terminology, but I just wanted to encourage you to keep this formulation if it really works and let's you avoid writing explicit rolls and unrolls. People are getting used to the idea that equality of types is a tricky issue. As Conor wrote (https://pigworker.wordpress.com/2015/01/06/observational-type-theory-the-motivation/), Never trust a type theorist who has not changed their mind about equality.

Profile

etb: (Default)
etb

August 2015

S M T W T F S
      1
2345678
91011121314 15
16171819202122
23242526272829
3031     

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 9th, 2026 03:43 am
Powered by Dreamwidth Studios