drafting subtyping rules
This commit is contained in:
parent
55970b1baf
commit
26d0d3158f
1 changed files with 73 additions and 19 deletions
92
README.md
92
README.md
|
@ -10,7 +10,7 @@ s, t ::= s | t (disjunction, a.k.a. union)
|
||||||
| s => t (implication)
|
| s => t (implication)
|
||||||
| s -> t (arrow, a.k.a. function)
|
| s -> t (arrow, a.k.a. function)
|
||||||
| forall x . t (forall, polymorphic)
|
| forall x . t (forall, polymorphic)
|
||||||
| box t (box, modular logic)
|
| box t (box, c.f. modular logic)
|
||||||
| a [t..] (type operator application)
|
| a [t..] (type operator application)
|
||||||
| x (variable)
|
| x (variable)
|
||||||
| n (nominal)
|
| n (nominal)
|
||||||
|
@ -27,33 +27,45 @@ a ∈ opname
|
||||||
## sappho subtyping rules
|
## sappho subtyping rules
|
||||||
|
|
||||||
```
|
```
|
||||||
s, t, γ ⊢ δ
|
---- [identity]
|
||||||
|
ρ; s, γ ⊢ s, δ
|
||||||
|
|
||||||
|
---- [true-right]
|
||||||
|
ρ; γ ⊢ true, δ
|
||||||
|
|
||||||
|
---- [false-left]
|
||||||
|
ρ; false, γ ⊢ δ
|
||||||
|
|
||||||
|
ρ; s, t, γ ⊢ δ
|
||||||
---- [conj-left]
|
---- [conj-left]
|
||||||
s & t, γ ⊢ δ
|
ρ; s & t, γ ⊢ δ
|
||||||
|
|
||||||
γ ⊢ s, t, δ
|
ρ; γ ⊢ s, t, δ
|
||||||
---- [disj-right]
|
---- [disj-right]
|
||||||
γ ⊢ s | t, δ
|
ρ; γ ⊢ s | t, δ
|
||||||
|
|
||||||
s, γ ⊢ δ
|
ρ; s, γ ⊢ δ
|
||||||
t, γ ⊢ δ
|
ρ; t, γ ⊢ δ
|
||||||
---- [disj-left]
|
---- [disj-left]
|
||||||
s | t, γ ⊢ δ
|
ρ; s | t, γ ⊢ δ
|
||||||
|
|
||||||
γ ⊢ s, δ
|
ρ; γ ⊢ s, δ
|
||||||
γ ⊢ t, δ
|
ρ; γ ⊢ t, δ
|
||||||
---- [conj-right]
|
---- [conj-right]
|
||||||
γ ⊢ s & t, δ
|
ρ; γ ⊢ s & t, δ
|
||||||
|
|
||||||
// XXX
|
// XXX
|
||||||
s => t, s, t, γ ⊢ δ
|
// remove s => t? always make progress
|
||||||
|
ρ; s => t, s, t, γ ⊢ δ
|
||||||
---- [impl-left]
|
---- [impl-left]
|
||||||
s => t, s, γ ⊢ δ
|
ρ; s => t, s, γ ⊢ δ
|
||||||
|
|
||||||
// discussion about implication below
|
// discussion about implication below
|
||||||
s, γ ⊢ t, δ
|
// check how "normal sequent calculus handles this"
|
||||||
|
ρ; s, γ ⊢ t, δ
|
||||||
---- [impl-right]
|
---- [impl-right]
|
||||||
γ ⊢ s => t, δ
|
ρ; γ ⊢ s => t, δ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// box works as a kind of "forall" for concrete types
|
// box works as a kind of "forall" for concrete types
|
||||||
|
@ -62,22 +74,64 @@ box t, t, γ ⊢ δ
|
||||||
box t, γ ⊢ δ
|
box t, γ ⊢ δ
|
||||||
|
|
||||||
// (.)-- filters the contexts.
|
// (.)-- filters the contexts.
|
||||||
γ-- ⊢ t, δ--
|
ρ; γ-- ⊢ t, δ--
|
||||||
---- [box-right]
|
---- [box-right]
|
||||||
γ ⊢ box t, δ
|
ρ; γ ⊢ box t, δ
|
||||||
|
|
||||||
|
|
||||||
|
// recursion through operators are handled using the recursion context ρ
|
||||||
|
// XXX compare with iso-recursive subtyping (double expansion)
|
||||||
|
---- [op-discharge]
|
||||||
|
a [t..], ρ; γ ⊢ a [t..], δ
|
||||||
|
|
||||||
|
a [t..]*, ρ; γ ⊢ expand(a [t..]), δ
|
||||||
|
---- [op-expand1]
|
||||||
|
ρ; γ ⊢ a [t..], δ
|
||||||
|
|
||||||
|
a [t..], ρ; γ ⊢ expand(a [t..]), δ
|
||||||
|
---- [op-expand2]
|
||||||
|
a [t..]*, ρ; γ ⊢ a [t..], δ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// member types are filtered according to member name
|
||||||
|
ρ; γ >> m ⊢ δ >> m
|
||||||
|
---- [member]
|
||||||
|
ρ; γ ⊢ δ
|
||||||
|
|
||||||
|
|
||||||
|
// foralls are unwrapped and variable substituted with fresh name
|
||||||
|
// i.e. we treat the bound variable nominally
|
||||||
|
n fresh
|
||||||
|
ρ; γ [n] ⊢ δ [n]
|
||||||
|
---- [forall]
|
||||||
|
ρ; γ ⊢ δ
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### context operators
|
### context operators
|
||||||
|
|
||||||
|
* box filtering
|
||||||
```
|
```
|
||||||
(t, γ)-- =def= t, γ-- if t == box s
|
(t, γ)-- =def= t, γ-- if t == box s, for some s
|
||||||
γ-- otherwise
|
γ-- otherwise
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* member unwrapping
|
||||||
|
```
|
||||||
|
(t, γ) >> m =def= s, (γ >> m) if t == { m : s }, for some s
|
||||||
|
γ >> m otherwise
|
||||||
|
```
|
||||||
|
|
||||||
|
* forall-unwrapping and substitution
|
||||||
|
```
|
||||||
|
(t, γ) [n] =def= s [n/x], (γ [n]) if t == forall x . s, for some x, s
|
||||||
|
γ [n] otherwise
|
||||||
|
```
|
||||||
|
|
||||||
What happens when box is buried under type operators, like box s & box t? It
|
What happens when box is buried under type operators, like box s & box t? It
|
||||||
could be that the above definition filters out too much of the contexts.
|
could be that the above definition filters out too much of the contexts.
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue