lambdalab icon indicating copy to clipboard operation
lambdalab copied to clipboard

Full Applicative Order Argument Evaluation

Open rudynicolop opened this issue 4 years ago • 2 comments
trafficstars

It seems as if Full Applicative Order does not fully-evaluate all arguments before beta-reduction.

For instance, with the macros:

ID = λx. x
TRUE = λx. λy. x
OMEGA = λx. x x

I expected the sample program:

TRUE ID (OMEGA OMEGA)

to diverge under Full Applicative Order, as it does under Call-by-Value. However, it appears to terminate to ID, as it would under Full Normal Order and Call-by-Name.

Here is the example in lambdalab.

Is this behavior expected?

Thank you!

rudynicolop avatar May 17 '21 04:05 rudynicolop

Huh, yeah, that is weird. Seems like this case should reduce the RHS instead of applying, if I'm not mistaken: https://github.com/cucapra/lambdalab/blob/742a730e73bfbc6f207859031310ec53d5d5c068/lib/reduce.ts#L249-L250

As the comment would imply: https://github.com/cucapra/lambdalab/blob/742a730e73bfbc6f207859031310ec53d5d5c068/lib/reduce.ts#L236-L237

Or perhaps I'm misunderstanding, @dsainati1?

sampsyo avatar May 17 '21 05:05 sampsyo

Yea as far as I can tell (it's been a few years since I thought about this code) this is a bug. Nice catch!

dsainati1 avatar May 17 '21 14:05 dsainati1