@lapxo/obligations 0.2.0 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -32
- package/dist/debit/graph.js +0 -3
- package/dist/debit/observer.d.ts +6 -0
- package/dist/debit/observer.js +15 -0
- package/dist/debit/vector-move.js +0 -7
- package/dist/debit/vector.d.ts +0 -1
- package/dist/debit/vector.js +0 -8
- package/dist/field/encounter.d.ts +12 -0
- package/dist/field/encounter.js +22 -0
- package/dist/field/fragility.d.ts +3 -0
- package/dist/field/fragility.js +19 -0
- package/dist/field/join.d.ts +3 -0
- package/dist/field/join.js +7 -0
- package/dist/field/meet.d.ts +3 -0
- package/dist/field/meet.js +5 -0
- package/dist/field/observe.d.ts +2 -0
- package/dist/field/observe.js +10 -0
- package/dist/field/refine.d.ts +2 -0
- package/dist/field/refine.js +3 -0
- package/dist/field/require.d.ts +4 -0
- package/dist/field/require.js +5 -0
- package/dist/field/sign.d.ts +13 -0
- package/dist/field/sign.js +34 -0
- package/dist/lattice/axioms.d.ts +0 -1
- package/dist/lattice/axioms.js +0 -6
- package/dist/lattice/errors.d.ts +1 -1
- package/dist/lattice/index.d.ts +3 -3
- package/dist/lattice/index.js +3 -3
- package/dist/lattice/obligatory.d.ts +36 -12
- package/dist/lattice/obligatory.js +48 -23
- package/dist/lattice/order.d.ts +0 -1
- package/dist/lattice/order.js +0 -1
- package/dist/views/field/physics.js +1 -1
- package/dist/views/field/policy.js +2 -1
- package/dist/views/field/self.js +2 -1
- package/dist/views/field.d.ts +11 -3
- package/dist/views/field.js +10 -2
- package/package.json +3 -3
- package/receipts.bound +3106 -471
|
@@ -1,33 +1,58 @@
|
|
|
1
1
|
import { coordinate } from "../field/field.js";
|
|
2
|
+
import { UnitError } from "./errors.js";
|
|
2
3
|
export function cell(at, epoch = 0, seen = [], restsOn = []) {
|
|
3
4
|
return { at: coordinate(at), epoch, seen, restsOn };
|
|
4
5
|
}
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const rested = one.restsOn.flatMap((name) => (bounds.has(name) ? [bounds.get(name)] : []));
|
|
11
|
-
const own = one.ceiling === undefined ? [] : [one.ceiling];
|
|
12
|
-
return [...standing(one).map((claim) => claim.span), ...rested, ...own].reduce((held, span) => lattice.meet(held, span), lattice.top);
|
|
13
|
-
}
|
|
14
|
-
export function encounter(lattice, one, bounds) {
|
|
15
|
-
return { origins: new Set(standing(one).map((claim) => claim.origin)).size, held: meet(lattice, one, bounds) };
|
|
6
|
+
export function mark(one) {
|
|
7
|
+
if (one.widens !== undefined && one.reach === 'travels') {
|
|
8
|
+
throw new UnitError('widening-travels', 'obligations: REFUSE·widening-travels a widening stands where it was witnessed and never travels to what rests there', { pole: one.pole });
|
|
9
|
+
}
|
|
10
|
+
return one.takes === undefined ? one : { ...one, sign: -1 };
|
|
16
11
|
}
|
|
17
|
-
export function
|
|
18
|
-
|
|
12
|
+
export function live(lines) {
|
|
13
|
+
const taken = new Set(lines.flatMap((line) => (line.takes === undefined ? [] : [line.takes])));
|
|
14
|
+
return lines.filter((line) => line.takes === undefined && (line.id === undefined || !taken.has(line.id)));
|
|
19
15
|
}
|
|
20
|
-
export function
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
export function restOf(c, world = new Map()) {
|
|
17
|
+
const own = c.at.join('/');
|
|
18
|
+
const out = [];
|
|
19
|
+
const held = new Set();
|
|
20
|
+
const edge = [...c.restsOn];
|
|
21
|
+
for (let i = 0; i < edge.length; i += 1) {
|
|
22
|
+
const name = edge[i];
|
|
23
|
+
if (name === own)
|
|
24
|
+
throw new UnitError('rest-cycle', `obligations: REFUSE·rest ${own} rests on itself: an order of rest with a cycle has no fold to reach`, { at: own });
|
|
25
|
+
if (held.has(name))
|
|
26
|
+
continue;
|
|
27
|
+
held.add(name);
|
|
28
|
+
out.push(name);
|
|
29
|
+
edge.push(...(world.get(name)?.restsOn ?? []));
|
|
23
30
|
}
|
|
24
|
-
return
|
|
31
|
+
return out;
|
|
25
32
|
}
|
|
26
|
-
export function
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
33
|
+
export function parts(L, c, world = new Map()) {
|
|
34
|
+
const rest = restOf(c, world);
|
|
35
|
+
const above = rest.flatMap((name) => live(world.get(name)?.marks ?? []).filter((one) => one.reach === 'travels' && one.widens === undefined));
|
|
36
|
+
const marks = [...live(c.marks ?? []), ...above].sort((a, b) => (a.at ?? 0) - (b.at ?? 0));
|
|
37
|
+
let required = L.top;
|
|
38
|
+
let signed = L.top;
|
|
39
|
+
for (const one of marks) {
|
|
40
|
+
if (one.pole === 'floor')
|
|
41
|
+
required = L.meet(required, one.span);
|
|
42
|
+
else
|
|
43
|
+
signed = one.widens === undefined ? L.meet(signed, one.span) : L.join(signed, one.span);
|
|
44
|
+
}
|
|
45
|
+
const origins = live(c.seen);
|
|
46
|
+
const held = origins.reduce((acc, claim) => L.meet(acc, claim.span), L.top);
|
|
47
|
+
return { floor: L.meet(required, held), ceiling: L.meet(signed, held), origins, rest, required, signed };
|
|
30
48
|
}
|
|
31
|
-
export function
|
|
32
|
-
|
|
49
|
+
export function state(L, c, world = new Map()) {
|
|
50
|
+
const { floor, ceiling, origins, required, signed } = parts(L, c, world);
|
|
51
|
+
if (!L.inhabited(L.meet(required, signed)))
|
|
52
|
+
return 'CONFLICT';
|
|
53
|
+
if (new Set(origins.map((claim) => claim.origin)).size < 2)
|
|
54
|
+
return 'REQUIRED';
|
|
55
|
+
if (!L.inhabited(origins.reduce((acc, claim) => L.meet(acc, claim.span), L.top)))
|
|
56
|
+
return 'CONFLICT';
|
|
57
|
+
return L.inhabited(L.meet(floor, ceiling)) ? 'FREE' : 'FORBIDDEN';
|
|
33
58
|
}
|
package/dist/lattice/order.d.ts
CHANGED
|
@@ -3,4 +3,3 @@ export declare function chain(levels: readonly string[]): Scale;
|
|
|
3
3
|
export declare function height(c: Scale, level: Level): number;
|
|
4
4
|
export declare function isDistributive(c: Scale): boolean;
|
|
5
5
|
export declare function order(levels: readonly string[], leq: readonly boolean[][]): Scale;
|
|
6
|
-
export declare const BOOLEAN: () => Scale;
|
package/dist/lattice/order.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { encounter
|
|
1
|
+
import { encounter } from "../../field/encounter.js";
|
|
2
|
+
import { meet } from "../../field/meet.js";
|
|
2
3
|
import { coherence } from "./wave.js";
|
|
3
4
|
import { neighbours, reach } from "../product/reach.js";
|
|
4
5
|
const at = (cell) => cell.at.join('/');
|
package/dist/views/field/self.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { meet
|
|
1
|
+
import { meet } from "../../field/meet.js";
|
|
2
|
+
import { observe } from "../../field/observe.js";
|
|
2
3
|
export function selfFold(lattice, one, epochs, width, spread, seed) {
|
|
3
4
|
let held = seed;
|
|
4
5
|
const next = () => { held = (held * 1103515245 + 12345) % 2147483648; return held / 2147483648; };
|
package/dist/views/field.d.ts
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
export { foldIn, witnessesIn } from '../debit/debit.ts';
|
|
2
|
-
export { disagree, latest, meetAt, origins, potential, turned } from '../field/encounter.ts';
|
|
2
|
+
export { cancels, disagree, encounter, laminar, latest, meetAt, origins, pairs, potential, turned } from '../field/encounter.ts';
|
|
3
3
|
export { contracts, coordinate, covers, exclusive, key, passes, point, region, resolution, within } from '../field/field.ts';
|
|
4
|
+
export { join } from '../field/join.ts';
|
|
5
|
+
export { meet } from '../field/meet.ts';
|
|
6
|
+
export { observe } from '../field/observe.ts';
|
|
7
|
+
export { refine } from '../field/refine.ts';
|
|
8
|
+
export { require } from '../field/require.ts';
|
|
9
|
+
export { bites, restingOn, sign } from '../field/sign.ts';
|
|
4
10
|
export { converge, endsBeforeNow, present } from '../field/present.ts';
|
|
5
11
|
export { amplitude, coherence, fringes, interfere, phase, seenAs } from './field/wave.ts';
|
|
6
12
|
export type { Claim } from './field/wave.ts';
|
|
7
|
-
export { cell,
|
|
8
|
-
export
|
|
13
|
+
export { cell, mark, parts, restOf, state } from '../lattice/obligatory.ts';
|
|
14
|
+
export { fragility } from '../field/fragility.ts';
|
|
15
|
+
export type { Act, Cell, Mark, Obligatory, Origin, World } from '../lattice/obligatory.ts';
|
|
16
|
+
export { looksLeft, pay, price } from '../debit/observer.ts';
|
|
9
17
|
export { budget, decohere, disturbance, distinct, evolve, sameObject } from './field/physics.ts';
|
|
10
18
|
export { choose, play } from './field/policy.ts';
|
|
11
19
|
export { selfFold } from './field/self.ts';
|
package/dist/views/field.js
CHANGED
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
export { foldIn, witnessesIn } from "../debit/debit.js";
|
|
2
|
-
export { disagree, latest, meetAt, origins, potential, turned } from "../field/encounter.js";
|
|
2
|
+
export { cancels, disagree, encounter, laminar, latest, meetAt, origins, pairs, potential, turned } from "../field/encounter.js";
|
|
3
3
|
export { contracts, coordinate, covers, exclusive, key, passes, point, region, resolution, within } from "../field/field.js";
|
|
4
|
+
export { join } from "../field/join.js";
|
|
5
|
+
export { meet } from "../field/meet.js";
|
|
6
|
+
export { observe } from "../field/observe.js";
|
|
7
|
+
export { refine } from "../field/refine.js";
|
|
8
|
+
export { require } from "../field/require.js";
|
|
9
|
+
export { bites, restingOn, sign } from "../field/sign.js";
|
|
4
10
|
export { converge, endsBeforeNow, present } from "../field/present.js";
|
|
5
11
|
export { amplitude, coherence, fringes, interfere, phase, seenAs } from "./field/wave.js";
|
|
6
|
-
export { cell,
|
|
12
|
+
export { cell, mark, parts, restOf, state } from "../lattice/obligatory.js";
|
|
13
|
+
export { fragility } from "../field/fragility.js";
|
|
14
|
+
export { looksLeft, pay, price } from "../debit/observer.js";
|
|
7
15
|
export { budget, decohere, disturbance, distinct, evolve, sameObject } from "./field/physics.js";
|
|
8
16
|
export { choose, play } from "./field/policy.js";
|
|
9
17
|
export { selfFold } from "./field/self.js";
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lapxo/obligations",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "The algebra of a cell: two poles, origins with phase,
|
|
3
|
+
"version": "0.3.3",
|
|
4
|
+
"description": "The algebra of a cell: two poles, origins with phase, eight acts.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "Lapxo",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
|
-
"url": "git+https://github.com/
|
|
10
|
+
"url": "git+https://github.com/Lapxo/obligations.git"
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"obligations",
|