cpsa-3.4.0: doc/examples/subsort_test.xhtml
<?xml version="1.0"?>
<!-- CPSA 3.4.0 -->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Subsort constraint test protocol</title>
<meta http-equiv="content-type" content="application/xhtml+xml; charset=UTF-8" />
<style>
svg.diagram { border-width: 1px; border-style: solid }
</style>
</head>
<body>
<pre>(herald "Subsort constraint test protocol"
(comment "First, third, and fourth skeletons should have a shape,"
"second should be dead."))
(comment "CPSA 3.4.0")
(comment "All input read from subsort_test.scm")</pre>
<p id="top">Trees: <a href="#t0">0</a> <a href="#t2">2</a> <a href="#t3">3</a> <a href="#t5">5</a>.</p>
<p id="t0">Tree <a href="#top">0</a>.</p>
<div>
<svg
class='diagram' width='129.840pt' height='79.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 129.840 79.920' font-size='12.000'>
<text
x='89.880' y='26.040'
style='font-weight: bold; text-anchor: middle; fill: blue;'
onclick='window.open("#k1", "_self")'>1</text>
<line
x1='39.960' y1='39.960' x2='89.880' y2='39.960'
style='stroke-width: 0.960; stroke: gray;'/>
<text
x='39.960' y='26.040' style='text-anchor: middle; fill: black;'
onclick='window.open("#k0", "_self")'>0</text>
</svg></div>
<pre>(defprotocol subsorttest basic
(defrole init
(vars (n1 n2 text) (k skey))
(trace (send (cat n1 (enc n1 n2 k))) (recv n2))
(non-orig k)
(uniq-orig n1 n2)))</pre>
<p id="k0">Item <a href="#t0">0</a>, Child: <a href="#k1">1</a>.</p>
<div>
<svg
class='diagram' width='79.920pt' height='229.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 79.920 229.920' font-size='12.000'>
<defs>
<marker
id='arrow' orient='auto' markerWidth='5' markerHeight='10' refX='5'
refY='5'>
<path
d='M 0 0 5 5 0 10'
style='stroke-width: 2; fill: none; stroke: black;'/></marker>
</defs>
<line
x1='39.960' y1='114.960' x2='39.960' y2='189.960'
style='stroke-width: 0.960; stroke: gray;'/>
<g><title>n2</title>
<circle style='fill: red;' cx='39.960' cy='189.960' r='6.000'/></g>
<g><title>(cat n1 (enc n1 n2 k))</title>
<circle cx='39.960' cy='114.960' r='6.000'/></g>
<g><title>((n1 n1) (n2 n2) (k k))</title>
<text x='39.960' y='77.460' style='text-anchor: middle;'>init</text>
</g>
<text
x='39.960' y='39.960'
style='text-anchor: middle;'>subsorttest 0</text></svg></div>
<pre>(defskeleton subsorttest
(vars (n1 n2 text) (k skey))
(defstrand init 2 (n1 n1) (n2 n2) (k k))
(non-orig k)
(uniq-orig n1 n2)
(label 0)
(unrealized (0 1))
(origs (n1 (0 0)) (n2 (0 0)))
(comment "1 in cohort - 1 not yet seen"))</pre>
<p id="k1">Item <a href="#t0">1</a>, Parent: <a href="#k0">0</a>.</p>
<div>
<svg
class='diagram' width='79.920pt' height='229.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 79.920 229.920' font-size='12.000'>
<defs>
<marker
id='arrow' orient='auto' markerWidth='5' markerHeight='10' refX='5'
refY='5'>
<path
d='M 0 0 5 5 0 10'
style='stroke-width: 2; fill: none; stroke: black;'/></marker>
</defs>
<line
x1='39.960' y1='114.960' x2='39.960' y2='189.960'
style='stroke-width: 0.960; stroke: gray;'/>
<g><title>n1</title>
<circle style='fill: blue;' cx='39.960' cy='189.960' r='6.000'/></g>
<g><title>(cat n1 (enc n1 n1 k))</title>
<circle cx='39.960' cy='114.960' r='6.000'/></g>
<g><title>((n1 n1) (n2 n1) (k k))</title>
<text x='39.960' y='77.460' style='text-anchor: middle;'>init</text>
</g>
<text
x='39.960' y='39.960'
style='text-anchor: middle;'>subsorttest 1 (realized)</text></svg>
</div>
<pre>(defskeleton subsorttest
(vars (n1 text) (k skey))
(defstrand init 2 (n1 n1) (n2 n1) (k k))
(non-orig k)
(uniq-orig n1)
(operation nonce-test (displaced 1 0 init 1) n2 (0 1) (enc n1 n2 k))
(label 1)
(parent 0)
(unrealized)
(shape)
(maps ((0) ((n1 n1) (n2 n1) (k k))))
(origs (n1 (0 0))))</pre>
<p id="t2">Tree <a href="#top">2</a>.</p>
<div>
<svg
class='diagram' width='79.920pt' height='79.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 79.920 79.920' font-size='12.000'>
<text
x='39.960' y='26.040' style='text-anchor: middle; fill: red;'
onclick='window.open("#k2", "_self")'>2</text>
</svg></div>
<pre>(defprotocol subsorttest basic
(defrole init
(vars (n1 n2 text) (k skey))
(trace (send (cat n1 (enc n1 n2 k))) (recv n2))
(non-orig k)
(uniq-orig n1 n2)))</pre>
<p id="k2">Item <a href="#t2">2</a>.</p>
<div>
<svg
class='diagram' width='79.920pt' height='229.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 79.920 229.920' font-size='12.000'>
<defs>
<marker
id='arrow' orient='auto' markerWidth='5' markerHeight='10' refX='5'
refY='5'>
<path
d='M 0 0 5 5 0 10'
style='stroke-width: 2; fill: none; stroke: black;'/></marker>
</defs>
<line
x1='39.960' y1='114.960' x2='39.960' y2='189.960'
style='stroke-width: 0.960; stroke: gray;'/>
<g><title>n2</title>
<circle style='fill: red;' cx='39.960' cy='189.960' r='6.000'/></g>
<g><title>(cat n1 (enc n1 n2 k))</title>
<circle cx='39.960' cy='114.960' r='6.000'/></g>
<g><title>((n1 n1) (n2 n2) (k k))</title>
<text x='39.960' y='77.460' style='text-anchor: middle;'>init</text>
</g>
<text
x='39.960' y='39.960'
style='text-anchor: middle;'>subsorttest 2</text></svg></div>
<pre>(defskeleton subsorttest
(vars (n1 n2 text) (k skey))
(defstrand init 2 (n1 n1) (n2 n2) (k k))
(non-orig k)
(subsort (A n1) (B n2))
(uniq-orig n1 n2)
(label 2)
(unrealized (0 1))
(origs (n1 (0 0)) (n2 (0 0)))
(comment "empty cohort"))</pre>
<p id="t3">Tree <a href="#top">3</a>.</p>
<div>
<svg
class='diagram' width='129.840pt' height='79.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 129.840 79.920' font-size='12.000'>
<text
x='89.880' y='26.040'
style='font-weight: bold; text-anchor: middle; fill: blue;'
onclick='window.open("#k4", "_self")'>4</text>
<line
x1='39.960' y1='39.960' x2='89.880' y2='39.960'
style='stroke-width: 0.960; stroke: gray;'/>
<text
x='39.960' y='26.040' style='text-anchor: middle; fill: black;'
onclick='window.open("#k3", "_self")'>3</text>
</svg></div>
<pre>(defprotocol subsorttest basic
(defrole init
(vars (n1 n2 text) (k skey))
(trace (send (cat n1 (enc n1 n2 k))) (recv n2))
(non-orig k)
(uniq-orig n1 n2)))</pre>
<p id="k3">Item <a href="#t3">3</a>, Child: <a href="#k4">4</a>.</p>
<div>
<svg
class='diagram' width='79.920pt' height='229.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 79.920 229.920' font-size='12.000'>
<defs>
<marker
id='arrow' orient='auto' markerWidth='5' markerHeight='10' refX='5'
refY='5'>
<path
d='M 0 0 5 5 0 10'
style='stroke-width: 2; fill: none; stroke: black;'/></marker>
</defs>
<line
x1='39.960' y1='114.960' x2='39.960' y2='189.960'
style='stroke-width: 0.960; stroke: gray;'/>
<g><title>n2</title>
<circle style='fill: red;' cx='39.960' cy='189.960' r='6.000'/></g>
<g><title>(cat n1 (enc n1 n2 k))</title>
<circle cx='39.960' cy='114.960' r='6.000'/></g>
<g><title>((n1 n1) (n2 n2) (k k))</title>
<text x='39.960' y='77.460' style='text-anchor: middle;'>init</text>
</g>
<text
x='39.960' y='39.960'
style='text-anchor: middle;'>subsorttest 3</text></svg></div>
<pre>(defskeleton subsorttest
(vars (n1 n2 text) (k skey))
(defstrand init 2 (n1 n1) (n2 n2) (k k))
(non-orig k)
(subsort (A n1))
(uniq-orig n1 n2)
(label 3)
(unrealized (0 1))
(origs (n1 (0 0)) (n2 (0 0)))
(comment "1 in cohort - 1 not yet seen"))</pre>
<p id="k4">Item <a href="#t3">4</a>, Parent: <a href="#k3">3</a>.</p>
<div>
<svg
class='diagram' width='79.920pt' height='229.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 79.920 229.920' font-size='12.000'>
<defs>
<marker
id='arrow' orient='auto' markerWidth='5' markerHeight='10' refX='5'
refY='5'>
<path
d='M 0 0 5 5 0 10'
style='stroke-width: 2; fill: none; stroke: black;'/></marker>
</defs>
<line
x1='39.960' y1='114.960' x2='39.960' y2='189.960'
style='stroke-width: 0.960; stroke: gray;'/>
<g><title>n1</title>
<circle style='fill: blue;' cx='39.960' cy='189.960' r='6.000'/></g>
<g><title>(cat n1 (enc n1 n1 k))</title>
<circle cx='39.960' cy='114.960' r='6.000'/></g>
<g><title>((n1 n1) (n2 n1) (k k))</title>
<text x='39.960' y='77.460' style='text-anchor: middle;'>init</text>
</g>
<text
x='39.960' y='39.960'
style='text-anchor: middle;'>subsorttest 4 (realized)</text></svg>
</div>
<pre>(defskeleton subsorttest
(vars (n1 text) (k skey))
(defstrand init 2 (n1 n1) (n2 n1) (k k))
(non-orig k)
(subsort (A n1))
(uniq-orig n1)
(operation nonce-test (displaced 1 0 init 1) n2 (0 1) (enc n1 n2 k))
(label 4)
(parent 3)
(unrealized)
(shape)
(maps ((0) ((n1 n1) (n2 n1) (k k))))
(origs (n1 (0 0))))</pre>
<p id="t5">Tree <a href="#top">5</a>.</p>
<div>
<svg
class='diagram' width='129.840pt' height='79.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 129.840 79.920' font-size='12.000'>
<text
x='89.880' y='26.040'
style='font-weight: bold; text-anchor: middle; fill: blue;'
onclick='window.open("#k6", "_self")'>6</text>
<line
x1='39.960' y1='39.960' x2='89.880' y2='39.960'
style='stroke-width: 0.960; stroke: gray;'/>
<text
x='39.960' y='26.040' style='text-anchor: middle; fill: black;'
onclick='window.open("#k5", "_self")'>5</text>
</svg></div>
<pre>(defprotocol subsorttest basic
(defrole init
(vars (n1 n2 text) (k skey))
(trace (send (cat n1 (enc n1 n2 k))) (recv n2))
(non-orig k)
(uniq-orig n1 n2)))</pre>
<p id="k5">Item <a href="#t5">5</a>, Child: <a href="#k6">6</a>.</p>
<div>
<svg
class='diagram' width='79.920pt' height='229.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 79.920 229.920' font-size='12.000'>
<defs>
<marker
id='arrow' orient='auto' markerWidth='5' markerHeight='10' refX='5'
refY='5'>
<path
d='M 0 0 5 5 0 10'
style='stroke-width: 2; fill: none; stroke: black;'/></marker>
</defs>
<line
x1='39.960' y1='114.960' x2='39.960' y2='189.960'
style='stroke-width: 0.960; stroke: gray;'/>
<g><title>n2</title>
<circle style='fill: red;' cx='39.960' cy='189.960' r='6.000'/></g>
<g><title>(cat n1 (enc n1 n2 k))</title>
<circle cx='39.960' cy='114.960' r='6.000'/></g>
<g><title>((n1 n1) (n2 n2) (k k))</title>
<text x='39.960' y='77.460' style='text-anchor: middle;'>init</text>
</g>
<text
x='39.960' y='39.960'
style='text-anchor: middle;'>subsorttest 5</text></svg></div>
<pre>(defskeleton subsorttest
(vars (n1 n2 text) (k skey))
(defstrand init 2 (n1 n1) (n2 n2) (k k))
(non-orig k)
(subsort (A n1 n2))
(uniq-orig n1 n2)
(label 5)
(unrealized (0 1))
(origs (n1 (0 0)) (n2 (0 0)))
(comment "1 in cohort - 1 not yet seen"))</pre>
<p id="k6">Item <a href="#t5">6</a>, Parent: <a href="#k5">5</a>.</p>
<div>
<svg
class='diagram' width='79.920pt' height='229.920pt'
xmlns='http://www.w3.org/2000/svg' version='1.1'
viewBox='0 0 79.920 229.920' font-size='12.000'>
<defs>
<marker
id='arrow' orient='auto' markerWidth='5' markerHeight='10' refX='5'
refY='5'>
<path
d='M 0 0 5 5 0 10'
style='stroke-width: 2; fill: none; stroke: black;'/></marker>
</defs>
<line
x1='39.960' y1='114.960' x2='39.960' y2='189.960'
style='stroke-width: 0.960; stroke: gray;'/>
<g><title>n1</title>
<circle style='fill: blue;' cx='39.960' cy='189.960' r='6.000'/></g>
<g><title>(cat n1 (enc n1 n1 k))</title>
<circle cx='39.960' cy='114.960' r='6.000'/></g>
<g><title>((n1 n1) (n2 n1) (k k))</title>
<text x='39.960' y='77.460' style='text-anchor: middle;'>init</text>
</g>
<text
x='39.960' y='39.960'
style='text-anchor: middle;'>subsorttest 6 (realized)</text></svg>
</div>
<pre>(defskeleton subsorttest
(vars (n1 text) (k skey))
(defstrand init 2 (n1 n1) (n2 n1) (k k))
(non-orig k)
(subsort (A n1))
(uniq-orig n1)
(operation nonce-test (displaced 1 0 init 1) n2 (0 1) (enc n1 n2 k))
(label 6)
(parent 5)
(unrealized)
(shape)
(maps ((0) ((n1 n1) (n2 n1) (k k))))
(origs (n1 (0 0))))</pre>
</body>
</html>