Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active August 8, 2023 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kenwebb/8887819755a68cf1d7bd7ddfb4ff1e96 to your computer and use it in GitHub Desktop.
Save kenwebb/8887819755a68cf1d7bd7ddfb4ff1e96 to your computer and use it in GitHub Desktop.
Interaction Nets
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Tue Aug 08 2023 07:41:35 GMT-0400 (GMT-04:00)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Interaction Nets
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 8887819755a68cf1d7bd7ddfb4ff1e96
Keywords:
My Notes
--------
7 August 2023
I'm not sure yet if these are going to be useful for me, but there are at least some interesting ideas.
### References
(1) https://github.com/VictorTaelin
- some stuff here is based on Interaction Nets
(2) https://en.wikipedia.org/wiki/Interaction_nets
Interaction nets are a graphical model of computation devised by Yves Lafont in 1990[1] as a generalisation of the proof structures of linear logic.
An interaction net system is specified by a set of agent types and a set of interaction rules.
Interaction nets are an inherently distributed model of computation in the sense that
computations can take place simultaneously in many parts of an interaction net, and no synchronisation is needed.
The latter is guaranteed by the strong confluence property of reduction in this model of computation.
Thus interaction nets provide a natural language for massive parallelism.
Interaction nets are at the heart of many implementations of the lambda calculus, such as efficient closed reduction[2] and optimal, in Lévy's sense, Lambdascope.
Definitions
Interactions nets are graph-like structures consisting of agents and edges.
An agent of type α \alpha and with arity ar ( α ) = n ≥ 0 {\displaystyle {\text{ar}}(\alpha )=n\geq 0} has one principal port and n n auxiliary ports.
Any port can be connected to at most one edge. Ports that are not connected to any edge are called free ports.
Free ports together form the interface of an interaction net.
All agent types belong to a set Σ \Sigma called signature.
An interaction net that consists solely of edges is called a wiring and usually denoted as ω \omega .
A tree t t with its root x x is inductively defined either as an edge x x, or as an agent α \alpha with its free principal port x x and
its auxiliary ports x i x_{i} connected to the roots of other trees t i t_{i}.
Graphically, the primitive structures of interaction nets can be represented as follows: Agent, Wiring, Tree diagrams
When two agents are connected to each other with their principal ports, they form an active pair.
KSW - 2 trees connected through their roots; a possibly interesting concept to explore
KSW - a good starting point
(3) https://web.archive.org/web/20170706084403/http://www.phil.uu.nl/~oostrom/publication/pdf/lambdascope.pdf
Lambdascope Another optimal implementation of the lambda-calculus
() https://dl.acm.org/doi/pdf/10.1145/96709.96718
Interaction nets, Yves Lafont
POPL '90: Proceedings of the 17th ACM SIGPLAN-SIGACT symposium on Principles of programming languages
December 1989 Pages 95–108 https://doi.org/10.1145/96709.96718
Published:01 December 1989
Abstract
We propose a new kind of programming language ...
KSW - a good starting point
KSW - some of the diagrams remind me of Graphical Linear Algebra
() https://arxiv.org/pdf/1702.06092.pdf
Parallel needed reduction for pure interaction nets
Anton Salikhmetov
() https://www.npmjs.com/package/inet-lib
) https://github.com/codedot/inet-lib
This package provides an engine for evaluation of interaction nets encoded in a language that is
similar to the refined interaction calculus as described in arXiv:1702.06092.
Implementation implicitly extends interaction systems with McCarthy's amb as a nondeterministic agent and
also allows side effects written in JavaScript.
This engine is used by Macro Lambda Calculus.
() https://www.npmjs.com/package/@alexo/lambda
) https://github.com/codedot/lambda
This package implements the lambda calculus using interaction nets, providing CLI and API.
Its browserified version is available as an online demo.
]]></Notes>
<_-.XholonClass>
<!-- domain objects -->
<PhysicalSystem/>
<Block/>
<Brick/>
<!-- quantities -->
<Height superClass="Quantity"/>
</_-.XholonClass>
<xholonClassDetails>
<Block>
<port name="height" connector="Height"/>
</Block>
</xholonClassDetails>
<PhysicalSystem>
<Block>
<Height>0.1 m</Height>
</Block>
<Brick multiplicity="2"/>
</PhysicalSystem>
<Blockbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var a = 123;
var b = 456;
var c = a * b;
if (console) {
console.log(c);
}
//# sourceURL=Blockbehavior.js
]]></Blockbehavior>
<Heightbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var myHeight, testing;
var beh = {
postConfigure: function() {
testing = Math.floor(Math.random() * 10);
myHeight = this.cnode.parent();
},
act: function() {
myHeight.println(this.toString());
},
toString: function() {
return "testing:" + testing;
}
}
//# sourceURL=Heightbehavior.js
]]></Heightbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
$wnd.xh.Brickbehavior = function Brickbehavior() {}
$wnd.xh.Brickbehavior.prototype.postConfigure = function() {
this.brick = this.cnode.parent();
this.iam = " red brick";
};
$wnd.xh.Brickbehavior.prototype.act = function() {
this.brick.println("I am a" + this.iam);
};
//# sourceURL=Brickbehavior.js
]]></Brickbehavior>
<Brickbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
console.log("I'm another brick behavior");
]]></Brickbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Block</title>
<rect id="PhysicalSystem/Block" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Height</title>
<rect id="PhysicalSystem/Block/Height" fill="#6AB06A" height="50" width="10" x="80" y="0"/>
</g>
</g>
</svg>
]]></Attribute_String><Attribute_String roleName="setup">${MODELNAME_DEFAULT},${SVGURI_DEFAULT}</Attribute_String></SvgClient>
</XholonWorkbook>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment