Skip to content

Instantly share code, notes, and snippets.

@kenwebb
Last active August 3, 2019 10:02
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/1981492a76811ed391d6fd5b3246d723 to your computer and use it in GitHub Desktop.
Save kenwebb/1981492a76811ed391d6fd5b3246d723 to your computer and use it in GitHub Desktop.
Bigraphs 2019 04 - Composition and Juxtaposition
<?xml version="1.0" encoding="UTF-8"?>
<!--Xholon Workbook http://www.primordion.com/Xholon/gwt/ MIT License, Copyright (C) Ken Webb, Sat Aug 03 2019 06:02:24 GMT-0400 (Eastern Daylight Time)-->
<XholonWorkbook>
<Notes><![CDATA[
Xholon
------
Title: Bigraphs 2019 04 - Composition and Juxtaposition
Description:
Url: http://www.primordion.com/Xholon/gwt/
InternalName: 1981492a76811ed391d6fd5b3246d723
Keywords:
My Notes
--------
August 2, 2019
In this workbook, I explore the math, Category Theory, and Bigraph concepts of Composition (Cmp) and Juxtaposition (Jxt).
One concrete goal is to create a model using Bigraph notation, where:
- Bigraph A has 2 sites and 2 inner names
- Bigraph B has one root, and has an outer name attached to an internal node that creates and sends Xholon messages
- Bigraph C has one root, and has an outer name attached to an internal node that can receive and display Xholon messages
- at runtime, the inner and outer names will be appropriately bound
http://127.0.0.1:8888/Xholon.html?app=Bigraphs+2019+04+-+Composition+and+Juxtaposition&src=lstr&gui=clsc&jslib=BigraphParser
Theory 1
--------
My initial theory of what distinguishes Cmp from Jxt, is ports and connections between ports.
Jxt involves just placing nodes next to each other, Bigraph sites and roots.
Cmp enhances Jxt, and involves connecting ports, Bigraph inner and outer names.
Examples
--------
I use planets of the Solar System as nodes in the example bigraphs.
In the Jxt bigraphs, I use Mercury and Pluto on the assumption that there is (almost) no interaction between these two planets.
In the Cmp bigraphs. I use Earth and Mars which interact gravitationally and through human space probes and messaging.
References
----------
(1) Milner's Bigraph book
]]></Notes>
<_-.XholonClass>
<TheSystem/>
<Example/>
<BigraphParser superClass="script"/>
</_-.XholonClass>
<xholonClassDetails>
<BigraphParser><DefaultContent>@BigraphParser</DefaultContent></BigraphParser>
<Avatar><Color>rgba(200,0,0,1.0)</Color></Avatar>
</xholonClassDetails>
<TheSystem>
<!-- =========================================== EXAMPLE 1 =========================================== -->
<Example roleName="Jxt">
<Bigraph roleName="Jxt A" flatten="false" savedata="true"><Attribute_String><![CDATA[
# Solar System
B = (VB,EB,PB,ctrlB,prntB,linkB) : 〈m,X〉 → 〈n,Y〉,
m=2, X={}, n=1, Y=∅,
Σ = ( {SolarSystem}, {(SolarSystem,0)} ),
# SolarSystem instance; this is a Bigraph root
VB = {solsys},
# SiteBG instances
VB = {planet1, planet2},
# edges
EB = ∅,
# there are no ports
# Bigraph controls
ctrlB = {(solsys,SolarSystem)},
ctrlB = {(planet1,SiteBG), (planet2,SiteBG)},
# parent relations
prntB = { (planet1,solsys), (planet2,solsys) }
]]></Attribute_String>
<BigraphParser/>
</Bigraph>
<!-- Mercury -->
<Bigraph roleName="Jxt B" flatten="true" savedata="false" operation="composition"><Attribute_String><![CDATA[
# Mercury
B = (VB,EB,PB,ctrlB,prntB,linkB) : 〈m,X〉 → 〈n,Y〉,
m=0, X=∅, n=1, Y={},
Σ = ({Planet}, {(Planet,1)}),
VB = {Mercury},
ctrlB = {(Mercury,Planet)}
]]></Attribute_String>
<BigraphParser/>
</Bigraph>
<!-- Pluto -->
<Bigraph roleName="Jxt C" flatten="true" savedata="false" operation="composition"><Attribute_String><![CDATA[
# Pluto
B = (VB,EB,PB,ctrlB,prntB,linkB) : 〈m,X〉 → 〈n,Y〉,
m=0, X=∅, n=1, Y={},
Σ = ({Planet}, {(Planet,1)}),
VB = {Pluto},
ctrlB = {(Pluto,Planet)}
]]></Attribute_String>
<BigraphParser/>
</Bigraph>
</Example>
<!-- =========================================== EXAMPLE 2 =========================================== -->
<Example roleName="Cmp">
<Bigraph roleName="Cmp A" flatten="false" savedata="true"><Attribute_String><![CDATA[
# Solar System
B = (VB,EB,PB,ctrlB,prntB,linkB) : 〈m,X〉 → 〈n,Y〉,
m=2, X={p1,p2}, n=1, Y=∅,
Σ = ( {SolarSystem}, {(SolarSystem,0)} ),
# SolarSystem instance; this is a Bigraph root
VB = {solsys},
# SiteBG instances
VB = {planet1, planet2},
# edges
# earth.port(0, earth.next());
# mars.port(0, mars.prev());
EB = ∅,
# EB = {(p1,p2)},
# there are no ports
# Bigraph controls
ctrlB = {(solsys,SolarSystem)},
ctrlB = {(planet1,SiteBG), (planet2,SiteBG)},
# parent relations
prntB = { (planet1,solsys), (planet2,solsys) }
]]></Attribute_String>
<BigraphParser/>
</Bigraph>
<!-- Earth -->
<Bigraph roleName="Cmp B" flatten="true" savedata="false" operation="composition"><Attribute_String><![CDATA[
# Earth
B = (VB,EB,PB,ctrlB,prntB,linkB) : 〈m,X〉 → 〈n,Y〉,
m=0, X=∅, n=1, Y={p1},
Σ = ({Planet}, {(Planet,1)}),
VB = {Earth},
PB = {p(Earth,1)},
ctrlB = {(Earth,Planet)},
linkB = {(p(Earth,1),p1)}
]]></Attribute_String>
<BigraphParser/>
</Bigraph>
<!-- Mars -->
<Bigraph roleName="Cmp C" flatten="true" savedata="false" operation="composition"><Attribute_String><![CDATA[
# Mars
B = (VB,EB,PB,ctrlB,prntB,linkB) : 〈m,X〉 → 〈n,Y〉,
m=0, X=∅, n=1, Y={p2},
Σ = ({Planet}, {(Planet,1)}),
VB = {Mars},
PB = {p(Mars,1)},
ctrlB = {(Mars,Planet)},
linkB = {(p(Mars,1),p2)}
]]></Attribute_String>
<BigraphParser/>
</Bigraph>
</Example>
</TheSystem>
<Planetbehavior implName="org.primordion.xholon.base.Behavior_gwtjs"><![CDATA[
var me, beh = {
postConfigure: function() {
me = this.cnode.parent();
// I am not yet sure how to set up the link/edge from Earth to Mars, so I am doing it through code for now
switch (me.role()) {
case "Earth":
me.port(0, me.next());
//$wnd.xh.root().append(this.cnode.remove());
break;
case "Mars":
me.port(0, me.prev());
//$wnd.xh.root().append(this.cnode.remove());
break;
default: this.cnode.remove(); break;
}
},
act: function() {
me.println(me.name());
switch (me.role()) {
case "Earth":
me.port(0).msg(101, "testing", me);
break;
case "Mars": break;
default: break;
}
},
processReceivedMessage: function(msg) {
me.println(me.name() + " has received msg " + msg.data + " from " + msg.sender.name());
}
}
//# sourceURL=Planetbehavior.js
]]></Planetbehavior>
<SvgClient><Attribute_String roleName="svgUri"><![CDATA[data:image/svg+xml,
<svg width="100" height="50" xmlns="http://www.w3.org/2000/svg">
<g>
<title>Bigraph</title>
<rect id="TheSystem/Bigraph" fill="#98FB98" height="50" width="50" x="25" y="0"/>
<g>
<title>Solar System</title>
<rect id="TheSystem/Bigraph/*" 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