libpetri 4.0.0 → 4.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.
- package/dist/{chunk-WYCGGQAW.js → chunk-FD3S4TZM.js} +73 -32
- package/dist/chunk-FD3S4TZM.js.map +1 -0
- package/dist/{chunk-KO6TSB47.js → chunk-GJAHGHGT.js} +2 -2
- package/dist/debug/index.d.ts +2 -2
- package/dist/doclet/index.d.ts +1 -1
- package/dist/doclet/resources/petrinet-diagrams.js +1 -1
- package/dist/{event-store-2FOAeUyh.d.ts → event-store-B3ppVTpO.d.ts} +1 -1
- package/dist/export/index.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/{petri-net-hduM6tJf.d.ts → petri-net-p0ONpSAO.d.ts} +32 -2
- package/dist/render-dom/index.js +1 -1
- package/dist/verification/index.d.ts +36 -47
- package/dist/verification/index.js +1 -1
- package/dist/viewer/index.js +1 -1
- package/dist/viewer/viewer.iife.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-WYCGGQAW.js.map +0 -1
- /package/dist/{chunk-KO6TSB47.js.map → chunk-GJAHGHGT.js.map} +0 -0
|
@@ -817,6 +817,24 @@ declare class InterfaceBuilder {
|
|
|
817
817
|
build(): Interface;
|
|
818
818
|
}
|
|
819
819
|
|
|
820
|
+
/**
|
|
821
|
+
* Analysis mode for environment places in state class graph construction.
|
|
822
|
+
*/
|
|
823
|
+
type EnvironmentAnalysisMode = {
|
|
824
|
+
readonly type: 'always-available';
|
|
825
|
+
} | {
|
|
826
|
+
readonly type: 'bounded';
|
|
827
|
+
readonly maxTokens: number;
|
|
828
|
+
} | {
|
|
829
|
+
readonly type: 'ignore';
|
|
830
|
+
};
|
|
831
|
+
/** Assumes environment places always have sufficient tokens. */
|
|
832
|
+
declare function alwaysAvailable(): EnvironmentAnalysisMode;
|
|
833
|
+
/** Analyzes with a bounded number of tokens in environment places. */
|
|
834
|
+
declare function bounded(maxTokens: number): EnvironmentAnalysisMode;
|
|
835
|
+
/** Treats environment places as regular places. */
|
|
836
|
+
declare function ignore(): EnvironmentAnalysisMode;
|
|
837
|
+
|
|
820
838
|
/**
|
|
821
839
|
* Safety properties that can be verified via IC3/PDR.
|
|
822
840
|
*
|
|
@@ -1202,7 +1220,19 @@ declare class SubnetDef<P = void> {
|
|
|
1202
1220
|
* {@link SmtVerificationResult}s
|
|
1203
1221
|
* @throws when an input or in-out port is missing a harness generator
|
|
1204
1222
|
*/
|
|
1205
|
-
verify(harness: VerificationHarness<P
|
|
1223
|
+
verify(harness: VerificationHarness<P>,
|
|
1224
|
+
/**
|
|
1225
|
+
* How injection into the synthetic environment places is modeled (VER-006,
|
|
1226
|
+
* MOD-051 AC3).
|
|
1227
|
+
*
|
|
1228
|
+
* The synthetic net has environment places by construction, so this decides what a
|
|
1229
|
+
* verdict means. The default over-approximates: a `proven` under
|
|
1230
|
+
* `alwaysAvailable()` holds for any environment. Pass `bounded(k)` to prove a
|
|
1231
|
+
* property that holds only when the environment injects at most `k` tokens.
|
|
1232
|
+
* `ignore()` is accepted but cannot yield `proven` — VER-006 refuses to certify a
|
|
1233
|
+
* proof that holds only because injection was never modeled.
|
|
1234
|
+
*/
|
|
1235
|
+
environmentMode?: EnvironmentAnalysisMode): Promise<VerificationResult>;
|
|
1206
1236
|
static builder<P = void>(name: string): SubnetDefBuilder<P>;
|
|
1207
1237
|
/**
|
|
1208
1238
|
* Retrofit utility per **MOD-014**: wraps an existing closed {@link PetriNet}
|
|
@@ -1796,4 +1826,4 @@ declare class PetriNetBuilder {
|
|
|
1796
1826
|
private buildWithFusion;
|
|
1797
1827
|
}
|
|
1798
1828
|
|
|
1799
|
-
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
|
|
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 };
|
package/dist/render-dom/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { b as Transition, a as Place, P as PetriNet, E as EnvironmentPlace, aO as
|
|
2
|
-
export {
|
|
1
|
+
import { b as Transition, a as Place, P as PetriNet, E as EnvironmentPlace, aO as EnvironmentAnalysisMode, aP as PInvariant, aQ as MarkingState, aR as SmtProperty, aS as MarkingStateBuilder, aT as SmtVerificationResult } from '../petri-net-p0ONpSAO.js';
|
|
2
|
+
export { aU as BranchPlaceBound, aV as DeadlockFree, aW as JoinedOrDeadLettered, aX as MutualExclusion, aY as PlaceBound, aZ as Proven, a_ as SmtStatistics, a$ as TokenSupplier, b0 as Unknown, b1 as Unreachable, b2 as Verdict, $ as VerificationHarness, a0 as VerificationResult, b3 as Violated, b4 as alwaysAvailable, b4 as analysisAlwaysAvailable, b5 as analysisBounded, b6 as analysisIgnore, b5 as bounded, b7 as branchPlaceBound, b8 as deadlockFree, b6 as ignore, b9 as isProven, ba as isViolated, bb as joinedOrDeadLettered, bc as mutualExclusion, bd as pInvariant, be as pInvariantToString, bf as placeBound, bg as propertyDescription, bh as unreachable } from '../petri-net-p0ONpSAO.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* A flattened transition with pre/post vectors for SMT encoding.
|
|
@@ -99,24 +99,6 @@ declare class IncidenceMatrix {
|
|
|
99
99
|
numPlaces(): number;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
/**
|
|
103
|
-
* Analysis mode for environment places in state class graph construction.
|
|
104
|
-
*/
|
|
105
|
-
type EnvironmentAnalysisMode = {
|
|
106
|
-
readonly type: 'always-available';
|
|
107
|
-
} | {
|
|
108
|
-
readonly type: 'bounded';
|
|
109
|
-
readonly maxTokens: number;
|
|
110
|
-
} | {
|
|
111
|
-
readonly type: 'ignore';
|
|
112
|
-
};
|
|
113
|
-
/** Assumes environment places always have sufficient tokens. */
|
|
114
|
-
declare function alwaysAvailable(): EnvironmentAnalysisMode;
|
|
115
|
-
/** Analyzes with a bounded number of tokens in environment places. */
|
|
116
|
-
declare function bounded(maxTokens: number): EnvironmentAnalysisMode;
|
|
117
|
-
/** Treats environment places as regular places (default). */
|
|
118
|
-
declare function ignore(): EnvironmentAnalysisMode;
|
|
119
|
-
|
|
120
102
|
/**
|
|
121
103
|
* @module net-flattener
|
|
122
104
|
*
|
|
@@ -504,29 +486,6 @@ type FragmentMode = 'base' | 'extended';
|
|
|
504
486
|
*/
|
|
505
487
|
type PrioritySemantics = 'none' | 'conflict';
|
|
506
488
|
|
|
507
|
-
/**
|
|
508
|
-
* IC3/PDR-based safety verifier for Petri nets using Z3's Spacer engine.
|
|
509
|
-
*
|
|
510
|
-
* Proves safety properties (especially deadlock-freedom) without
|
|
511
|
-
* enumerating all reachable states. IC3 constructs inductive invariants
|
|
512
|
-
* incrementally, which works well for bounded nets.
|
|
513
|
-
*
|
|
514
|
-
* Key design decisions:
|
|
515
|
-
* - Operates on the marking projection (integer vectors) — no timing
|
|
516
|
-
* - An untimed deadlock-freedom proof is stronger than needed
|
|
517
|
-
* (timing can only restrict behavior)
|
|
518
|
-
* - Input specifications are purely structural (IO-006) — there is no per-arc
|
|
519
|
-
* predicate for the encoder to be blind to
|
|
520
|
-
* - If a counterexample is found, it may be spurious in timed semantics —
|
|
521
|
-
* the report notes this
|
|
522
|
-
*
|
|
523
|
-
* Verification Pipeline:
|
|
524
|
-
* 1. Flatten — expand XOR, index places, build pre/post vectors
|
|
525
|
-
* 2. Structural pre-check — siphon/trap analysis (may prove early)
|
|
526
|
-
* 3. P-invariants — compute conservation laws for strengthening
|
|
527
|
-
* 4. SMT encode + query — IC3/PDR via Z3 Spacer
|
|
528
|
-
* 5. Decode result — proof or counterexample trace
|
|
529
|
-
*/
|
|
530
489
|
declare class SmtVerifier {
|
|
531
490
|
private readonly net;
|
|
532
491
|
private _initialMarking;
|
|
@@ -599,13 +558,26 @@ declare class SmtVerifier {
|
|
|
599
558
|
* into a chain whose other combinations avoid it (dropped by the H1 guard). On a
|
|
600
559
|
* net with a few reset arcs that can lose every law of the chains those arcs
|
|
601
560
|
* touch, and without them IC3 has to rediscover the conservation of each chain —
|
|
602
|
-
* on a ~100-place net it does not within any practical budget.
|
|
603
|
-
*
|
|
561
|
+
* on a ~100-place net it does not within any practical budget.
|
|
562
|
+
*
|
|
563
|
+
* **Turn this on if the net has any `all()` / `atLeast(n)` or reset arc on a busy
|
|
564
|
+
* place** — draining an input queue is the everyday case. Every basis row whose
|
|
565
|
+
* support touches such a place fails the H1 guard and is dropped, so the encoders
|
|
566
|
+
* run on a deficient invariant set and nothing in the report says a law is missing
|
|
567
|
+
* beyond the `Dropped` lines.
|
|
568
|
+
*
|
|
569
|
+
* This reaches the **name-coloured** encoder (NU-050) as well as the flat one, and
|
|
570
|
+
* it matters most there. On a 113-place ν-net, whole-net deadlock-freedom went from
|
|
571
|
+
* `unknown` after 50 minutes to `proven` in about 15 seconds with this option as the
|
|
572
|
+
* only change; on the flat path, reachability-safety queries that timed out at 120 s
|
|
573
|
+
* close in about a second.
|
|
604
574
|
*
|
|
605
575
|
* Soundness is unchanged: the semiflows pass the same exact re-validation as the
|
|
606
576
|
* basis rows, the union is pure strengthening (`Semiflow.lean`,
|
|
607
577
|
* `semiflow_union_sound`), and the certificate check re-proves the strengthened
|
|
608
|
-
* invariant
|
|
578
|
+
* invariant — that check is flat-path only, so a coloured `proven` reports
|
|
579
|
+
* `Certificate check: not applicable (name-coloured encoding)`. Off by default so
|
|
580
|
+
* reports stay byte-equal.
|
|
609
581
|
*/
|
|
610
582
|
semiflowInvariants(enabled: boolean): this;
|
|
611
583
|
/**
|
|
@@ -645,6 +617,23 @@ declare class SmtVerifier {
|
|
|
645
617
|
* dead-letter-drain stalls the eager, priority-ordered executor never produces.
|
|
646
618
|
*/
|
|
647
619
|
prioritySemantics(semantics: PrioritySemantics): this;
|
|
620
|
+
/**
|
|
621
|
+
* The name-coloured plan and its encoding, or a null plan when the net is outside
|
|
622
|
+
* the fragment (NU-050) and a null encoding when the property names a place the net
|
|
623
|
+
* does not resolve.
|
|
624
|
+
*
|
|
625
|
+
* {@link verify} and {@link encodeScripts} share this deliberately. They used to
|
|
626
|
+
* invoke `buildColouredPlan` and `encodeColoured` separately, so handing the encoder
|
|
627
|
+
* the wrong one of the two lists changed only one of them — and the script-parity
|
|
628
|
+
* goldens are generated from `encodeScripts`. Unifying the invocation closes that. It
|
|
629
|
+
* does not make the two paths identical: each still computes its own invariant and
|
|
630
|
+
* semiflow lists, so they can still drift through the arguments rather than the call.
|
|
631
|
+
*
|
|
632
|
+
* `invariants` is what the encoder conjoins into every rule body (the null-space
|
|
633
|
+
* basis, unioned with the semiflows when VER-007 is enabled); `semiflows` sets the
|
|
634
|
+
* colour-slot bound k (NU-053). They are not the same list.
|
|
635
|
+
*/
|
|
636
|
+
private colouredAttempt;
|
|
648
637
|
/**
|
|
649
638
|
* The SMT-LIB2 scripts {@link verify} would send to z3 for this configuration,
|
|
650
639
|
* without running a solver (VER-013 AC1): the HORN query (flat, or name-coloured
|
|
@@ -1109,4 +1098,4 @@ declare class TimePetriNetAnalyzerBuilder {
|
|
|
1109
1098
|
build(): TimePetriNetAnalyzer;
|
|
1110
1099
|
}
|
|
1111
1100
|
|
|
1112
|
-
export { type AbstractState,
|
|
1101
|
+
export { type AbstractState, EnvironmentAnalysisMode as AnalysisEnvironmentMode, type BranchEdge, type CertificateCheckOutcome, type CertificateVc, DBM, DUMP_ENV, type DecodedTrace, type EncodedScripts, EnvironmentAnalysisMode, type FlatNet, type FlatTransition, IncidenceMatrix, type LivenessResult, MIN_Z3_VERSION, MarkingState, MarkingStateBuilder, PInvariant, type PrioritySemantics, type QueryProven, type QueryResult, type QueryUnknown, type QueryViolated, type ReplayOptions, type ReplayOutcome, type ReplayStep, type SmtEncoding, SmtProperty, SmtVerificationResult, SmtVerifier, StateClass, StateClassGraph, type StructuralCheckResult, TimePetriNetAnalyzer, TimePetriNetAnalyzerBuilder, type XorBranchAnalysis, type XorBranchInfo, type Z3Exit, Z3ProcessError, type Z3Reply, type Z3Solver, Z3Unavailable, type Z3Version, Z3_ENV, canonicalInvariantOrder, checkCertificate, computePInvariants, computePSemiflows, computeSCCs, decode, decodeStateSet, encode, encodeStepRelationSmt2, findMaximalTrapIn, findMinimalSiphons, findTerminalSCCs, flatNetIndexOf, flatNetPlaceCount, flatNetTransitionCount, flatTransition, flatten, formatZ3Version, isCoveredByInvariants, parseZ3Version, placeholderCertificate, replayCounterexample, resolveZ3, runZ3Spacer, runZ3Text, strengthenWithSemiflows, structuralCheck, vcScript, z3Available, z3SolverAt };
|
package/dist/viewer/index.js
CHANGED
|
@@ -6358,7 +6358,7 @@ textContent??"").replace(/^cluster_/,"");Mn.classList.toggle("is-hidden",!N.has(
|
|
|
6358
6358
|
en",!bn.has(v))}if(!Q)for(let Mn of Array.from(P.querySelectorAll("g.node.petri-replica")))Mn.classList.add("is-hidden");let Sn=new Map;for(let Mn of Array.from(P.querySelectorAll("g.node"))){let v=Mn.getAttribute("data-id");v&&Sn.set(v,Mn)}for(let Mn of Array.from(P.querySelectorAll("g.edge"))){let v=Mn.getAttribute("data-src")??"",Vn=Mn.getAttribute("data-dst")??"",te=Sn.get(v)?.classList.contains(
|
|
6359
6359
|
"is-hidden")??!1,pe=Sn.get(Vn)?.classList.contains("is-hidden")??!1;Mn.classList.toggle("is-hidden",te||pe)}}var Pfe=["--lpv-bg","--lpv-header-bg","--lpv-border","--lpv-text","--lpv-muted","--lpv-cluster-bg","--lpv-cluster-bg-collapsed","--lpv-cluster-stroke-width","--lpv-cluster-stroke-dash","--lpv-cluster-fill-tint","--lpv-dim-opacity","--lpv-active-filter-outline","--lpv-legend-bg","--lpv-chip-bg","--lpv-chip-active-bg","--lpv-sidebar-bg","--lpv-sidebar-border","--lpv-sidebar-text","--lpv-sidebar-mute\
|
|
6360
6360
|
d","--lpv-sidebar-chip-bg","--lpv-sidebar-chip-hover-bg","--lpv-sidebar-chip-off-opacity","--lpv-shared-glyph-color","--lpv-replica-fill","--lpv-replica-stroke","--lpv-highlight-stroke","--lpv-highlight-glow","--lpv-neighbor-stroke","--lpv-faded-node-opacity","--lpv-faded-edge-opacity","--lpv-faded-cluster-opacity"];var zPe=/^\s*subgraph\s+cluster_[A-Za-z0-9_]+\s*\{\s*$/,KPe=/^\s*\}\s*$/;function Cfe(P){let O=P.split("\n"),N=[],Q=0;for(let bn of O){if(zPe.test(bn)){Q++;continue}if(Q>0){if(KPe.test(bn)){Q--;continue}(bn.includes("[")||bn.includes("->"))&&N.push(_fe(bn));continue}if(bn.includes("->")&&(bn.includes("ltail=")||bn.includes("lhead="))){N.push(_fe(bn));continue}N.push(bn)}return N.join("\n")}function _fe(P){
|
|
6361
|
-
return P.replace(/,\s*ltail="cluster_[^"]*"/g,"").replace(/,\s*lhead="cluster_[^"]*"/g,"").replace(/\[\s*ltail="cluster_[^"]*"\s*,\s*/g,"[").replace(/\[\s*lhead="cluster_[^"]*"\s*,\s*/g,"[").replace(/\[\s*ltail="cluster_[^"]*"\s*\]/g,"[]").replace(/\[\s*lhead="cluster_[^"]*"\s*\]/g,"[]")}var Ofe="4.
|
|
6361
|
+
return P.replace(/,\s*ltail="cluster_[^"]*"/g,"").replace(/,\s*lhead="cluster_[^"]*"/g,"").replace(/\[\s*ltail="cluster_[^"]*"\s*,\s*/g,"[").replace(/\[\s*lhead="cluster_[^"]*"\s*,\s*/g,"[").replace(/\[\s*ltail="cluster_[^"]*"\s*\]/g,"[]").replace(/\[\s*lhead="cluster_[^"]*"\s*\]/g,"[]")}var Ofe="4.1.0";async function ale(P,O,N={}){let Q=N.previousHandle??null,bn=Q?new Set(Q.collapsedPrefixes):new Set,Sn=Q?.activeFilter??null,Mn=N.subnets??Q?.subnets??"show";Q&&Q.dispose();let v=await Promise.resolve().then(()=>(lle(),fle)),Vn=(N.layout??"elk")==="elk",te=Mn==="hide"?Cfe(P):P,pe={clusterLayout:N.clusterLayout,leafPacking:N.leafPacking},$e=Vn?await v.renderDotToSvgWithElkLayout(te,pe):await v.renderDotToSvg(
|
|
6362
6362
|
te);O.innerHTML="",O.appendChild($e),O.classList.add("libpetri-viewer");let ft=mfe($e,N.panzoom),gt=z0n($e);Ffe(gt);let $t=N.layout??"elk";$t==="elk"&&(xfe($e),vz($e));let Be=new Set,dt=null,Ie=null,_t=!1,We=null,Pn=null,Bt=!0;function It(){if(!N.chrome||We&&We.parentNode===O)return;We=document.createElement("div"),We.className="libpetri-viewer-chrome",We.style.position="absolute",We.style.inset="\
|
|
6363
6363
|
0",We.style.pointerEvents="none";let Rt=document.createElement("div");Rt.className="diagram-controls",Rt.style.pointerEvents="auto";let or=document.createElement("button");or.type="button",or.className="diagram-btn btn-reset",or.title="Reset view",or.textContent="Reset",or.addEventListener("click",()=>Ir.fit());let ui=document.createElement("button");ui.type="button",ui.className="diagram-btn btn-\
|
|
6364
6364
|
fullscreen",ui.title="Toggle fullscreen",ui.textContent="Fullscreen",ui.addEventListener("click",()=>Yr(O,ui));let wr=document.createElement("button");wr.type="button",wr.className="diagram-btn btn-subnets",wr.title=Mn==="show"?"Hide subnet groupings":"Show subnet groupings",wr.textContent=Mn==="show"?"Flat view":"Subnets view",wr.addEventListener("click",()=>{Ir.toggleSubnets()}),Rt.appendChild(wr),
|