libpetri 4.1.0 → 5.1.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.
@@ -239,6 +239,16 @@ declare function matchCorrelates(spec: MatchSpec, placeName: string): boolean;
239
239
  * - Place: Leaf node representing a single output place
240
240
  * - Timeout: Timeout branch that activates if action exceeds duration
241
241
  * - ForwardInput: Forward consumed input to output on timeout
242
+ *
243
+ * A spec names **places, not counts**. Validation ([IO-015]) compares the SET of
244
+ * places an action wrote against the branches' claims, so an action that deposits
245
+ * several tokens into one named place is accepted — and every analysis that
246
+ * enumerates branches ({@link enumerateBranches}: the state-class graph, the SMT
247
+ * encoding, the ν fragment check) models exactly one token per named place. Such a
248
+ * firing therefore does more than the analyses explore, in the direction that can
249
+ * make a `proven` false. The executors report it once per transition as a `WARN`
250
+ * log-message ([IO-016]); a net meant to be verified should produce one token per
251
+ * named place and express multiplicity in its topology.
242
252
  */
243
253
  type Out = OutAnd | OutXor | OutPlace | OutTimeout | OutForwardInput;
244
254
  interface OutAnd {
@@ -294,11 +304,19 @@ declare function forwardInput(from: Place<any>, to: Place<any>): OutForwardInput
294
304
  /** Collects all leaf places from this output spec (flattened). */
295
305
  declare function allPlaces(out: Out): Set<Place<any>>;
296
306
  /**
297
- * Enumerates all possible output branches for structural analysis.
307
+ * Enumerates all possible output branches for structural analysis ([IO-016]).
298
308
  *
299
309
  * - AND = single branch containing all child places (Cartesian product)
300
310
  * - XOR = one branch per alternative child
301
311
  * - Nested = Cartesian product for AND, union for XOR
312
+ *
313
+ * A branch is a **set** of places: it says which places receive a token, not how
314
+ * many tokens each receives. Analyses built on it (the state-class graph's virtual
315
+ * transitions, the flattener's post vectors, the ν fragment check) deposit one token
316
+ * per place of the chosen branch. An action that writes `n > 1` tokens to a place
317
+ * its branch names once is accepted by [IO-015] but is outside what those analyses
318
+ * explore — a sound under-approximation for safety only when it never happens, which
319
+ * is why the executors warn about it ([IO-016] AC4).
302
320
  */
303
321
  declare function enumerateBranches(out: Out): ReadonlyArray<ReadonlySet<Place<any>>>;
304
322
 
@@ -842,11 +860,30 @@ declare function ignore(): EnvironmentAnalysisMode;
842
860
  * violates the property, Spacer finds a counterexample. If no violation
843
861
  * is reachable, the property is proven.
844
862
  */
845
- type SmtProperty = DeadlockFree | MutualExclusion | PlaceBound | Unreachable | BranchPlaceBound | JoinedOrDeadLettered;
846
- /** Deadlock-freedom: no reachable marking has all transitions disabled. */
863
+ type SmtProperty = DeadlockFree | TerminatesAtSink | MutualExclusion | PlaceBound | Unreachable | BranchPlaceBound | JoinedOrDeadLettered;
864
+ /**
865
+ * Deadlock-freedom: no reachable quiescent marking strands a token (VER-002).
866
+ *
867
+ * Violated when a reachable marking is quiescent (every transition disabled) and
868
+ * holds a token in a place that is not a declared sink. The empty marking strands
869
+ * nothing and never violates. This is workflow-net proper completion; for the
870
+ * weaker "did the net reach a terminal at all", see {@link TerminatesAtSink},
871
+ * which inverts on the empty marking.
872
+ */
847
873
  interface DeadlockFree {
848
874
  readonly type: 'deadlock-free';
849
875
  }
876
+ /**
877
+ * Termination at a declared sink: every reachable quiescent marking has at least
878
+ * one declared sink marked (VER-002).
879
+ *
880
+ * Violated when a reachable marking is quiescent and no declared sink holds a
881
+ * token. Says nothing about tokens left elsewhere. Meaningful only with at least
882
+ * one sink declared; with none, every quiescent marking violates vacuously.
883
+ */
884
+ interface TerminatesAtSink {
885
+ readonly type: 'terminates-at-sink';
886
+ }
850
887
  /** Mutual exclusion: two places never have tokens simultaneously. */
851
888
  interface MutualExclusion {
852
889
  readonly type: 'mutual-exclusion';
@@ -890,6 +927,8 @@ interface JoinedOrDeadLettered {
890
927
  readonly pending: Place<any>;
891
928
  }
892
929
  declare function deadlockFree(): DeadlockFree;
930
+ /** Quiescence reaches a declared sink (VER-002). See {@link TerminatesAtSink}. */
931
+ declare function terminatesAtSink(): TerminatesAtSink;
893
932
  declare function mutualExclusion(p1: Place<any>, p2: Place<any>): MutualExclusion;
894
933
  declare function placeBound(place: Place<any>, bound: number): PlaceBound;
895
934
  declare function unreachable(places: ReadonlySet<Place<any>>): Unreachable;
@@ -981,6 +1020,31 @@ interface Unknown {
981
1020
  readonly type: 'unknown';
982
1021
  readonly reason: string;
983
1022
  }
1023
+ /**
1024
+ * Which route decided a verdict ([VER-003]).
1025
+ *
1026
+ * The routes do equivalent work by different means, and a consumer reading the
1027
+ * result's fields rather than its report needs to know which one answered:
1028
+ * `enumeration` and `nu-scg` decide by exploring a finite graph and compute no
1029
+ * P-invariants at all.
1030
+ *
1031
+ * The rule for {@link SmtVerificationResult.invariants} is about the *empty* case
1032
+ * only: an empty list from a route other than `smt` means "not computed", not
1033
+ * "the net has none". A non-empty list is always real — `unavailable` in
1034
+ * particular still carries the invariants the pipeline computed before it found
1035
+ * no usable solver, and `structural` carries whatever the proof rested on.
1036
+ */
1037
+ type VerificationRoute =
1038
+ /** The IC3/PDR pipeline: flatten, invariants, encode, solve ([VER-001]). */
1039
+ 'smt'
1040
+ /** Bounded state-space enumeration ([VER-017]). */
1041
+ | 'enumeration'
1042
+ /** The ν name-partition state-class graph ([VER-012], Route B). */
1043
+ | 'nu-scg'
1044
+ /** A structural proof — Commoner's theorem, or the linear bound of [VER-015]. */
1045
+ | 'structural'
1046
+ /** No route could run (no solver, an unresolved property place). */
1047
+ | 'unavailable';
984
1048
  /**
985
1049
  * Solver statistics.
986
1050
  */
@@ -995,6 +1059,13 @@ interface SmtStatistics {
995
1059
  */
996
1060
  interface SmtVerificationResult {
997
1061
  readonly verdict: Verdict;
1062
+ /**
1063
+ * Which route decided this verdict ([VER-003]). Read it before concluding
1064
+ * anything from an **empty** {@link invariants}: off the `'smt'` route that
1065
+ * means "not computed", never "none exist". A non-empty list is real whatever
1066
+ * the route says.
1067
+ */
1068
+ readonly route: VerificationRoute;
998
1069
  readonly report: string;
999
1070
  readonly invariants: readonly PInvariant[];
1000
1071
  readonly discoveredInvariants: readonly string[];
@@ -1017,6 +1088,13 @@ interface SmtVerificationResult {
1017
1088
  * `counterexampleReplay(false)`, the coloured ν-encoding / Route B (whose
1018
1089
  * state shapes are outside the flat replayer's scope), or a structural
1019
1090
  * proof.
1091
+ *
1092
+ * A `true` from the enumeration route ([VER-017]) means the same thing it means
1093
+ * everywhere else — the trace is an ordered firing sequence that reaches the
1094
+ * violation — even though it was read off the state-class graph rather than
1095
+ * re-executed: the graph path *is* a firing sequence, so there is nothing to
1096
+ * re-confirm. Consumers keying "are these steps ordered" off this field get the
1097
+ * right answer without special-casing the route.
1020
1098
  */
1021
1099
  readonly counterexampleConfirmed: boolean | null;
1022
1100
  readonly elapsedMs: number;
@@ -1826,4 +1904,4 @@ declare class PetriNetBuilder {
1826
1904
  private buildWithFusion;
1827
1905
  }
1828
1906
 
1829
- 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 TokenSupplier 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, type EnvironmentAnalysisMode as aO, type PInvariant as aP, MarkingState as aQ, type SmtProperty as aR, MarkingStateBuilder as aS, type SmtVerificationResult as aT, type BranchPlaceBound as aU, type DeadlockFree as aV, type JoinedOrDeadLettered as aW, type MutualExclusion as aX, type PlaceBound as aY, type Proven as aZ, type SmtStatistics 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 Unknown as b0, type Unreachable as b1, type Verdict as b2, type Violated as b3, alwaysAvailable as b4, bounded as b5, ignore as b6, branchPlaceBound as b7, deadlockFree as b8, isProven as b9, isViolated as ba, joinedOrDeadLettered as bb, mutualExclusion as bc, pInvariant as bd, pInvariantToString as be, placeBound as bf, propertyDescription as bg, unreachable as bh, 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 };
1907
+ 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, 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, type EnvironmentAnalysisMode as aO, type PInvariant as aP, MarkingState as aQ, type SmtProperty as aR, type Verdict as aS, MarkingStateBuilder 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, 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 TerminatesAtSink as b0, type TokenSupplier as b1, type Unknown as b2, type Unreachable as b3, type VerificationRoute as b4, type Violated as b5, alwaysAvailable as b6, bounded as b7, ignore as b8, branchPlaceBound as b9, deadlockFree as ba, isProven as bb, isViolated as bc, joinedOrDeadLettered as bd, mutualExclusion as be, pInvariant as bf, pInvariantToString as bg, placeBound as bh, propertyDescription as bi, terminatesAtSink as bj, unreachable as bk, 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,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_PANZOOM_OPTS,
3
3
  mount
4
- } from "../chunk-GJAHGHGT.js";
4
+ } from "../chunk-BPGE7GZR.js";
5
5
 
6
6
  // src/render-dom/index.ts
7
7
  async function renderDotToContainer(dotSource, container, opts = {}) {