libpetri 5.0.0 → 6.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.
@@ -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,7 +860,7 @@ 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 | TerminatesAtSink | MutualExclusion | PlaceBound | Unreachable | BranchPlaceBound | JoinedOrDeadLettered;
863
+ type SmtProperty = DeadlockFree | TerminatesAtSink | MutualExclusion | PlaceBound | Unreachable | BranchPlaceBound | JoinedOrDeadLettered | QuiescentCount;
846
864
  /**
847
865
  * Deadlock-freedom: no reachable quiescent marking strands a token (VER-002).
848
866
  *
@@ -908,6 +926,19 @@ interface JoinedOrDeadLettered {
908
926
  readonly type: 'joined-or-dead-lettered';
909
927
  readonly pending: Place<any>;
910
928
  }
929
+ /**
930
+ * A token count at quiescence (VER-002): every reachable quiescent marking holds between
931
+ * `min` and `max` tokens across `places` (`max` may be `Infinity`). The lower bound is
932
+ * waived while any `waivedBy` place is marked, the upper never: a halted run ([VER-014])
933
+ * need not refund its budget, but never holds more than there is.
934
+ */
935
+ interface QuiescentCount {
936
+ readonly type: 'quiescent-count';
937
+ readonly places: readonly Place<any>[];
938
+ readonly min: number;
939
+ readonly max: number;
940
+ readonly waivedBy: readonly Place<any>[];
941
+ }
911
942
  declare function deadlockFree(): DeadlockFree;
912
943
  /** Quiescence reaches a declared sink (VER-002). See {@link TerminatesAtSink}. */
913
944
  declare function terminatesAtSink(): TerminatesAtSink;
@@ -918,6 +949,14 @@ declare function unreachable(places: ReadonlySet<Place<any>>): Unreachable;
918
949
  declare function branchPlaceBound(place: Place<any>, bound: number): BranchPlaceBound;
919
950
  /** Joined-or-dead-lettered at quiescence (NU-040). See {@link JoinedOrDeadLettered}. */
920
951
  declare function joinedOrDeadLettered(pending: Place<any>): JoinedOrDeadLettered;
952
+ /**
953
+ * A token count at quiescence (VER-002). See {@link QuiescentCount}.
954
+ *
955
+ * ```ts
956
+ * quiescentCount([budget], k, k, [halt]) // the budget is back at k whenever the net comes to rest, unless it halted
957
+ * ```
958
+ */
959
+ declare function quiescentCount(places: Iterable<Place<any>>, min: number, max: number, waivedBy?: Iterable<Place<any>>): QuiescentCount;
921
960
  /** Human-readable description of a property. */
922
961
  declare function propertyDescription(prop: SmtProperty): string;
923
962
 
@@ -944,6 +983,10 @@ declare class MarkingState {
944
983
  totalTokens(): number;
945
984
  /** Checks if no tokens exist anywhere. */
946
985
  isEmpty(): boolean;
986
+ /**
987
+ * The marking as `{name:count, ...}`, places in code-point order of their names, so reports
988
+ * and witness traces print the same on every host ([VER-013], [VER-022]).
989
+ */
947
990
  toString(): string;
948
991
  static empty(): MarkingState;
949
992
  static builder(): MarkingStateBuilder;
@@ -1002,6 +1045,31 @@ interface Unknown {
1002
1045
  readonly type: 'unknown';
1003
1046
  readonly reason: string;
1004
1047
  }
1048
+ /**
1049
+ * Which route decided a verdict ([VER-003]).
1050
+ *
1051
+ * The routes do equivalent work by different means, and a consumer reading the
1052
+ * result's fields rather than its report needs to know which one answered:
1053
+ * `enumeration` and `nu-scg` decide by exploring a finite graph and compute no
1054
+ * P-invariants at all.
1055
+ *
1056
+ * The rule for {@link SmtVerificationResult.invariants} is about the *empty* case
1057
+ * only: an empty list from a route other than `smt` means "not computed", not
1058
+ * "the net has none". A non-empty list is always real — `unavailable` in
1059
+ * particular still carries the invariants the pipeline computed before it found
1060
+ * no usable solver, and `structural` carries whatever the proof rested on.
1061
+ */
1062
+ type VerificationRoute =
1063
+ /** The IC3/PDR pipeline: flatten, invariants, encode, solve ([VER-001]). */
1064
+ 'smt'
1065
+ /** Bounded state-space enumeration ([VER-017]). */
1066
+ | 'enumeration'
1067
+ /** The ν name-partition state-class graph ([VER-012], Route B). */
1068
+ | 'nu-scg'
1069
+ /** A structural proof — Commoner's theorem, or the linear bound of [VER-015]. */
1070
+ | 'structural'
1071
+ /** No route could run (no solver, an unresolved property place). */
1072
+ | 'unavailable';
1005
1073
  /**
1006
1074
  * Solver statistics.
1007
1075
  */
@@ -1016,6 +1084,13 @@ interface SmtStatistics {
1016
1084
  */
1017
1085
  interface SmtVerificationResult {
1018
1086
  readonly verdict: Verdict;
1087
+ /**
1088
+ * Which route decided this verdict ([VER-003]). Read it before concluding
1089
+ * anything from an **empty** {@link invariants}: off the `'smt'` route that
1090
+ * means "not computed", never "none exist". A non-empty list is real whatever
1091
+ * the route says.
1092
+ */
1093
+ readonly route: VerificationRoute;
1019
1094
  readonly report: string;
1020
1095
  readonly invariants: readonly PInvariant[];
1021
1096
  readonly discoveredInvariants: readonly string[];
@@ -1038,6 +1113,13 @@ interface SmtVerificationResult {
1038
1113
  * `counterexampleReplay(false)`, the coloured ν-encoding / Route B (whose
1039
1114
  * state shapes are outside the flat replayer's scope), or a structural
1040
1115
  * proof.
1116
+ *
1117
+ * A `true` from the enumeration route ([VER-017]) means the same thing it means
1118
+ * everywhere else — the trace is an ordered firing sequence that reaches the
1119
+ * violation — even though it was read off the state-class graph rather than
1120
+ * re-executed: the graph path *is* a firing sequence, so there is nothing to
1121
+ * re-confirm. Consumers keying "are these steps ordered" off this field get the
1122
+ * right answer without special-casing the route.
1041
1123
  */
1042
1124
  readonly counterexampleConfirmed: boolean | null;
1043
1125
  readonly elapsedMs: number;
@@ -1847,4 +1929,4 @@ declare class PetriNetBuilder {
1847
1929
  private buildWithFusion;
1848
1930
  }
1849
1931
 
1850
- 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 TerminatesAtSink 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 TokenSupplier as b0, type Unknown as b1, type Unreachable as b2, type Verdict as b3, type Violated as b4, alwaysAvailable as b5, bounded as b6, ignore as b7, branchPlaceBound as b8, deadlockFree as b9, isProven as ba, isViolated as bb, joinedOrDeadLettered as bc, mutualExclusion as bd, pInvariant as be, pInvariantToString as bf, placeBound as bg, propertyDescription as bh, terminatesAtSink as bi, unreachable as bj, 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 };
1932
+ 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 QuiescentCount 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 SmtStatistics as b0, type TerminatesAtSink as b1, type TokenSupplier as b2, type Unknown as b3, type Unreachable as b4, type VerificationRoute as b5, type Violated as b6, alwaysAvailable as b7, bounded as b8, ignore as b9, branchPlaceBound as ba, deadlockFree as bb, isProven as bc, isViolated as bd, joinedOrDeadLettered as be, mutualExclusion as bf, pInvariant as bg, pInvariantToString as bh, placeBound as bi, propertyDescription as bj, quiescentCount as bk, terminatesAtSink as bl, unreachable as bm, 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-4HMFNYTH.js";
4
+ } from "../chunk-5LE2M5PW.js";
5
5
 
6
6
  // src/render-dom/index.ts
7
7
  async function renderDotToContainer(dotSource, container, opts = {}) {