aya-dev icon indicating copy to clipboard operation
aya-dev copied to clipboard

Add `Val` and `Neutral` for NbE

Open ice1000 opened this issue 4 years ago • 10 comments
trafficstars

Neutralization by Elimination

Does that sound like a plan? @re-xyr

ice1000 avatar Sep 15 '21 00:09 ice1000

What is neutralization by elimination?

re-xyr avatar Sep 15 '21 00:09 re-xyr

What is neutralization by elimination?

It's a meme

ice1000 avatar Sep 15 '21 01:09 ice1000

Then it doesn’t sound like a plan

re-xyr avatar Sep 15 '21 01:09 re-xyr

Then it doesn’t sound like a plan

So, I actually meant normalization by evaluation. I guess we need to add Value and Neutral, and then implement eval, right? I think it should be like that

ice1000 avatar Sep 15 '21 01:09 ice1000

Yes, and quote. And then we modify all type-inspecting functions (check, unify, etc) to use Vals for types.

re-xyr avatar Sep 15 '21 01:09 re-xyr

We may not need to add a dedicated Neutral type even. Neutral can be a constructor for Val, consisting of a neutral head plus a spine.

re-xyr avatar Sep 15 '21 01:09 re-xyr

We may not need to add a dedicated Neutral type even. Neutral can be a constructor for Val, consisting of a neutral head plus a spine.

What kind of term will be a neutral spine?

ice1000 avatar Sep 15 '21 01:09 ice1000

Any non-canonical term not subject to beta-reduction. In particular, they are prim calls, function calls, meta calls, and local Var applications.

re-xyr avatar Sep 15 '21 01:09 re-xyr

For the neutrals subject to delta reduction, I will store a field of type Lazy<Maybe<Val>> for the reduced result.

re-xyr avatar Sep 15 '21 01:09 re-xyr

Wow, we have LazyValue from kala https://github.com/Glavo/kala-common/blob/main/kala-base/src/main/java/kala/value/LazyValue.java

ice1000 avatar Sep 18 '21 01:09 ice1000