AshleyYakeley / Truth

Changes and Pinafore projects. Pull requests not accepted.
https://pinafore.info/
GNU General Public License v2.0
32 stars 0 forks source link

Type discrepancy vs SimpleSub #229

Closed AshleyYakeley closed 8 months ago

AshleyYakeley commented 10 months ago

Consider:

m = fn x => x x;
i = fn x => x;
mi = m i;

What is the type of mi?

These types are not identical. Pinafore gives a strictly more specific type, but it may not be correct.

AshleyYakeley commented 10 months ago

Per AS sec. 5.3.1, substitution works like this:

By hand:

m: ((a -> b) & a) -> b
i: c -> c

c -> c <: (a -> b) & a
---
c -> c <: a -> b
c -> c <: a
---
c <: b
a <: c
c -> c <: a
---
c <: b
c -> c <: c
---
[c'/c+](c -> c) = c -> c'
subst = [(rec c', c|(c -> c'))/c+]

rec c', c|(c -> c') <: b
AshleyYakeley commented 10 months ago

See #206

AshleyYakeley commented 8 months ago

Fixed.