Macro Lambda Calculus
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
We present an elegant design of the core language in a dependently-typed...
The lambda calculus is not upward confluent, one of counterexamples bein...
Dedukti is a type-checker for the λΠ-calculus modulo rewriting,
This paper introduces a new term rewriting system that is similar to the...
Here I report about the modifications of and relations between graphic l...
Traditional social group analysis mostly uses interaction models, event
We study the reduction in a lambda-calculus derived from Moggi's
Macro Lambda Calculus
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.
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:
If as in [neededred], then
If , then
where and if , or
(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 .
iff is the normal form of .
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.