gdp-wired 0.48.0 → 0.50.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/README.md +6 -2
- package/dist/core/bmc.js +10 -7
- package/dist/core/candidate-seeds.d.ts +25 -0
- package/dist/core/candidate-seeds.js +90 -0
- package/dist/core/check.js +7 -2
- package/dist/core/cli.js +3 -0
- package/dist/core/count-attempt-work.d.ts +29 -0
- package/dist/core/count-attempt-work.js +96 -0
- package/dist/core/count-boolean-partition.d.ts +5 -0
- package/dist/core/count-boolean-partition.js +47 -0
- package/dist/core/count-bounded-quotient.d.ts +2 -0
- package/dist/core/count-bounded-quotient.js +13 -0
- package/dist/core/count-case-compose.d.ts +20 -0
- package/dist/core/count-case-compose.js +289 -0
- package/dist/core/count-cases.js +3 -2
- package/dist/core/count-cert-rename.d.ts +10 -0
- package/dist/core/count-cert-rename.js +69 -0
- package/dist/core/count-cert-transport.d.ts +10 -2
- package/dist/core/count-cert-transport.js +60 -9
- package/dist/core/count-certificate-minimize.d.ts +57 -0
- package/dist/core/count-certificate-minimize.js +263 -0
- package/dist/core/count-closed-family.d.ts +32 -0
- package/dist/core/count-closed-family.js +143 -0
- package/dist/core/count-closing-budget.d.ts +10 -0
- package/dist/core/count-closing-budget.js +49 -0
- package/dist/core/count-closing-needs.d.ts +5 -0
- package/dist/core/count-closing-needs.js +9 -0
- package/dist/core/count-component-budget.d.ts +5 -0
- package/dist/core/count-component-budget.js +9 -0
- package/dist/core/count-copy-shape.d.ts +11 -0
- package/dist/core/count-copy-shape.js +40 -0
- package/dist/core/count-disjoint-funding.d.ts +75 -0
- package/dist/core/count-disjoint-funding.js +284 -0
- package/dist/core/count-emitter-frame-pool.d.ts +23 -0
- package/dist/core/count-emitter-frame-pool.js +87 -0
- package/dist/core/count-final-step.d.ts +5 -0
- package/dist/core/count-final-step.js +20 -0
- package/dist/core/count-fixed-frame.d.ts +4 -0
- package/dist/core/count-fixed-frame.js +30 -0
- package/dist/core/count-frames.d.ts +25 -0
- package/dist/core/count-frames.js +118 -0
- package/dist/core/count-frozen-guard.d.ts +2 -0
- package/dist/core/count-frozen-guard.js +31 -0
- package/dist/core/count-generation-phase.d.ts +7 -0
- package/dist/core/count-generation-phase.js +33 -0
- package/dist/core/count-guard-composition.d.ts +12 -0
- package/dist/core/count-guard-composition.js +48 -0
- package/dist/core/count-guard-context.d.ts +11 -0
- package/dist/core/count-guard-context.js +50 -0
- package/dist/core/count-guard-facts.d.ts +50 -0
- package/dist/core/count-guard-facts.js +97 -0
- package/dist/core/count-guard-proposals.d.ts +7 -0
- package/dist/core/count-guard-proposals.js +106 -0
- package/dist/core/count-guard-shape.d.ts +18 -0
- package/dist/core/count-guard-shape.js +100 -0
- package/dist/core/count-guard-tree.d.ts +17 -0
- package/dist/core/count-guard-tree.js +125 -0
- package/dist/core/count-leader-facts.d.ts +10 -0
- package/dist/core/count-leader-facts.js +52 -0
- package/dist/core/count-leader.d.ts +10 -0
- package/dist/core/count-leader.js +331 -0
- package/dist/core/count-lemma-transport.d.ts +8 -0
- package/dist/core/count-lemma-transport.js +47 -0
- package/dist/core/count-lifted-budget.d.ts +54 -0
- package/dist/core/count-lifted-budget.js +97 -0
- package/dist/core/count-lifted-copy.d.ts +3 -0
- package/dist/core/count-lifted-copy.js +166 -0
- package/dist/core/count-lifted-increment.d.ts +3 -0
- package/dist/core/count-lifted-increment.js +146 -0
- package/dist/core/count-lifted-load.d.ts +5 -0
- package/dist/core/count-lifted-load.js +179 -0
- package/dist/core/count-lifted-prerequisite.d.ts +14 -0
- package/dist/core/count-lifted-prerequisite.js +53 -0
- package/dist/core/count-lifted-replacement.d.ts +3 -0
- package/dist/core/count-lifted-replacement.js +540 -0
- package/dist/core/count-lifted-shape.d.ts +63 -0
- package/dist/core/count-lifted-shape.js +115 -0
- package/dist/core/count-lifted-strategy.d.ts +7 -0
- package/dist/core/count-lifted-strategy.js +226 -0
- package/dist/core/count-lifted-transports.d.ts +32 -0
- package/dist/core/count-lifted-transports.js +293 -0
- package/dist/core/count-load-shape.d.ts +17 -0
- package/dist/core/count-load-shape.js +67 -0
- package/dist/core/count-minimal-view.d.ts +26 -0
- package/dist/core/count-minimal-view.js +46 -0
- package/dist/core/count-operation-observation.d.ts +9 -0
- package/dist/core/count-operation-observation.js +22 -0
- package/dist/core/count-operation-order.d.ts +5 -0
- package/dist/core/count-operation-order.js +4 -0
- package/dist/core/count-phase.d.ts +9 -0
- package/dist/core/count-phase.js +127 -0
- package/dist/core/count-premise-search.d.ts +9 -0
- package/dist/core/count-premise-search.js +41 -0
- package/dist/core/count-premise-view.d.ts +19 -0
- package/dist/core/count-premise-view.js +220 -0
- package/dist/core/count-prerequisite-components.d.ts +67 -0
- package/dist/core/count-prerequisite-components.js +239 -0
- package/dist/core/count-prerequisite-memory.d.ts +24 -0
- package/dist/core/count-prerequisite-memory.js +37 -0
- package/dist/core/count-prerequisite-plan.d.ts +12 -0
- package/dist/core/count-prerequisite-plan.js +88 -0
- package/dist/core/count-primitive-budget.d.ts +1 -0
- package/dist/core/count-primitive-budget.js +8 -0
- package/dist/core/count-project-free.d.ts +3 -0
- package/dist/core/count-project-free.js +24 -0
- package/dist/core/count-project-witness.d.ts +4 -0
- package/dist/core/count-project-witness.js +48 -0
- package/dist/core/count-proof-rescope.d.ts +14 -0
- package/dist/core/count-proof-rescope.js +71 -0
- package/dist/core/count-proof-scope.d.ts +68 -0
- package/dist/core/count-proof-scope.js +333 -0
- package/dist/core/count-prune-owned-root.d.ts +5 -0
- package/dist/core/count-prune-owned-root.js +27 -0
- package/dist/core/count-query-context.d.ts +3 -0
- package/dist/core/count-query-context.js +7 -0
- package/dist/core/count-query.d.ts +15 -0
- package/dist/core/count-query.js +59 -0
- package/dist/core/count-quorum-leaf.d.ts +9 -0
- package/dist/core/count-quorum-leaf.js +38 -0
- package/dist/core/count-reachability-budget.d.ts +1 -0
- package/dist/core/count-reachability-budget.js +7 -0
- package/dist/core/count-reachability-reconcile.d.ts +11 -0
- package/dist/core/count-reachability-reconcile.js +19 -0
- package/dist/core/count-reachability.d.ts +50 -0
- package/dist/core/count-reachability.js +351 -0
- package/dist/core/count-rebase-path.d.ts +9 -0
- package/dist/core/count-rebase-path.js +68 -0
- package/dist/core/count-recipe-context.d.ts +45 -0
- package/dist/core/count-recipe-context.js +71 -0
- package/dist/core/count-recipe-controller.d.ts +115 -0
- package/dist/core/count-recipe-controller.js +417 -0
- package/dist/core/count-recipe-graph.d.ts +36 -0
- package/dist/core/count-recipe-graph.js +211 -0
- package/dist/core/count-recovery/conditional-check-cache.js +3 -2
- package/dist/core/count-recovery/conditional-cuts.js +5 -4
- package/dist/core/count-recovery/conditional-proof.d.ts +37 -3
- package/dist/core/count-recovery/conditional-proof.js +72 -30
- package/dist/core/count-recovery/derivability-closure.js +2 -1
- package/dist/core/count-recovery/guard-cases.js +2 -1
- package/dist/core/count-recovery/reframe-tree.d.ts +2 -0
- package/dist/core/count-recovery/reframe-tree.js +24 -0
- package/dist/core/count-recovery/replay-linear-skeleton.d.ts +2 -0
- package/dist/core/count-recovery/replay-linear-skeleton.js +28 -0
- package/dist/core/count-recovery/row-cases.js +2 -1
- package/dist/core/count-rejection-budget.d.ts +8 -0
- package/dist/core/count-rejection-budget.js +15 -0
- package/dist/core/count-replacement.d.ts +5 -0
- package/dist/core/count-replacement.js +129 -0
- package/dist/core/count-replay-diagnostic.d.ts +21 -0
- package/dist/core/count-replay-diagnostic.js +49 -0
- package/dist/core/count-replay-skeleton.d.ts +4 -0
- package/dist/core/count-replay-skeleton.js +28 -0
- package/dist/core/count-rescope-funding.d.ts +3 -0
- package/dist/core/count-rescope-funding.js +17 -0
- package/dist/core/count-restrictions.d.ts +11 -0
- package/dist/core/count-restrictions.js +31 -0
- package/dist/core/count-retry-budget.d.ts +67 -0
- package/dist/core/count-retry-budget.js +114 -0
- package/dist/core/count-retry-round.d.ts +24 -0
- package/dist/core/count-retry-round.js +44 -0
- package/dist/core/count-row-agreement.d.ts +35 -0
- package/dist/core/count-row-agreement.js +270 -0
- package/dist/core/count-row-aliases.d.ts +3 -0
- package/dist/core/count-row-aliases.js +59 -0
- package/dist/core/count-row-composition.d.ts +6 -0
- package/dist/core/count-row-composition.js +55 -0
- package/dist/core/count-row-copy-linear.d.ts +4 -0
- package/dist/core/count-row-copy-linear.js +83 -0
- package/dist/core/count-row-copy.d.ts +4 -0
- package/dist/core/count-row-copy.js +94 -0
- package/dist/core/count-row-policy.d.ts +3 -0
- package/dist/core/count-row-policy.js +56 -0
- package/dist/core/count-row-reindex.d.ts +11 -0
- package/dist/core/count-row-reindex.js +126 -0
- package/dist/core/count-row-support.d.ts +9 -0
- package/dist/core/count-row-support.js +42 -0
- package/dist/core/count-row-symmetry.d.ts +7 -0
- package/dist/core/count-row-symmetry.js +100 -0
- package/dist/core/count-scope-hyps.d.ts +2 -0
- package/dist/core/count-scope-hyps.js +163 -0
- package/dist/core/count-scope-row-reuse.d.ts +3 -0
- package/dist/core/count-scope-row-reuse.js +92 -0
- package/dist/core/count-search-allowance.d.ts +1 -0
- package/dist/core/count-search-allowance.js +17 -0
- package/dist/core/count-stabilize-tree.d.ts +9 -0
- package/dist/core/count-stabilize-tree.js +35 -0
- package/dist/core/count-stage-trace.d.ts +8 -0
- package/dist/core/count-stage-trace.js +45 -0
- package/dist/core/count-strategies.d.ts +16 -0
- package/dist/core/count-strategies.js +155 -0
- package/dist/core/count-strategy-premises.d.ts +5 -0
- package/dist/core/count-strategy-premises.js +14 -0
- package/dist/core/count-strategy.d.ts +41 -0
- package/dist/core/count-strategy.js +76 -0
- package/dist/core/count-support.d.ts +1 -0
- package/dist/core/count-support.js +26 -4
- package/dist/core/count-tier-budget.d.ts +14 -0
- package/dist/core/count-tier-budget.js +64 -0
- package/dist/core/count-unwritten-prefix.d.ts +24 -0
- package/dist/core/count-unwritten-prefix.js +97 -0
- package/dist/core/count-write-shape.d.ts +15 -0
- package/dist/core/count-write-shape.js +73 -0
- package/dist/core/counted-candidate-seeds.d.ts +12 -0
- package/dist/core/counted-candidate-seeds.js +31 -0
- package/dist/core/counts.d.ts +37 -13
- package/dist/core/counts.js +999 -129
- package/dist/core/cycles.js +5 -4
- package/dist/core/cyclic.js +11 -10
- package/dist/core/data.js +16 -15
- package/dist/core/dsl-deadline.d.ts +3 -0
- package/dist/core/dsl-deadline.js +27 -0
- package/dist/core/dsl.d.ts +32 -2
- package/dist/core/dsl.js +202 -64
- package/dist/core/evaluation-admission.d.ts +1 -0
- package/dist/core/evaluation-admission.js +3 -0
- package/dist/core/exists.d.ts +6 -1
- package/dist/core/exists.js +53 -10
- package/dist/core/field-laws.d.ts +3 -1
- package/dist/core/field-laws.js +159 -3
- package/dist/core/finite-houdini.d.ts +6 -0
- package/dist/core/finite-houdini.js +63 -21
- package/dist/core/finite-tiny.js +95 -67
- package/dist/core/fixtures/count-completion/paxos-decision.json +1 -0
- package/dist/core/fresh.js +5 -1
- package/dist/core/infer.js +49 -33
- package/dist/core/kind.js +2 -1
- package/dist/core/lemma-cuts.js +11 -10
- package/dist/core/lift-cli.d.ts +11 -0
- package/dist/core/lift-cli.js +113 -0
- package/dist/core/linear-admission.d.ts +14 -0
- package/dist/core/linear-admission.js +151 -0
- package/dist/core/machine.d.ts +5 -2
- package/dist/core/machine.js +105 -31
- package/dist/core/meter.d.ts +22 -0
- package/dist/core/meter.js +34 -0
- package/dist/core/nonterm.js +4 -3
- package/dist/core/proof-output.d.ts +53 -0
- package/dist/core/proof-output.js +38 -0
- package/dist/core/prover-row-budget.d.ts +3 -0
- package/dist/core/prover-row-budget.js +106 -0
- package/dist/core/quorum-laws.d.ts +21 -1
- package/dist/core/quorum-laws.js +80 -17
- package/dist/core/rationals.js +3 -2
- package/dist/core/rejection-discovery.d.ts +34 -0
- package/dist/core/rejection-discovery.js +36 -0
- package/dist/core/rejection-stage.d.ts +39 -0
- package/dist/core/rejection-stage.js +205 -0
- package/dist/core/request-quotient.d.ts +8 -0
- package/dist/core/request-quotient.js +299 -0
- package/dist/core/row-agreement-shape.d.ts +15 -0
- package/dist/core/row-agreement-shape.js +68 -0
- package/dist/core/runtime-wall.d.ts +2 -0
- package/dist/core/search-policy.d.ts +15 -0
- package/dist/core/search-policy.js +68 -0
- package/dist/core/solver.d.ts +1 -1
- package/dist/core/solver.js +40 -6
- package/dist/core/step-work.d.ts +12 -0
- package/dist/core/step-work.js +14 -0
- package/dist/core/strategy-premises.d.ts +8 -0
- package/dist/core/strategy-premises.js +64 -0
- package/dist/core/system.js +4 -3
- package/dist/core/table-admission.d.ts +1 -0
- package/dist/core/table-admission.js +3 -0
- package/dist/core/trace-clock.d.ts +3 -0
- package/dist/core/trace-clock.js +16 -0
- package/dist/core/transfer.js +3 -2
- package/dist/core/translate.js +16 -3
- package/dist/core/wall.d.ts +6 -1
- package/dist/core/wall.js +23 -9
- package/dist/core/watch.d.ts +1 -1
- package/dist/core/watch.js +13 -4
- package/dist/core/work-admission.d.ts +164 -0
- package/dist/core/work-admission.js +418 -0
- package/dist/core/work-amount.d.ts +21 -0
- package/dist/core/work-amount.js +80 -0
- package/dist/core/work-collections.d.ts +11 -0
- package/dist/core/work-collections.js +198 -0
- package/dist/core/work-kinds.d.ts +11 -0
- package/dist/core/work-kinds.js +9 -0
- package/dist/core/work-meter.d.ts +8 -0
- package/dist/core/work-meter.js +83 -0
- package/dist/core/work-observe.d.ts +12 -0
- package/dist/core/work-observe.js +39 -0
- package/dist/core/work-profile.d.ts +10 -0
- package/dist/core/work-profile.js +21 -0
- package/dist/core/work-refusal.d.ts +1 -0
- package/dist/core/work-refusal.js +6 -0
- package/dist/interchange/format.js +2 -0
- package/dist/kernel/cdcl.js +93 -40
- package/dist/kernel/epr.js +23 -8
- package/dist/kernel/function-instances.d.ts +45 -0
- package/dist/kernel/function-instances.js +460 -0
- package/dist/kernel/kernel.d.ts +47 -1
- package/dist/kernel/kernel.js +417 -68
- package/dist/kernel/prove.d.ts +61 -6
- package/dist/kernel/prove.js +625 -205
- package/dist/kernel/prover-rows.d.ts +1 -0
- package/dist/kernel/prover-rows.js +12 -1
- package/dist/kernel/reader.d.ts +1 -1
- package/dist/kernel/reader.js +57 -12
- package/dist/kernel/simplex.js +9 -2
- package/dist/lean-kernel/axiom-audit.d.ts +11 -0
- package/dist/lean-kernel/axiom-audit.js +50 -0
- package/dist/lean-kernel/emit.d.ts +34 -3
- package/dist/lean-kernel/emit.js +215 -28
- package/dist/lean-kernel/legacy-family-library.d.ts +1 -0
- package/dist/lean-kernel/legacy-family-library.js +5 -0
- package/dist/lean-kernel/legacy-family-order.d.ts +1 -0
- package/dist/lean-kernel/legacy-family-order.js +26 -0
- package/dist/lean-kernel/library.js +25 -3
- package/dist/lean-kernel/lift/counted-source-data.d.ts +7 -0
- package/dist/lean-kernel/lift/counted-source-data.js +78 -0
- package/dist/lean-kernel/lift/index.d.ts +82 -0
- package/dist/lean-kernel/lift/index.js +116 -0
- package/dist/lean-kernel/lift/project.d.ts +4 -0
- package/dist/lean-kernel/lift/project.js +15 -0
- package/dist/lean-kernel/lift/proof-capture.d.ts +104 -0
- package/dist/lean-kernel/lift/proof-capture.js +216 -0
- package/dist/lean-kernel/lift/proof-codec.d.ts +28 -0
- package/dist/lean-kernel/lift/proof-codec.js +299 -0
- package/dist/lean-kernel/lift/proof-counted-source.d.ts +16 -0
- package/dist/lean-kernel/lift/proof-counted-source.js +68 -0
- package/dist/lean-kernel/lift/proof-frontier.d.ts +19 -0
- package/dist/lean-kernel/lift/proof-frontier.js +153 -0
- package/dist/lean-kernel/lift/proof-graph.d.ts +17 -0
- package/dist/lean-kernel/lift/proof-graph.js +130 -0
- package/dist/lean-kernel/lift/proof-parts.d.ts +29 -0
- package/dist/lean-kernel/lift/proof-parts.js +131 -0
- package/dist/lean-kernel/lift/proof-prelude.d.ts +2 -0
- package/dist/lean-kernel/lift/proof-prelude.js +38 -0
- package/dist/lean-kernel/lift/proof-witness.d.ts +30 -0
- package/dist/lean-kernel/lift/proof-witness.js +283 -0
- package/dist/lean-kernel/lift/shape.d.ts +5 -0
- package/dist/lean-kernel/lift/shape.js +57 -0
- package/dist/lean-kernel/lift/source-projection.d.ts +16 -0
- package/dist/lean-kernel/lift/source-projection.js +81 -0
- package/dist/lean-kernel/lift/source.d.ts +23 -0
- package/dist/lean-kernel/lift/source.js +111 -0
- package/dist/lean-kernel/lift/witness-alpha.d.ts +9 -0
- package/dist/lean-kernel/lift/witness-alpha.js +31 -0
- package/dist/lean-kernel/lift-legacy.d.ts +58 -0
- package/dist/lean-kernel/lift-legacy.js +84 -0
- package/dist/lean-kernel/lift-names.d.ts +22 -0
- package/dist/lean-kernel/lift-names.js +36 -0
- package/dist/lean-kernel/lift-simulation/index.d.ts +29 -0
- package/dist/lean-kernel/lift-simulation/index.js +352 -0
- package/dist/lean-kernel/lift-simulation/shape.d.ts +41 -0
- package/dist/lean-kernel/lift-simulation/shape.js +173 -0
- package/dist/lean-kernel/lift-special/index.d.ts +36 -0
- package/dist/lean-kernel/lift-special/index.js +241 -0
- package/dist/lean-kernel/lift-special/structural.d.ts +25 -0
- package/dist/lean-kernel/lift-special/structural.js +126 -0
- package/dist/lean-kernel/lift-typed/index.d.ts +35 -0
- package/dist/lean-kernel/lift-typed/index.js +256 -0
- package/dist/lean-kernel/lift-typed/roles.d.ts +17 -0
- package/dist/lean-kernel/lift-typed/roles.js +170 -0
- package/dist/lean-kernel/lift-typed/shape.d.ts +1 -0
- package/dist/lean-kernel/lift-typed/shape.js +12 -0
- package/dist/lean-kernel/lift.d.ts +30 -0
- package/dist/lean-kernel/lift.js +97 -0
- package/package.json +5 -1
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { checkWall } from "./wall.js";
|
|
2
|
+
// Ignore display labels and alpha-renaming, not free names, constants, maps,
|
|
3
|
+
// quantifier kinds or structure. Local all-binders shadow the outer binders.
|
|
4
|
+
export function strategyLawKey(law) {
|
|
5
|
+
const names = [law.forall, ...law.keys ?? [], ...law.some ?? []].filter((name) => name !== undefined);
|
|
6
|
+
if (new Set(names).size !== names.length)
|
|
7
|
+
throw new Error('duplicate strategy law binder');
|
|
8
|
+
const visit = (value, scope) => {
|
|
9
|
+
checkWall('strategy premise identity');
|
|
10
|
+
if (!value || typeof value !== 'object')
|
|
11
|
+
return value;
|
|
12
|
+
if (Array.isArray(value))
|
|
13
|
+
return value.map(v => visit(v, scope));
|
|
14
|
+
const object = value;
|
|
15
|
+
if (object.op === 'var' && typeof object.name === 'string') {
|
|
16
|
+
const index = scope.lastIndexOf(object.name);
|
|
17
|
+
return index < 0 ? ['free', object.name] : ['bound', scope.length - index - 1];
|
|
18
|
+
}
|
|
19
|
+
if (object.op === 'all' && typeof object.key === 'string') {
|
|
20
|
+
const local = [object.key, ...(object.keys ?? [])];
|
|
21
|
+
return ['all', local.length, visit(object.c, [...scope, ...local])];
|
|
22
|
+
}
|
|
23
|
+
return Object.keys(object).sort().map(key => [key, visit(object[key], scope)]);
|
|
24
|
+
};
|
|
25
|
+
return JSON.stringify([law.forall !== undefined, law.keys?.length ?? 0, law.some?.length ?? 0, visit(law.holds, names)]);
|
|
26
|
+
}
|
|
27
|
+
export function strategyPremiseSelector(machine, family, rejected) {
|
|
28
|
+
const rows = family.map(law => ({ law, name: law.name, key: strategyLawKey(law) }));
|
|
29
|
+
if (new Set(family.map(law => law.name)).size !== family.length)
|
|
30
|
+
throw new Error('ambiguous strategy law name');
|
|
31
|
+
const denied = new Set(rejected.map(strategyLawKey)), allowed = rows.filter(row => !denied.has(row.key));
|
|
32
|
+
const names = new Set(allowed.map(row => row.law.name)), familyNames = new Set(family.map(law => law.name));
|
|
33
|
+
const flags = new Set(Object.keys(machine.step.flags ?? {}).map(name => '?' + name).filter(name => !familyNames.has(name)));
|
|
34
|
+
const unchanged = () => {
|
|
35
|
+
for (const row of rows)
|
|
36
|
+
if (row.law.name !== row.name || strategyLawKey(row.law) !== row.key)
|
|
37
|
+
throw new Error('strategy family changed after selection');
|
|
38
|
+
};
|
|
39
|
+
const assertInstances = (instances) => {
|
|
40
|
+
unchanged();
|
|
41
|
+
for (const name of Object.keys(instances))
|
|
42
|
+
if (!names.has(name) && !flags.has(name))
|
|
43
|
+
throw new Error('rejected or unknown strategy premise: ' + name);
|
|
44
|
+
};
|
|
45
|
+
return Object.freeze({
|
|
46
|
+
find(predicate) {
|
|
47
|
+
unchanged();
|
|
48
|
+
const matches = allowed.filter(row => predicate(row.law));
|
|
49
|
+
unchanged();
|
|
50
|
+
if (matches.length > 1)
|
|
51
|
+
throw new Error('ambiguous strategy premise');
|
|
52
|
+
return matches[0]?.law;
|
|
53
|
+
},
|
|
54
|
+
assertInstances,
|
|
55
|
+
run(instances, attempt) {
|
|
56
|
+
assertInstances(instances);
|
|
57
|
+
// The same filtered family must build the goal; excluding a scalar's tuple
|
|
58
|
+
// alone would not exclude its automatically assumed state-law premise.
|
|
59
|
+
const result = attempt(Object.freeze(allowed.map(row => row.law)), instances);
|
|
60
|
+
assertInstances(instances);
|
|
61
|
+
return result;
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
package/dist/core/system.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { searchNow as countedSearchNow } from "./wall.js";
|
|
1
2
|
// Systems (research/distributed/DESIGN.md): handlers, their stores and message pools, and the environment, as one rule,
|
|
2
3
|
// so every prover takes a distributed system as it takes one process. Each combinator returns a plain Machine (or, from
|
|
3
4
|
// `system`, a Rule over it), and nothing here is trusted: a proof is about the rule built, and what it assumes of the
|
|
@@ -628,7 +629,7 @@ export function shrinkRun(r, w, run) {
|
|
|
628
629
|
// a depth, for each of a few requests drawn. A run found breaks the law on the interpreter, as the search's do. (The
|
|
629
630
|
// search's own runs draw each request apart: three calls on one lock are rare among them.)
|
|
630
631
|
export function contend(e, w, opts = {}) {
|
|
631
|
-
const m = e.rule.machine, rt = interpret(m), bound = opts.bound ?? 2, until =
|
|
632
|
+
const m = e.rule.machine, rt = interpret(m), bound = opts.bound ?? 2, until = countedSearchNow() + (opts.ms ?? 3000), calls = opts.calls ?? 3;
|
|
632
633
|
let seed = opts.seed ?? 7;
|
|
633
634
|
const rand = (k) => { seed = (seed * 1103515245 + 12345) & 0x7fffffff; return seed % k; };
|
|
634
635
|
const free = new Set([e.act, ...(e.id ? [e.id] : []), ...(e.method ? [e.method] : []), 'key$']);
|
|
@@ -645,7 +646,7 @@ export function contend(e, w, opts = {}) {
|
|
|
645
646
|
choices.push({ [e.act]: 0, ...(e.id ? { [e.id]: p } : {}), ...(e.method ? { [e.method]: mt } : {}) });
|
|
646
647
|
}
|
|
647
648
|
const key = (st) => JSON.stringify([st.scalars, Object.entries(st.maps).map(([k, v]) => [k, [...v].filter(([, x]) => x !== 0).sort((a, b) => a[0] - b[0])])]);
|
|
648
|
-
for (let b = 0, tried = 0; b < (opts.bases ?? 12) && tried < 400 &&
|
|
649
|
+
for (let b = 0, tried = 0; b < (opts.bases ?? 12) && tried < 400 && countedSearchNow() < until; tried++) {
|
|
649
650
|
const params = Object.fromEntries(m.params.map(p => [p, rand(bound + 1)]));
|
|
650
651
|
// (the request's values from 0 and 1: two arguments a flow keeps equal, two strings of one length, agree often)
|
|
651
652
|
const base = Object.fromEntries(m.inputs.filter(i => !free.has(i)).map(i => [i, rand(2)]));
|
|
@@ -667,7 +668,7 @@ export function contend(e, w, opts = {}) {
|
|
|
667
668
|
b++;
|
|
668
669
|
const seen = new Set([key(st0)]);
|
|
669
670
|
let frontier = [{ st: st0, trace: [] }];
|
|
670
|
-
for (let d = 0; d < (opts.depth ?? 7) && frontier.length &&
|
|
671
|
+
for (let d = 0; d < (opts.depth ?? 7) && frontier.length && countedSearchNow() < until; d++) {
|
|
671
672
|
const next = [];
|
|
672
673
|
for (const { st, trace } of frontier)
|
|
673
674
|
for (const c of choices) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function withTableAdmission<T>(run: () => T): T;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// Wall telemetry is unavailable inside counted search, including legacy counted
|
|
2
|
+
// scopes. Zero means no wall measurement, not elapsed time or counted units.
|
|
3
|
+
// Do not capture/bind a clock: a tripwire must see every possible wall read.
|
|
4
|
+
import { stepWorkProfile } from "./step-work.js";
|
|
5
|
+
let depth = 0;
|
|
6
|
+
export const snapshotTraceClockDepth = () => depth;
|
|
7
|
+
export function withTraceWorkScope(f) {
|
|
8
|
+
depth++;
|
|
9
|
+
try {
|
|
10
|
+
return f();
|
|
11
|
+
}
|
|
12
|
+
finally {
|
|
13
|
+
depth--;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export const traceNow = () => stepWorkProfile.enabled || depth > 0 ? 0 : performance.now();
|
package/dist/core/transfer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { traceNow as countedTraceNow } from "./wall.js";
|
|
1
2
|
// A datatype law said another way, proven that way, and the law read back from it (core/data.ts's proveData calls this
|
|
2
3
|
// where the law alone at one unfolding isn't proven). Untrusted, as the search is: each step is a node of the one
|
|
3
4
|
// cyclic proof kernel/cyclic.ts checks, and Lean's twin reads it as any other.
|
|
@@ -335,7 +336,7 @@ const verify = (fs, specs, until) => {
|
|
|
335
336
|
// The law through its plan: the bridges proven (those not proven left out, and the rest built again), the copies' laws,
|
|
336
337
|
// the law said through them, and the node from that to the law. Undefined where any of it isn't proven.
|
|
337
338
|
export function proveThrough(l, plan, opts, until) {
|
|
338
|
-
const t0 =
|
|
339
|
+
const t0 = countedTraceNow();
|
|
339
340
|
let bridged = new Map(plan.bridges), tried = 0;
|
|
340
341
|
for (;;) {
|
|
341
342
|
if (clock() > until)
|
|
@@ -417,7 +418,7 @@ export function proveThrough(l, plan, opts, until) {
|
|
|
417
418
|
if (!v.proven || !v.checked)
|
|
418
419
|
return undefined;
|
|
419
420
|
const through = [...b.bridges.map(x => `${x.fn.name} is ${x.op.name}`), ...b.equivs.map(x => x.law.name), ...(b.unfolded ? [`unfolded: ${programOf([l], [], false).fns.filter(f => !taken(f)).map(f => f.name).join(', ')}`] : [])];
|
|
420
|
-
return { law: l.name, proven: true, checked: true, proof: v, lemmas: [...b.bridges.map(x => x.law.name), ...b.equivs.map(x => x.law.name), ...r.verdict.lemmas], scheme: `${r.verdict.scheme ?? 'no induction'}, through the law ${b.lstar.name}`, tried, program: b.p, node: specs.length - 1, ms: Math.round(
|
|
421
|
+
return { law: l.name, proven: true, checked: true, proof: v, lemmas: [...b.bridges.map(x => x.law.name), ...b.equivs.map(x => x.law.name), ...r.verdict.lemmas], scheme: `${r.verdict.scheme ?? 'no induction'}, through the law ${b.lstar.name}`, tried, program: b.p, node: specs.length - 1, ms: Math.round(countedTraceNow() - t0), through };
|
|
421
422
|
}
|
|
422
423
|
}
|
|
423
424
|
// Two terms, one of the law (or a function's body) and one said through the bridges, walked together: where they read
|
package/dist/core/translate.js
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
import { walk } from "./machine.js";
|
|
13
13
|
import { add, costs, env, refuteFast, scale, solve } from "./solver.js";
|
|
14
14
|
import { checkRefutation } from "./check.js";
|
|
15
|
+
import { completeWorkProfile } from "./work-profile.js";
|
|
16
|
+
import { startWork } from "./work-admission.js";
|
|
15
17
|
import { canon, canonFlip, columnTerm, factorsOf, isCell, isMonomial, leafConstraints, leafConstraintsReusing, linear, substE, truth, withProducts } from "../kernel/kernel.js";
|
|
16
18
|
import { cellProducts, grow, late, leafRowsOf, parseKey, withinDeadline } from "../kernel/prove.js";
|
|
17
19
|
import { Reader, times } from "../kernel/reader.js";
|
|
@@ -188,14 +190,25 @@ export function translate(part, whole, tree, ren0, st, until0, pp = new Map(), w
|
|
|
188
190
|
return undefined;
|
|
189
191
|
// (the usual leaf's rows as its search kept them, where it did: kernel/prove.ts's leafRowsOf; else read again)
|
|
190
192
|
const kept = !tree.products && !tree.squares ? leafRowsOf.get(tree) : undefined;
|
|
191
|
-
|
|
193
|
+
let rp = kept ? undefined : leafConstraintsReusing(part, pp);
|
|
194
|
+
const rw = rowsAt(whole, wp), at = new Map();
|
|
195
|
+
if (completeWorkProfile.enabled && rp) {
|
|
196
|
+
const prepared = [];
|
|
197
|
+
for (let i = 0; i < rp.length; i++) {
|
|
198
|
+
startWork('translateRows', 1, 'translation source row');
|
|
199
|
+
prepared.push(rp[i]);
|
|
200
|
+
}
|
|
201
|
+
rp = prepared;
|
|
202
|
+
}
|
|
192
203
|
const np = kept ? kept.n : rp.length, linP = (i) => (kept ? kept.at.get(i).lin : rp[i].lin);
|
|
193
204
|
const pairP = (i) => { if (kept) {
|
|
194
205
|
const s = kept.at.get(i)?.src;
|
|
195
206
|
return Array.isArray(s) ? s : undefined;
|
|
196
207
|
} const s = rp[i].src; return s && 'pair' in s ? s.pair : undefined; };
|
|
197
|
-
|
|
198
|
-
|
|
208
|
+
if (!completeWorkProfile.enabled)
|
|
209
|
+
costs.translateRows += (rp?.length ?? 0) + rw.length;
|
|
210
|
+
rw.forEach((r, i) => { if (completeWorkProfile.enabled)
|
|
211
|
+
startWork('translateRows', 1, 'translation target row'); const key = canon(r.lin); if (!at.has(key))
|
|
199
212
|
at.set(key, i); });
|
|
200
213
|
// Two cells the usual path proves equal (a row of the leaf's from their pair) are cells over time here, at keys
|
|
201
214
|
// (t − 1) + a·Ω and (t − 1) + b·Ω: the path has a = b, and the keys' difference (a − b)·Ω is split (each other side
|
package/dist/core/wall.d.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import { type WallDeadline } from '../kernel/prove.js';
|
|
2
|
+
export { wallDeadline, withBudget, budgetEnd, inBudget, checkBudget, checkWorkEndpoint, BudgetExpired, searchNow } from '../kernel/prove.js';
|
|
3
|
+
export { traceNow } from './trace-clock.js';
|
|
4
|
+
export declare const searchDateNow: () => number;
|
|
5
|
+
export declare const searchWall: (ms: number) => WallDeadline;
|
|
6
|
+
export declare const transportEnd: (until: number, cap?: number) => number;
|
|
2
7
|
export declare class WallExpired extends Error {
|
|
3
8
|
readonly phase: string;
|
|
4
9
|
constructor(phase: string);
|
package/dist/core/wall.js
CHANGED
|
@@ -1,11 +1,20 @@
|
|
|
1
|
-
// Cooperative cancellation of untrusted search
|
|
2
|
-
//
|
|
3
|
-
import { pastWall } from "../kernel/prove.js";
|
|
1
|
+
// Cooperative cancellation of untrusted search. Legacy callers retain their
|
|
2
|
+
// wall; an explicit work scope never consults it or grants completion headroom.
|
|
3
|
+
import { pastWall, clock, searchNow, wallAt, inBudget, inWorkScope, checkBudget, checkWorkAdmission, remainingWork, wallDeadline } from "../kernel/prove.js";
|
|
4
4
|
import { runtimeWall } from "./runtime-wall.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
5
|
+
export { wallDeadline, withBudget, budgetEnd, inBudget, checkBudget, checkWorkEndpoint, BudgetExpired, searchNow } from "../kernel/prove.js";
|
|
6
|
+
export { traceNow } from "./trace-clock.js";
|
|
7
|
+
// CLI proposal loops historically use epoch milliseconds rather than performance.
|
|
8
|
+
// Preserve that fallback, but share the work clock in either opt-in work mode.
|
|
9
|
+
export const searchDateNow = () => inWorkScope() ? clock() : Date.now();
|
|
10
|
+
export const searchWall = (ms) => wallDeadline(inWorkScope()
|
|
11
|
+
? Math.min(wallAt(), clock() + Math.max(0, ms))
|
|
12
|
+
: searchNow() + ms - Math.min(1000, Math.max(0, ms) / 20));
|
|
13
|
+
// Legacy transport had a scaled wall allowance for uncounted assembly. Work
|
|
14
|
+
// mode uses the given counted end, without a time multiplier or fresh budget.
|
|
15
|
+
export const transportEnd = (until, cap = Infinity) => inWorkScope()
|
|
16
|
+
? Math.min(wallAt(), until)
|
|
17
|
+
: Math.min(wallAt(), searchNow() + Math.min(cap, Math.max(0, until - clock()) * 10));
|
|
9
18
|
export class WallExpired extends Error {
|
|
10
19
|
phase;
|
|
11
20
|
constructor(phase) {
|
|
@@ -15,9 +24,14 @@ export class WallExpired extends Error {
|
|
|
15
24
|
}
|
|
16
25
|
}
|
|
17
26
|
export function checkWall(phase) {
|
|
27
|
+
if (inBudget()) {
|
|
28
|
+
checkBudget(phase);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
18
31
|
if (pastWall())
|
|
19
32
|
throw new WallExpired(phase);
|
|
20
33
|
}
|
|
21
|
-
// The interpreter must not import the proof engine to check
|
|
22
|
-
// that would initialize cyclic proof constants before the machine constructors.
|
|
34
|
+
// The interpreter must not import the proof engine just to check cancellation.
|
|
23
35
|
runtimeWall.check = checkWall;
|
|
36
|
+
runtimeWall.admit = checkWorkAdmission;
|
|
37
|
+
runtimeWall.remaining = remainingWork;
|
package/dist/core/watch.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type E, type Law, type Machine, type Request, type State, type interpret } from './machine.js';
|
|
2
|
-
import type
|
|
2
|
+
import { type StepLaw } from '../kernel/kernel.js';
|
|
3
3
|
export type Watched = Law | StepLaw;
|
|
4
4
|
export declare const isStepLaw: (w: Watched) => w is StepLaw;
|
|
5
5
|
type Runtime = ReturnType<typeof interpret>;
|
package/dist/core/watch.js
CHANGED
|
@@ -8,8 +8,10 @@
|
|
|
8
8
|
// and flags; `then` with the state before the first step (plain names), the first request and its flags, the j-th
|
|
9
9
|
// request as input@j, and the state and maps after the last step (primed names).
|
|
10
10
|
import { carriedView, evalC, evalE, numbersOf, walk } from "./machine.js";
|
|
11
|
+
import { finiteLawBound } from "../kernel/kernel.js";
|
|
11
12
|
import { someHolds } from "./exists.js";
|
|
12
|
-
import { checkWall } from "./wall.js";
|
|
13
|
+
import { checkWall, inBudget, checkWorkEndpoint } from "./wall.js";
|
|
14
|
+
import { withEvaluationAdmission } from "./evaluation-admission.js";
|
|
13
15
|
export const isStepLaw = (w) => 'then' in w;
|
|
14
16
|
// A request's environment: the params, its inputs and queries, and the step's flags decided (as ?name).
|
|
15
17
|
export function requestEnv(m, run, params, st, input) {
|
|
@@ -131,9 +133,13 @@ export function watch(m, run, w, params, bound) {
|
|
|
131
133
|
const turn = names.some(x => !mapRead.has(x)) ? turns(isStepLaw(w) ? w.then : w.holds, names) : undefined;
|
|
132
134
|
const atKeys = (keys, env, f, st, mm) => {
|
|
133
135
|
let visited = 0;
|
|
136
|
+
const work = inBudget();
|
|
134
137
|
const go = (i) => {
|
|
135
|
-
|
|
138
|
+
const tick = visited++;
|
|
139
|
+
if ((tick & 255) === 0)
|
|
136
140
|
checkWall('preflight law bindings');
|
|
141
|
+
else if (work && (tick & 15) === 0)
|
|
142
|
+
checkWorkEndpoint('preflight law bindings');
|
|
137
143
|
if (i === names.length) {
|
|
138
144
|
watchWork.n++;
|
|
139
145
|
return f(env);
|
|
@@ -146,13 +152,16 @@ export function watch(m, run, w, params, bound) {
|
|
|
146
152
|
}
|
|
147
153
|
return true;
|
|
148
154
|
};
|
|
149
|
-
return go(0);
|
|
155
|
+
return withEvaluationAdmission(() => go(0));
|
|
150
156
|
};
|
|
151
157
|
if (!isStepLaw(w)) {
|
|
152
158
|
// A law with "there exists" (core/exists.ts): broken only where no value can be a witness, as far as that is decided
|
|
153
159
|
// (one natural or integer read linearly); undecided, it is kept.
|
|
154
160
|
const at = (env, st) => (w.some?.length ? someHolds(w.holds, w.some, { ...env }, st, m, true)?.holds ?? true : evalC(w.holds, env, st, m));
|
|
155
|
-
const
|
|
161
|
+
const finite = finiteLawBound(w);
|
|
162
|
+
const holds = (st) => finite
|
|
163
|
+
? evalC({ op: 'all', key: w.forall, c: w.holds, finite: w.finite }, params, st, m)
|
|
164
|
+
: atKeys(per(bound, st, () => keysOf(bound, st)), { ...params }, env => at(env, st), st, m);
|
|
156
165
|
return { start: holds, step: (_before, _input, after) => holds(after) };
|
|
157
166
|
}
|
|
158
167
|
const k = w.steps ?? 1, whens = w.when === undefined ? [] : Array.isArray(w.when) ? w.when : [w.when];
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { type WorkKey } from './work-kinds.js';
|
|
2
|
+
import { type ExactRaw, type WorkAmount } from './work-amount.js';
|
|
3
|
+
export type { ExactRaw, WorkAmount };
|
|
4
|
+
export declare class BudgetExpired extends Error {
|
|
5
|
+
readonly phase: string;
|
|
6
|
+
constructor(phase: string);
|
|
7
|
+
}
|
|
8
|
+
export type WorkEndpointKind = 'root' | 'scope' | 'work-cap' | 'deadline';
|
|
9
|
+
export type WorkEndpoint = Readonly<{
|
|
10
|
+
id: number;
|
|
11
|
+
kind: WorkEndpointKind;
|
|
12
|
+
end: ExactRaw;
|
|
13
|
+
}>;
|
|
14
|
+
export type WorkCapacityRefusal = Readonly<{
|
|
15
|
+
reason: 'quantum' | 'check' | 'scope-entry';
|
|
16
|
+
limiting: readonly WorkEndpoint[];
|
|
17
|
+
actual: ExactRaw;
|
|
18
|
+
reserved: ExactRaw;
|
|
19
|
+
requested?: ExactRaw;
|
|
20
|
+
}>;
|
|
21
|
+
export type WorkCounterVector = Readonly<Record<WorkKey, string>>;
|
|
22
|
+
export type WorkAdmissionSnapshot = Readonly<{
|
|
23
|
+
version: 'strict-work-v1';
|
|
24
|
+
rootEpoch: number;
|
|
25
|
+
scopeEpoch: number;
|
|
26
|
+
counterEpoch: number;
|
|
27
|
+
actual: ExactRaw;
|
|
28
|
+
reserved: ExactRaw;
|
|
29
|
+
effectiveEnd: ExactRaw | null;
|
|
30
|
+
activeEndpoints: readonly WorkEndpoint[];
|
|
31
|
+
weights: Readonly<Record<WorkKey, ExactRaw>>;
|
|
32
|
+
rootBaseline: Readonly<{
|
|
33
|
+
actual: ExactRaw;
|
|
34
|
+
counters: WorkCounterVector;
|
|
35
|
+
}> | null;
|
|
36
|
+
counters: WorkCounterVector;
|
|
37
|
+
}>;
|
|
38
|
+
export type WorkAdmissionEvent = WorkAdmissionSnapshot & Readonly<{
|
|
39
|
+
sequence: number;
|
|
40
|
+
kind: 'trace-start' | 'trace-end' | 'reserve' | 'start' | 'release' | 'invalidate' | 'refuse' | 'scope-enter' | 'scope-exit';
|
|
41
|
+
sink?: WorkKey;
|
|
42
|
+
site?: string;
|
|
43
|
+
requested?: string;
|
|
44
|
+
granted?: string;
|
|
45
|
+
leaseId?: number;
|
|
46
|
+
}>;
|
|
47
|
+
export type WorkDiagnosticCheckpoint = Readonly<{
|
|
48
|
+
version: 'work-diagnostic/v1';
|
|
49
|
+
ledger: WorkAdmissionSnapshot;
|
|
50
|
+
lattice: Readonly<{
|
|
51
|
+
denominator: bigint;
|
|
52
|
+
units: Readonly<Record<WorkKey, bigint>>;
|
|
53
|
+
}>;
|
|
54
|
+
raw: Readonly<{
|
|
55
|
+
consumed: bigint;
|
|
56
|
+
held: bigint;
|
|
57
|
+
counters: Readonly<Record<WorkKey, bigint>>;
|
|
58
|
+
}>;
|
|
59
|
+
scopes: readonly Readonly<Scope>[];
|
|
60
|
+
leases: readonly Readonly<LeaseState>[];
|
|
61
|
+
sequences: Readonly<{
|
|
62
|
+
lease: number;
|
|
63
|
+
endpoint: number;
|
|
64
|
+
event: number;
|
|
65
|
+
}>;
|
|
66
|
+
observerCount: number;
|
|
67
|
+
observerNames: readonly string[];
|
|
68
|
+
notifying: boolean;
|
|
69
|
+
capacityBoundaries: readonly Readonly<CapacityBoundary>[];
|
|
70
|
+
}>;
|
|
71
|
+
export type WorkAdmissionObserver = (event: WorkAdmissionEvent) => void;
|
|
72
|
+
export type WorkLease = Readonly<{
|
|
73
|
+
granted: number;
|
|
74
|
+
remaining: number;
|
|
75
|
+
start: (count?: number) => void;
|
|
76
|
+
}>;
|
|
77
|
+
type Scope = {
|
|
78
|
+
id: number;
|
|
79
|
+
kind: WorkEndpointKind;
|
|
80
|
+
end: WorkAmount;
|
|
81
|
+
};
|
|
82
|
+
type CapacityBoundary = {
|
|
83
|
+
error?: BudgetExpired;
|
|
84
|
+
fatal?: BudgetExpired;
|
|
85
|
+
deadline?: Scope;
|
|
86
|
+
};
|
|
87
|
+
type LeaseState = {
|
|
88
|
+
id: number;
|
|
89
|
+
sink: WorkKey;
|
|
90
|
+
site?: string;
|
|
91
|
+
remaining: bigint;
|
|
92
|
+
granted: number;
|
|
93
|
+
epoch: number;
|
|
94
|
+
live: boolean;
|
|
95
|
+
};
|
|
96
|
+
export declare class WorkLedger {
|
|
97
|
+
readonly weights: Readonly<Record<WorkKey, WorkAmount>>;
|
|
98
|
+
readonly denominator: bigint;
|
|
99
|
+
private readonly units;
|
|
100
|
+
private readonly counters;
|
|
101
|
+
private consumed;
|
|
102
|
+
private held;
|
|
103
|
+
private readonly scopes;
|
|
104
|
+
private readonly leases;
|
|
105
|
+
private readonly observers;
|
|
106
|
+
private baseline;
|
|
107
|
+
private rootEpoch;
|
|
108
|
+
private scopeEpoch;
|
|
109
|
+
private counterEpoch;
|
|
110
|
+
private leaseSequence;
|
|
111
|
+
private endpointSequence;
|
|
112
|
+
private eventSequence;
|
|
113
|
+
private notifying;
|
|
114
|
+
private readonly capacityErrors;
|
|
115
|
+
private readonly capacityBoundaries;
|
|
116
|
+
private readonly deadlineRefusalOwners;
|
|
117
|
+
constructor(weights: Readonly<Record<WorkKey, number>>);
|
|
118
|
+
actual(): WorkAmount;
|
|
119
|
+
reserved(): WorkAmount;
|
|
120
|
+
bounded(): boolean;
|
|
121
|
+
inBudget(): boolean;
|
|
122
|
+
check(phase: string): void;
|
|
123
|
+
checkAmount(amount: WorkAmount, phase: string): void;
|
|
124
|
+
counter(key: WorkKey): bigint;
|
|
125
|
+
currentScope(): WorkEndpoint | undefined;
|
|
126
|
+
capacityRefusal(error: unknown): WorkCapacityRefusal | undefined;
|
|
127
|
+
withCapacityRefusalBoundary<T>(run: () => T): T;
|
|
128
|
+
withDeadlineRefusalBoundary<T, F>(end: WorkAmount, run: () => T, refused: () => F): T | F;
|
|
129
|
+
private capacityError;
|
|
130
|
+
endpoint(): WorkAmount | null;
|
|
131
|
+
available(): WorkAmount | null;
|
|
132
|
+
private vector;
|
|
133
|
+
snapshot(): WorkAdmissionSnapshot;
|
|
134
|
+
diagnosticCheckpoint(): WorkDiagnosticCheckpoint;
|
|
135
|
+
private emit;
|
|
136
|
+
private checkEntry;
|
|
137
|
+
private invariant;
|
|
138
|
+
private invalidate;
|
|
139
|
+
withTrace<T>(observe: WorkAdmissionObserver, run: () => T): T;
|
|
140
|
+
withEndpoint<T>(kind: WorkEndpointKind, end: WorkAmount, run: () => T): T;
|
|
141
|
+
private enterEndpoint;
|
|
142
|
+
withBudget<T>(grant: WorkAmount, run: () => T): T;
|
|
143
|
+
withShare<T>(numerator: bigint, denominator: bigint, run: () => T): T;
|
|
144
|
+
withChunk<T>(sink: WorkKey, requested: number, run: (lease: WorkLease) => T, site?: string): T;
|
|
145
|
+
start(sink: WorkKey, count?: number, site?: string): void;
|
|
146
|
+
setUnscopedCounter(key: WorkKey, value: number): void;
|
|
147
|
+
}
|
|
148
|
+
export declare const workLedger: WorkLedger;
|
|
149
|
+
export declare const workSinkRegistry: readonly Readonly<{
|
|
150
|
+
key: WorkKey;
|
|
151
|
+
weight: Readonly<{
|
|
152
|
+
numerator: string;
|
|
153
|
+
denominator: string;
|
|
154
|
+
}>;
|
|
155
|
+
}>[];
|
|
156
|
+
export declare const withAdmittedChunk: <T>(sink: WorkKey, requested: number, run: (lease: WorkLease) => T, site?: string) => T;
|
|
157
|
+
export declare const withWorkAdmissionTrace: <T>(observe: WorkAdmissionObserver, run: () => T) => T;
|
|
158
|
+
export declare const workAdmissionSnapshot: () => WorkAdmissionSnapshot;
|
|
159
|
+
export declare const admittedWorkNumber: () => number;
|
|
160
|
+
export declare const admittedWork: () => WorkAmount;
|
|
161
|
+
export declare const remainingAdmittedWork: () => WorkAmount | null;
|
|
162
|
+
export declare const emptyWork: Readonly<import("./q.ts").Rat>;
|
|
163
|
+
export declare function startWork(sink: WorkKey, count?: number, site?: string): void;
|
|
164
|
+
export declare function workCounterView<T extends Record<string, number>>(initial: T, mapping: Partial<Record<keyof T, WorkKey>>): T;
|