robrix / path

A lambda calculus to explore type-directed program synthesis.
BSD 3-Clause "New" or "Revised" License
83 stars 2 forks source link

Explicit erasable syntax #84

Open robrix opened 5 years ago

robrix commented 5 years ago

We’ve had good results with passes transforming one sum of terms into another, e.g. desugaring and elaboration. We could do the same thing for erasable syntax, which would include types and eventually explicit type abstractions (cf #73) & applications (cf #74). We’d generate type abstractions for implicits, too, and then stripping the erasable syntax off would just leave us with a core lambda calculus consisting of variables, abstractions, applications, and possibly other primitives (cf #45).

We might also want to define evaluation as occurring on erased terms.

cf #19 re: performing type erasure

robrix commented 5 years ago

I think this is going to be necessary:

If we represent type abstractions/applications in a separate piece of syntax, and possibly annotate Value.Lam with its Plicity, we should be able to quote back to Explicit :+: Core and therefore do substitution in elaborated terms.

An alternative might be to make elaboration evaluate the core term to a Value and then substitute metavariables out within that.

robrix commented 5 years ago

An alternative might be to make elaboration evaluate the core term to a Value and then substitute metavariables out within that.

On its own, this would also either preclude erasure or require us to perform it immediately, since Values don’t carry type information (and if they did, we’d be able to quote them back to their type-annotated elaborated form).

robrix commented 5 years ago

On the other hand, we could annotate values (well, lambdas and neutral values) with their types…