org.xmloperator.lambda2.net.model
Interface LambdaNet

All Known Implementing Classes:
LambdaNetImpl

public interface LambdaNet

A LambdaNet is an interaction-net that represents a lambda term which is linear relativety to each of its free variables.

The net representation of the lambda term is the one of "Compiling the lambda-calculus into Interaction Combinators" by Ian Mackie and Jorge Sousa Pinto.

The interaction net body is accessible through (supported by) a free Port.


Method Summary
 boolean booleanValue(int[] interactionStat)
          Returns the boolean value of the Term (K or F) represented by this LambdaNet.
 void buildAbstraction()
          Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the abstraction "\x.t", where "x" doesn't occur within t.
 void buildAbstraction(Port freeVariableSupport)
          Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the abstraction "\x.t", where "x" is bound to the given variable of "t".
 void buildAbstraction(Port[] freeVariableSupports)
          Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the abstraction "\x.t", where "x" is bound to the given variables of "t".
 void buildApplication(LambdaNet argument)
           Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the application "tu" where "u" is the lambda term represented by the given LambdaNet.
 void buildApplication(LambdaNet argument, int functionExponent)
           Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the application "(t^n)u" where "u" is the lambda term represented by the given LambdaNet and "n" an exponent.
 Port getBodySupport()
          Returns the free Port that supports the interaction-net body.
 int getFreeVariableCount()
          Returns the count of free variables.
 long numeralValue(int[] interactionStat)
          Returns the value modulo 2^63 of the Church numeral Term represented by this LambdaNet.
 Term readBack(boolean inNormalForm, int maxStepCount, int[] interactionStat)
          Read back the Term represented by this LambdaNet.
 int reduceUntilInterfaceNormalForm(int maxStepCount, int[] interactionStat)
          Reduces this LambdaNet until the interface has a normal form.
 

Method Detail

getBodySupport

public Port getBodySupport()
Returns the free Port that supports the interaction-net body.

Returns:
the free Port that supports the interaction-net body.

getFreeVariableCount

public int getFreeVariableCount()
Returns the count of free variables.

Returns:
the count of free variables.

buildAbstraction

public void buildAbstraction()
Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the abstraction "\x.t", where "x" doesn't occur within t.


buildAbstraction

public void buildAbstraction(Port freeVariableSupport)
Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the abstraction "\x.t", where "x" is bound to the given variable of "t".

Parameters:
freeVariableSupport - a support of free variable.

buildAbstraction

public void buildAbstraction(Port[] freeVariableSupports)
Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the abstraction "\x.t", where "x" is bound to the given variables of "t".

Parameters:
freeVariableSupports - a set of 0 or more support of free variable.

buildApplication

public void buildApplication(LambdaNet argument)

Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the application "tu" where "u" is the lambda term represented by the given LambdaNet.

The argument LambdaNet is consumed by the operation and is no more usable.

Parameters:
argument - an argument LambdaNet.
Throws:
java.lang.IllegalArgumentException - if the argument LambdaNet is this LambdaNet.

buildApplication

public void buildApplication(LambdaNet argument,
                             int functionExponent)

Transforms this LambdaNet in such a way that its represented lambda term "t" is replaced by the application "(t^n)u" where "u" is the lambda term represented by the given LambdaNet and "n" an exponent.

The argument LambdaNet is consumed by the operation and is no more usable.

Parameters:
argument - an argument LambdaNet.
functionExponent - a function exponent
Throws:
java.lang.IllegalArgumentException - if the argument LambdaNet is this LambdaNet or if the function exponent is lesser than one.

reduceUntilInterfaceNormalForm

public int reduceUntilInterfaceNormalForm(int maxStepCount,
                                          int[] interactionStat)
                                   throws TooMuchReductionStepException
Reduces this LambdaNet until the interface has a normal form.

Post-condition: the body port is a principal Port or a free Port.

Parameters:
maxStepCount - a maximun step count. A negative value means no limit.
interactionStat - an array of interaction type count. May be null.
Returns:
the count of reducing step.
Throws:
TooMuchReductionStepException - if the given maximum count of step is not sufficient to obtain an interface normal form.

readBack

public Term readBack(boolean inNormalForm,
                     int maxStepCount,
                     int[] interactionStat)
              throws TooMuchReductionStepException
Read back the Term represented by this LambdaNet.

Pre-condition: this LambdaNet must have no free variable.

Parameters:
inNormalForm - if true then returns a Term in normal form.
maxStepCount - a maximum step count. A negative value means no limit.
interactionStat - an array of interaction type count. May be null.
Returns:
the Term read back from this LambdaNet.
Throws:
java.lang.IllegalStateException - if this LambdaNet has free variable(s).
TooMuchReductionStepException - if the given maximum count of step is not sufficient to obtain a normal form or an interface normal form.

booleanValue

public boolean booleanValue(int[] interactionStat)
Returns the boolean value of the Term (K or F) represented by this LambdaNet.

Parameters:
interactionStat - an array of interaction type count. May be null.
Returns:
the boolean value of the Term (K or F) represented by this LambdaNet.
Throws:
java.lang.IllegalStateException - if this LambdaNet doesn't represent a boolean value or if it has free variable(s).

numeralValue

public long numeralValue(int[] interactionStat)
Returns the value modulo 2^63 of the Church numeral Term represented by this LambdaNet. Returns -1 if this LambdaNet doesn't represent a Church numeral.

Parameters:
interactionStat - an array of interaction type count. May be null.
Returns:
the value modulo 2^63 of the Church numeral Term represented by this LambdaNet. Returns -1 if this LambdaNet doesn't represent a Church numeral.
Throws:
java.lang.IllegalStateException - if this LambdaNet doesn't represent a numeral value or if it has free variable(s).