libpetri 2.13.0 → 3.0.0

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.
@@ -72,7 +72,6 @@ type Arc = ArcInput | ArcOutput | ArcInhibitor | ArcRead | ArcReset;
72
72
  interface ArcInput<T = any> {
73
73
  readonly type: 'input';
74
74
  readonly place: Place<T>;
75
- readonly guard?: (value: T) => boolean;
76
75
  }
77
76
  interface ArcOutput<T = any> {
78
77
  readonly type: 'output';
@@ -91,7 +90,7 @@ interface ArcReset<T = any> {
91
90
  readonly place: Place<T>;
92
91
  }
93
92
  /** Input arc: consumes token from place when transition fires. */
94
- declare function inputArc<T>(place: Place<T>, guard?: (value: T) => boolean): ArcInput<T>;
93
+ declare function inputArc<T>(place: Place<T>): ArcInput<T>;
95
94
  /** Output arc: produces token to place when transition fires. */
96
95
  declare function outputArc<T>(place: Place<T>): ArcOutput<T>;
97
96
  /** Inhibitor arc: blocks transition if place has tokens. */
@@ -102,15 +101,14 @@ declare function readArc<T>(place: Place<T>): ArcRead<T>;
102
101
  declare function resetArc<T>(place: Place<T>): ArcReset<T>;
103
102
  /** Returns the place this arc connects to. */
104
103
  declare function arcPlace(arc: Arc): Place<any>;
105
- /** Checks if an input arc has a guard predicate. */
106
- declare function hasGuard(arc: ArcInput): boolean;
107
- /** Checks if a token value matches an input arc's guard. */
108
- declare function matchesGuard<T>(arc: ArcInput<T>, value: T): boolean;
109
104
 
110
105
  /**
111
- * Input specification with cardinality and optional guard predicate.
112
- * CPN-compliant: cardinality determines how many tokens to consume,
113
- * guard filters which tokens are eligible.
106
+ * Input specification with cardinality. Purely structural (IO-006): cardinality
107
+ * determines how many tokens to consume; there is no per-token predicate.
108
+ *
109
+ * Conditional token selection is modeled with multiple conflicting transitions
110
+ * and XOR-on-input semantics rather than a predicate coupled to the enablement
111
+ * check.
114
112
  *
115
113
  * Inputs are always AND-joined (all must be satisfied to enable transition).
116
114
  * XOR on inputs is modeled via multiple transitions (conflict).
@@ -119,33 +117,29 @@ type In = InOne | InExactly | InAll | InAtLeast;
119
117
  interface InOne<T = any> {
120
118
  readonly type: 'one';
121
119
  readonly place: Place<T>;
122
- readonly guard?: (value: T) => boolean;
123
120
  }
124
121
  interface InExactly<T = any> {
125
122
  readonly type: 'exactly';
126
123
  readonly place: Place<T>;
127
124
  readonly count: number;
128
- readonly guard?: (value: T) => boolean;
129
125
  }
130
126
  interface InAll<T = any> {
131
127
  readonly type: 'all';
132
128
  readonly place: Place<T>;
133
- readonly guard?: (value: T) => boolean;
134
129
  }
135
130
  interface InAtLeast<T = any> {
136
131
  readonly type: 'at-least';
137
132
  readonly place: Place<T>;
138
133
  readonly minimum: number;
139
- readonly guard?: (value: T) => boolean;
140
134
  }
141
- /** Consume exactly 1 token (standard CPN semantics). Optional guard filters eligible tokens. */
142
- declare function one<T>(place: Place<T>, guard?: (value: T) => boolean): InOne<T>;
143
- /** Consume exactly N tokens (batching). Optional guard filters eligible tokens. */
144
- declare function exactly<T>(count: number, place: Place<T>, guard?: (value: T) => boolean): InExactly<T>;
145
- /** Consume all available tokens (must be 1+). Optional guard filters eligible tokens. */
146
- declare function all<T>(place: Place<T>, guard?: (value: T) => boolean): InAll<T>;
147
- /** Wait for N+ tokens, consume all when enabled. Optional guard filters eligible tokens. */
148
- declare function atLeast<T>(minimum: number, place: Place<T>, guard?: (value: T) => boolean): InAtLeast<T>;
135
+ /** Consume exactly 1 token (standard CPN semantics). */
136
+ declare function one<T>(place: Place<T>): InOne<T>;
137
+ /** Consume exactly N tokens (batching). */
138
+ declare function exactly<T>(count: number, place: Place<T>): InExactly<T>;
139
+ /** Consume all available tokens (must be 1+). */
140
+ declare function all<T>(place: Place<T>): InAll<T>;
141
+ /** Wait for N+ tokens, consume all when enabled. */
142
+ declare function atLeast<T>(minimum: number, place: Place<T>): InAtLeast<T>;
149
143
  /** Returns the minimum number of tokens required to enable. */
150
144
  declare function requiredCount(spec: In): number;
151
145
  /**
@@ -191,11 +185,11 @@ declare function nameId(value: string): NameId;
191
185
  * On firing, exactly those name-matched tokens are consumed (spec NU-020).
192
186
  *
193
187
  * This is the single *decidable* predicate — equality of opaque names — and is
194
- * deliberately NOT a general guard: it correlates the name dimension *across*
195
- * places (composition-structural, like cardinality) rather than evaluating an
196
- * arbitrary boolean per token. When both a unary input `guard` and a match are
197
- * present the guard filters first, then the name correlation runs over the
198
- * survivors (NU-021).
188
+ * deliberately NOT a general input predicate: it correlates the name dimension
189
+ * *across* places (composition-structural, like cardinality) rather than
190
+ * evaluating an arbitrary boolean per token. Input specifications themselves
191
+ * remain purely structural (IO-006); name correlation is the only per-token
192
+ * filter the enablement check ever applies (NU-021).
199
193
  */
200
194
 
201
195
  /**
@@ -228,7 +222,7 @@ declare function matchKey<T>(place: Place<T>, key: KeyFn<T>): MatchKey<T>;
228
222
  * ))
229
223
  *
230
224
  * @throws if fewer than two inputs are correlated (a match over a single place
231
- * is just a guard).
225
+ * correlates nothing).
232
226
  */
233
227
  declare function matchSpec(...keys: MatchKey[]): MatchSpec;
234
228
  /** Returns the name projection for `placeName`, or `undefined` if not correlated. */
@@ -1746,7 +1740,8 @@ declare class PetriNetBuilder {
1746
1740
  * Map<string, Place<unknown>> convention — TypeScript Place identity is
1747
1741
  * name-based per `runtime/compiled-net.ts`).
1748
1742
  * 3. Walk every transition through {@link applyFusion} to rewrite arc place
1749
- * references.
1743
+ * references; input arcs colliding on a canonical place merge per
1744
+ * [MOD-021] (additive where summable, rejected otherwise).
1750
1745
  * 4. Re-derive the place set from the rewritten transitions plus any
1751
1746
  * caller-declared standalone places, dropping non-canonical members.
1752
1747
  * Caller-declared standalone places that happen to be non-canonical
@@ -1782,4 +1777,4 @@ declare class PetriNetBuilder {
1782
1777
  private buildWithFusion;
1783
1778
  }
1784
1779
 
1785
- export { type VerificationHarness as $, type Arc as A, type Port as B, type Channel as C, type PortDirection as D, type EnvironmentPlace as E, FusionSet as F, SubnetDefBuilder as G, type SubnetInstance as H, type In as I, type Timing as J, type KeyFn as K, type LogFn as L, MAX_DURATION_MS as M, type NameId as N, type Out as O, PetriNet as P, type TimingDeadline as Q, type TimingDelayed as R, SubnetDef as S, type Token as T, type TimingExact as U, type TimingImmediate as V, type TimingWindow as W, TokenInput as X, TokenOutput as Y, type TransitionAction as Z, TransitionBuilder as _, type Place as a, type SmtStatistics as a$, type VerificationResult as a0, all as a1, allPlaces as a2, and as a3, andPlaces as a4, arcPlace as a5, atLeast as a6, consumptionCount as a7, deadline as a8, delayed as a9, produce as aA, readArc as aB, requiredCount as aC, resetArc as aD, timeout as aE, timeoutPlace as aF, tokenAt as aG, tokenOf as aH, transform as aI, transformAsync as aJ, transformFrom as aK, unitToken as aL, window as aM, withTimeout as aN, xor as aO, xorPlaces as aP, MarkingState as aQ, type PInvariant as aR, MarkingStateBuilder as aS, type SmtProperty as aT, type SmtVerificationResult as aU, type BranchPlaceBound as aV, type DeadlockFree as aW, type JoinedOrDeadLettered as aX, type MutualExclusion as aY, type PlaceBound as aZ, type Proven as a_, earliest as aa, enumerateBranches as ab, environmentPlace as ac, exact as ad, exactly as ae, fork as af, forwardInput as ag, hasDeadline as ah, hasGuard as ai, immediate as aj, inhibitorArc as ak, inputArc as al, isPassthrough as am, isUnit as an, keyForPlace as ao, latest as ap, matchCorrelates as aq, matchKey as ar, matchSpec as as, matchesGuard as at, nameId as au, one as av, outPlace as aw, outputArc as ax, passthrough as ay, place as az, Transition as b, type TokenSupplier as b0, type Unknown as b1, type Unreachable as b2, type Verdict as b3, type Violated as b4, branchPlaceBound as b5, deadlockFree as b6, isProven as b7, isViolated as b8, joinedOrDeadLettered as b9, mutualExclusion as ba, pInvariant as bb, pInvariantToString as bc, placeBound as bd, propertyDescription as be, unreachable as bf, TransitionContext as c, type ArcInhibitor as d, type ArcInput as e, type ArcOutput as f, type ArcRead as g, type ArcReset as h, ComposeBindings as i, FusionSetBuilder as j, type InAll as k, type InAtLeast as l, type InExactly as m, type InOne as n, Instance as o, Interface as p, InterfaceBuilder as q, type MatchKey as r, type MatchSpec as s, type OutAnd as t, type OutForwardInput as u, type OutPlace as v, type OutTimeout as w, type OutXor as x, type OutputEntry as y, PetriNetBuilder as z };
1780
+ export { type VerificationHarness as $, type Arc as A, type Port as B, type Channel as C, type PortDirection as D, type EnvironmentPlace as E, FusionSet as F, SubnetDefBuilder as G, type SubnetInstance as H, type In as I, type Timing as J, type KeyFn as K, type LogFn as L, MAX_DURATION_MS as M, type NameId as N, type Out as O, PetriNet as P, type TimingDeadline as Q, type TimingDelayed as R, SubnetDef as S, type Token as T, type TimingExact as U, type TimingImmediate as V, type TimingWindow as W, TokenInput as X, TokenOutput as Y, type TransitionAction as Z, TransitionBuilder as _, type Place as a, type Unknown as a$, type VerificationResult as a0, all as a1, allPlaces as a2, and as a3, andPlaces as a4, arcPlace as a5, atLeast as a6, consumptionCount as a7, deadline as a8, delayed as a9, requiredCount as aA, resetArc as aB, timeout as aC, timeoutPlace as aD, tokenAt as aE, tokenOf as aF, transform as aG, transformAsync as aH, transformFrom as aI, unitToken as aJ, window as aK, withTimeout as aL, xor as aM, xorPlaces as aN, MarkingState as aO, type PInvariant as aP, MarkingStateBuilder as aQ, type SmtProperty as aR, type SmtVerificationResult as aS, type BranchPlaceBound as aT, type DeadlockFree as aU, type JoinedOrDeadLettered as aV, type MutualExclusion as aW, type PlaceBound as aX, type Proven as aY, type SmtStatistics as aZ, type TokenSupplier as a_, earliest as aa, enumerateBranches as ab, environmentPlace as ac, exact as ad, exactly as ae, fork as af, forwardInput as ag, hasDeadline as ah, immediate as ai, inhibitorArc as aj, inputArc as ak, isPassthrough as al, isUnit as am, keyForPlace as an, latest as ao, matchCorrelates as ap, matchKey as aq, matchSpec as ar, nameId as as, one as at, outPlace as au, outputArc as av, passthrough as aw, place as ax, produce as ay, readArc as az, Transition as b, type Unreachable as b0, type Verdict as b1, type Violated as b2, branchPlaceBound as b3, deadlockFree as b4, isProven as b5, isViolated as b6, joinedOrDeadLettered as b7, mutualExclusion as b8, pInvariant as b9, pInvariantToString as ba, placeBound as bb, propertyDescription as bc, unreachable as bd, TransitionContext as c, type ArcInhibitor as d, type ArcInput as e, type ArcOutput as f, type ArcRead as g, type ArcReset as h, ComposeBindings as i, FusionSetBuilder as j, type InAll as k, type InAtLeast as l, type InExactly as m, type InOne as n, Instance as o, Interface as p, InterfaceBuilder as q, type MatchKey as r, type MatchSpec as s, type OutAnd as t, type OutForwardInput as u, type OutPlace as v, type OutTimeout as w, type OutXor as x, type OutputEntry as y, PetriNetBuilder as z };
@@ -1,5 +1,5 @@
1
- import { b as Transition, a as Place, P as PetriNet, E as EnvironmentPlace, aQ as MarkingState, aR as PInvariant, aS as MarkingStateBuilder, aT as SmtProperty, aU as SmtVerificationResult } from '../petri-net-C3LSY-vm.js';
2
- export { aV as BranchPlaceBound, aW as DeadlockFree, aX as JoinedOrDeadLettered, aY as MutualExclusion, aZ as PlaceBound, a_ as Proven, a$ as SmtStatistics, b0 as TokenSupplier, b1 as Unknown, b2 as Unreachable, b3 as Verdict, $ as VerificationHarness, a0 as VerificationResult, b4 as Violated, b5 as branchPlaceBound, b6 as deadlockFree, b7 as isProven, b8 as isViolated, b9 as joinedOrDeadLettered, ba as mutualExclusion, bb as pInvariant, bc as pInvariantToString, bd as placeBound, be as propertyDescription, bf as unreachable } from '../petri-net-C3LSY-vm.js';
1
+ import { b as Transition, a as Place, P as PetriNet, E as EnvironmentPlace, aO as MarkingState, aP as PInvariant, aQ as MarkingStateBuilder, aR as SmtProperty, aS as SmtVerificationResult } from '../petri-net-UQBBkvLl.js';
2
+ export { aT as BranchPlaceBound, aU as DeadlockFree, aV as JoinedOrDeadLettered, aW as MutualExclusion, aX as PlaceBound, aY as Proven, aZ as SmtStatistics, a_ as TokenSupplier, a$ as Unknown, b0 as Unreachable, b1 as Verdict, $ as VerificationHarness, a0 as VerificationResult, b2 as Violated, b3 as branchPlaceBound, b4 as deadlockFree, b5 as isProven, b6 as isViolated, b7 as joinedOrDeadLettered, b8 as mutualExclusion, b9 as pInvariant, ba as pInvariantToString, bb as placeBound, bc as propertyDescription, bd as unreachable } from '../petri-net-UQBBkvLl.js';
3
3
  import { Expr, init, Bool, FuncDecl } from 'z3-solver';
4
4
 
5
5
  /**
@@ -341,9 +341,10 @@ type PrioritySemantics = 'none' | 'conflict';
341
341
  * - Operates on the marking projection (integer vectors) — no timing
342
342
  * - An untimed deadlock-freedom proof is stronger than needed
343
343
  * (timing can only restrict behavior)
344
- * - Guards are ignored over-approximation is sound for safety properties
345
- * - If a counterexample is found, it may be spurious in timed/guarded
346
- * semantics the report notes this
344
+ * - Input specifications are purely structural (IO-006) there is no per-arc
345
+ * predicate for the encoder to be blind to
346
+ * - If a counterexample is found, it may be spurious in timed semantics —
347
+ * the report notes this
347
348
  *
348
349
  * Verification Pipeline:
349
350
  * 1. Flatten — expand XOR, index places, build pre/post vectors
@@ -35,7 +35,7 @@ import {
35
35
  propertyDescription,
36
36
  structuralCheck,
37
37
  unreachable
38
- } from "../chunk-7VJ5CYUU.js";
38
+ } from "../chunk-5W6SVYPD.js";
39
39
  import "../chunk-ATT7U5H5.js";
40
40
 
41
41
  // src/verification/analysis/scc-analyzer.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "libpetri",
3
- "version": "2.13.0",
3
+ "version": "3.0.0",
4
4
  "description": "Coloured Time Petri Net engine — TypeScript port",
5
5
  "homepage": "https://libpetri.org",
6
6
  "repository": {