libpetri 5.0.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
 
@@ -1002,6 +1020,31 @@ interface Unknown {
1002
1020
  readonly type: 'unknown';
1003
1021
  readonly reason: string;
1004
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';
1005
1048
  /**
1006
1049
  * Solver statistics.
1007
1050
  */
@@ -1016,6 +1059,13 @@ interface SmtStatistics {
1016
1059
  */
1017
1060
  interface SmtVerificationResult {
1018
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;
1019
1069
  readonly report: string;
1020
1070
  readonly invariants: readonly PInvariant[];
1021
1071
  readonly discoveredInvariants: readonly string[];
@@ -1038,6 +1088,13 @@ interface SmtVerificationResult {
1038
1088
  * `counterexampleReplay(false)`, the coloured ν-encoding / Route B (whose
1039
1089
  * state shapes are outside the flat replayer's scope), or a structural
1040
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.
1041
1098
  */
1042
1099
  readonly counterexampleConfirmed: boolean | null;
1043
1100
  readonly elapsedMs: number;
@@ -1847,4 +1904,4 @@ declare class PetriNetBuilder {
1847
1904
  private buildWithFusion;
1848
1905
  }
1849
1906
 
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 };
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-4HMFNYTH.js";
4
+ } from "../chunk-BPGE7GZR.js";
5
5
 
6
6
  // src/render-dom/index.ts
7
7
  async function renderDotToContainer(dotSource, container, opts = {}) {