@lapxo/obligations 0.3.0 → 0.3.4

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.
@@ -32,9 +32,6 @@ export function buildGraph(edges) {
32
32
  tails,
33
33
  };
34
34
  }
35
- function owed(carrier, name) {
36
- return carrier.size === 0 || carrier.has(name);
37
- }
38
35
  export function reachIds(g, from, scratch) {
39
36
  const seen = scratch ?? new Uint8Array(g.size);
40
37
  if (scratch)
@@ -1,11 +1,4 @@
1
1
  const STATES = ['REQUIRED', 'FREE', 'FORBIDDEN', 'CONFLICT'];
2
- function findWithin(runs, s) {
3
- let n = 0;
4
- for (const r of runs)
5
- if (r.within)
6
- n += r.within[s];
7
- return n;
8
- }
9
2
  export const DANGEROUS = STATES.filter((s) => s !== 'CONFLICT').map((s) => [s, 'CONFLICT']);
10
3
  const zero = () => {
11
4
  const m = {};
@@ -8,7 +8,6 @@ export interface Quadrants {
8
8
  readonly CONFLICT: WideMask;
9
9
  }
10
10
  export declare function quadrants(demanded: WideMask, permitted: WideMask, extent: WideMask): Quadrants;
11
- export declare function sizes(q: Quadrants): Readonly<Record<State, number>>;
12
11
  export declare function stateAt(q: Quadrants, bit: number): State | null;
13
12
  export interface Run {
14
13
  readonly lo: number;
@@ -10,14 +10,6 @@ export function quadrants(demanded, permitted, extent) {
10
10
  CONFLICT: d.difference(p),
11
11
  };
12
12
  }
13
- export function sizes(q) {
14
- return {
15
- REQUIRED: q.REQUIRED.size(),
16
- FREE: q.FREE.size(),
17
- FORBIDDEN: q.FORBIDDEN.size(),
18
- CONFLICT: q.CONFLICT.size(),
19
- };
20
- }
21
13
  export function stateAt(q, bit) {
22
14
  for (const s of STATES)
23
15
  if (q[s].has(bit))
@@ -0,0 +1,3 @@
1
+ import type { Lattice } from '../lattice/lattice.ts';
2
+ import type { Obligatory, World } from '../lattice/obligatory.ts';
3
+ export declare function fragility<T>(L: Lattice<T>, c: Obligatory<T>, world?: World<T>): number;
@@ -0,0 +1,19 @@
1
+ import { eq } from "../lattice/lattice.js";
2
+ import { live, parts } from "../lattice/obligatory.js";
3
+ function takes(names, size) {
4
+ if (size === 0)
5
+ return [[]];
6
+ return names.flatMap((name, i) => takes(names.slice(i + 1), size - 1).map((rest) => [name, ...rest]));
7
+ }
8
+ export function fragility(L, c, world = new Map()) {
9
+ const was = parts(L, c, world);
10
+ const names = [...new Set(live(c.seen).map((claim) => claim.origin))];
11
+ for (let size = 1; size <= names.length; size += 1) {
12
+ for (const out of takes(names, size)) {
13
+ const now = parts(L, { ...c, seen: c.seen.filter((claim) => !out.includes(claim.origin)) }, world);
14
+ if (!eq(L, now.floor, was.floor) || !eq(L, now.ceiling, was.ceiling))
15
+ return size;
16
+ }
17
+ }
18
+ return 0;
19
+ }
@@ -5,7 +5,6 @@ export declare const POSET_LAW_NAMES: readonly ["transitivity", "antisymmetry"];
5
5
  export declare const MEET_LAW_NAMES: readonly ["idempotence.meet", "unit.top", "top.greatest", "commutativity.meet", "consistency.meet", "associativity.meet"];
6
6
  export declare const JOIN_LAW_NAMES: readonly ["idempotence.join", "unit.bottom", "bottom.least", "commutativity.join", "consistency.join", "associativity.join"];
7
7
  export declare const BOTH_LAW_NAMES: readonly ["absorption.meet", "absorption.join"];
8
- export declare const CLOSURE_LAW_NAMES: readonly ["closure.demand", "closure.permit", "closure.meet", "closure.join"];
9
8
  export declare const LATTICE_LAW_NAMES: readonly ["transitivity", "antisymmetry", "idempotence.meet", "unit.top", "top.greatest", "commutativity.meet", "consistency.meet", "associativity.meet", "idempotence.join", "unit.bottom", "bottom.least", "commutativity.join", "consistency.join", "associativity.join", "absorption.meet", "absorption.join"];
10
9
  export type LatticeLawName = (typeof LATTICE_LAW_NAMES)[number];
11
10
  export declare function posetViolationsIn<T>(L: Poset<T>, xs: readonly T[]): readonly string[];
@@ -24,12 +24,6 @@ export const BOTH_LAW_NAMES = [
24
24
  'absorption.meet',
25
25
  'absorption.join',
26
26
  ];
27
- export const CLOSURE_LAW_NAMES = [
28
- 'closure.demand',
29
- 'closure.permit',
30
- 'closure.meet',
31
- 'closure.join',
32
- ];
33
27
  export const LATTICE_LAW_NAMES = [
34
28
  ...POSET_LAW_NAMES,
35
29
  ...MEET_LAW_NAMES,
@@ -1,13 +1,13 @@
1
1
  export { UnitError } from './errors.ts';
2
2
  export type { UnitErrorCode } from './errors.ts';
3
- export { BOOLEAN, chain, height, isDistributive, order } from './order.ts';
3
+ export { chain, height, isDistributive, order } from './order.ts';
4
4
  export { asBoolean, bitLoss, compose, composeState, fuse, widen, conflictDebits, anyOf, missing, entails, permitAll, state, statesPerDebit, table, unit } from '../debit/unit.ts';
5
5
  export { WIDTH, and, or, canonical } from '../debit/packed.ts';
6
6
  export type { Packed, Packer } from '../debit/packed.ts';
7
7
  export { WideMask, chunkCount } from '../debit/masks.ts';
8
8
  export { rebuild, register } from '../debit/register.ts';
9
9
  export type { Register } from '../debit/register.ts';
10
- export { DANGEROUS, STATES, dangerous, moved, quadrants, runQuadrants, sizes, stateAt, transitions } from '../debit/vector.ts';
10
+ export { DANGEROUS, STATES, dangerous, moved, quadrants, runQuadrants, stateAt, transitions } from '../debit/vector.ts';
11
11
  export type { Matrix, Quadrants, Run, Span } from '../debit/vector.ts';
12
12
  export { METHODS, weakest } from '../debit/provenance.ts';
13
13
  export { touches, holds } from '../debit/standing.ts';
@@ -26,7 +26,7 @@ export type { Act, Yield } from '../field/yield.ts';
26
26
  export { frontier } from '../field/frontier.ts';
27
27
  export type { Asked, Open } from '../field/frontier.ts';
28
28
  export { declarationOf, unitOf, stateOf, registerOf, premiumOf, degenerate, withdrawsExactly, movesOf } from '../field/motion.ts';
29
- export { violationsIn, meetViolationsIn, posetViolationsIn, closureViolationsIn, LATTICE_LAW_NAMES, POSET_LAW_NAMES, MEET_LAW_NAMES, JOIN_LAW_NAMES, BOTH_LAW_NAMES, CLOSURE_LAW_NAMES, } from './axioms.ts';
29
+ export { violationsIn, meetViolationsIn, posetViolationsIn, closureViolationsIn, LATTICE_LAW_NAMES, POSET_LAW_NAMES, MEET_LAW_NAMES, JOIN_LAW_NAMES, BOTH_LAW_NAMES, } from './axioms.ts';
30
30
  export type { LatticeLawName } from './axioms.ts';
31
31
  export { fromScale, subsets } from './scale-lattice.ts';
32
32
  export { downset, freedom, fromIdeals, idealComplexity, idealDebit, idealEntails, idealJoin, idealMeet, isDownset, isIdealPair, isUpset, unitToIdeal, upset } from '../debit/ideal.ts';
@@ -1,10 +1,10 @@
1
1
  export { UnitError } from "./errors.js";
2
- export { BOOLEAN, chain, height, isDistributive, order } from "./order.js";
2
+ export { chain, height, isDistributive, order } from "./order.js";
3
3
  export { asBoolean, bitLoss, compose, composeState, fuse, widen, conflictDebits, anyOf, missing, entails, permitAll, state, statesPerDebit, table, unit } from "../debit/unit.js";
4
4
  export { WIDTH, and, or, canonical } from "../debit/packed.js";
5
5
  export { WideMask, chunkCount } from "../debit/masks.js";
6
6
  export { rebuild, register } from "../debit/register.js";
7
- export { DANGEROUS, STATES, dangerous, moved, quadrants, runQuadrants, sizes, stateAt, transitions } from "../debit/vector.js";
7
+ export { DANGEROUS, STATES, dangerous, moved, quadrants, runQuadrants, stateAt, transitions } from "../debit/vector.js";
8
8
  export { METHODS, weakest } from "../debit/provenance.js";
9
9
  export { touches, holds } from "../debit/standing.js";
10
10
  export { declaration, asUnit, conj, disj } from "./declaration.js";
@@ -17,7 +17,7 @@ export { present, converge, endsBeforeNow } from "../field/present.js";
17
17
  export { yieldOf } from "../field/yield.js";
18
18
  export { frontier } from "../field/frontier.js";
19
19
  export { declarationOf, unitOf, stateOf, registerOf, premiumOf, degenerate, withdrawsExactly, movesOf } from "../field/motion.js";
20
- export { violationsIn, meetViolationsIn, posetViolationsIn, closureViolationsIn, LATTICE_LAW_NAMES, POSET_LAW_NAMES, MEET_LAW_NAMES, JOIN_LAW_NAMES, BOTH_LAW_NAMES, CLOSURE_LAW_NAMES, } from "./axioms.js";
20
+ export { violationsIn, meetViolationsIn, posetViolationsIn, closureViolationsIn, LATTICE_LAW_NAMES, POSET_LAW_NAMES, MEET_LAW_NAMES, JOIN_LAW_NAMES, BOTH_LAW_NAMES, } from "./axioms.js";
21
21
  export { fromScale, subsets } from "./scale-lattice.js";
22
22
  export { downset, freedom, fromIdeals, idealComplexity, idealDebit, idealEntails, idealJoin, idealMeet, isDownset, isIdealPair, isUpset, unitToIdeal, upset } from "../debit/ideal.js";
23
23
  export { FORM_IMPLEMENTATIONS, FORMS, ladderForm, alphabetForm, continuousForm, latticeForm } from "./forms.js";
@@ -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;
@@ -147,4 +147,3 @@ export function order(levels, leq) {
147
147
  const grid = (up) => [...Array(n)].map((_, i) => [...Array(n)].map((__, j) => bound(i, j, up)));
148
148
  return build(levels, grid(true), grid(false));
149
149
  }
150
- export const BOOLEAN = () => chain(['no', 'yes']);
@@ -10,7 +10,8 @@ export { bites, restingOn, sign } from '../field/sign.ts';
10
10
  export { converge, endsBeforeNow, present } from '../field/present.ts';
11
11
  export { amplitude, coherence, fringes, interfere, phase, seenAs } from './field/wave.ts';
12
12
  export type { Claim } from './field/wave.ts';
13
- export { cell, mark, parts, restOf, state } from '../lattice/obligatory.ts';
13
+ export { cell, live, mark, parts, restOf, state } from '../lattice/obligatory.ts';
14
+ export { fragility } from '../field/fragility.ts';
14
15
  export type { Act, Cell, Mark, Obligatory, Origin, World } from '../lattice/obligatory.ts';
15
16
  export { looksLeft, pay, price } from '../debit/observer.ts';
16
17
  export { budget, decohere, disturbance, distinct, evolve, sameObject } from './field/physics.ts';
@@ -9,7 +9,8 @@ export { require } from "../field/require.js";
9
9
  export { bites, restingOn, sign } from "../field/sign.js";
10
10
  export { converge, endsBeforeNow, present } from "../field/present.js";
11
11
  export { amplitude, coherence, fringes, interfere, phase, seenAs } from "./field/wave.js";
12
- export { cell, mark, parts, restOf, state } from "../lattice/obligatory.js";
12
+ export { cell, live, mark, parts, restOf, state } from "../lattice/obligatory.js";
13
+ export { fragility } from "../field/fragility.js";
13
14
  export { looksLeft, pay, price } from "../debit/observer.js";
14
15
  export { budget, decohere, disturbance, distinct, evolve, sameObject } from "./field/physics.js";
15
16
  export { choose, play } from "./field/policy.js";
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@lapxo/obligations",
3
- "version": "0.3.0",
3
+ "version": "0.3.4",
4
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/lapxo/obligations.git"
10
+ "url": "git+https://github.com/Lapxo/obligations.git"
11
11
  },
12
12
  "keywords": [
13
13
  "obligations",
@@ -79,7 +79,9 @@
79
79
  },
80
80
  "files": [
81
81
  "dist",
82
- "receipts.bound"
82
+ "README.md",
83
+ "LICENSE",
84
+ "TARGET.bound"
83
85
  ],
84
86
  "scripts": {
85
87
  "build": "tsc --build"