An impure solution to the problem of matching fans

10/20/2017 ∙ by Anton Salikhmetov, et al. ∙ 0

We present an algorithm to solve the problem of matching fans in interaction net implementations of optimal reduction for the pure untyped lambda calculus without use of any additional agent types. The algorithm relies upon a specific interaction nets reduction strategy and involves side effects in one of interaction rules.

READ FULL TEXT VIEW PDF
POST COMMENT

Comments

There are no comments yet.

Authors

page 1

page 2

page 3

Code Repositories

This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Problem

Matching fans is the main problem of implementation of optimal reduction in interaction nets [optimal]. Existing solutions use so-called oracle which is implemented using bracket and croissant agents in BOHM [optimal] and delimiter agents in Lambdascope [lambdascope].

Aiming to eliminate the overhead due to the oracle, we decided to limit our signature to the basic types only (abstraction, application, erase, and fan) and try to achieve the same behavior of fans as if the oracle were still present.

This paper continues our previous work towards optimal reduction without oracle [orwoo]. Specifically, 1) we use the idea of identities attached to fans from [orwoo], 2) restrict the interaction nets reduction strategy to needed reduction [neededred]

, and also 3) allow side effects in one of interaction rules. The main idea is to memorize identities of two different fans at the moment of their first interaction. It has led us to an impure solution we present in this paper.

The presented solution has been implemented in software and is available in the MLC package at https://www.npmjs.com/package/@alexo/lambda (version 0.5.0) where it exists as the abstract encoding which is the default algorithm.

2 Solution

We work in the version of interaction calculus described in [neededred].

The signature of our interaction system is

Intuitively, one can think of in as this agent’s identity. Agents , , and are part of the embedded read-back mechanism described in [termgraph, Section 7].

The interaction rules are as follows:

Here, we omit the interaction rule and will define it later explicitly extending reduction relation as it is this interaction rule that involves side effects.

We define a state as

where is a configuration as in [neededred], , and .

The reduction relation on states is defined in two steps:

  1. If as in [neededred], then

  2. If , then

    where and if , or

    if .

(In MLC, is implemented using a hash table. As long as the latter’s search and insert operations are , the cost of the reduction remains , thus keeping number of reductions an adequate measure of efficiency.)

In order to encode a -term into a state, we first need to distinguish free variables from bound variables in . We do so by marking all free variables using the following operation: , where .

Then the following state is the initial encoding of a -term :

where is the result of enumerating all occurrences in as , and

The algorithm is correct if the following conjecture holds true for any -term .

Conjecture.

iff is the normal form of .

3 Conclusion

Our impure solution to the problem of matching fans makes use of the mechanism to track identities of fans suggested in [orwoo]. We get rid of the naïve level-tracking part and utilize needed reduction [neededred], blocking previously found counterexamples at the cost of side effects.

We believe that further work should be directed towards a pure version of the presented solution in order to investigate its properties and correctness.