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,12 @@
|
|
|
1
|
+
import { type Law, type Machine } from './machine.js';
|
|
2
|
+
export declare function countPrerequisiteSchedule(m: Machine, family: Law[], selected: ReadonlySet<Law>, until: number): {
|
|
3
|
+
requirements: Map<string, readonly string[]>;
|
|
4
|
+
recipes: Map<string, readonly Readonly<{
|
|
5
|
+
id: string;
|
|
6
|
+
kind: "ordinary" | "strategy";
|
|
7
|
+
required?: readonly string[];
|
|
8
|
+
optional?: readonly string[];
|
|
9
|
+
}>[]>;
|
|
10
|
+
costs: Map<string, number>;
|
|
11
|
+
};
|
|
12
|
+
export declare function countPrerequisitePlan(m: Machine, family: Law[], selected: ReadonlySet<Law>, until: number): Map<string, readonly string[]>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
// Pre-execution citations from the same structural selectors as the emitters.
|
|
2
|
+
// Conservative offers are scheduling only; returned certificate scopes remain
|
|
3
|
+
// authoritative, and an unattempted surprise citation is never published.
|
|
4
|
+
import { all, n, same, walk, x } from "./machine.js";
|
|
5
|
+
import { finiteCountChoice } from "./count-cases.js";
|
|
6
|
+
import { discoverRowAgreement } from "./row-agreement-shape.js";
|
|
7
|
+
import { rowCountSupport } from "./count-row-support.js";
|
|
8
|
+
import { countStrategyKind } from "./count-strategies.js";
|
|
9
|
+
import { prepareGuardCountContext } from "./count-guard-context.js";
|
|
10
|
+
import { countLeaderPremise } from "./count-leader.js";
|
|
11
|
+
import { discoverCountThresholdWrite } from "./count-write-shape.js";
|
|
12
|
+
import { discoverLiftedCountGuard } from "./count-lifted-shape.js";
|
|
13
|
+
import { discoverLiftedCountPrerequisites } from "./count-lifted-prerequisite.js";
|
|
14
|
+
import { discoverCountRowLoad } from "./count-load-shape.js";
|
|
15
|
+
const shapeSize = (value) => value && typeof value === 'object' ? 1 + Object.values(value).reduce((sum, item) => sum + shapeSize(item), 0) : 0;
|
|
16
|
+
export function countPrerequisiteSchedule(m, family, selected, until) {
|
|
17
|
+
const out = new Map(), recipes = new Map(), costs = new Map();
|
|
18
|
+
for (const owner of family) {
|
|
19
|
+
const ordinary = { id: 'ordinary', kind: 'ordinary' };
|
|
20
|
+
recipes.set(owner.name, [ordinary]);
|
|
21
|
+
const shape = (owner.keys?.length ?? 0) * 1000 + shapeSize(owner.holds);
|
|
22
|
+
let countRead = false;
|
|
23
|
+
walk(owner.holds, node => { if (node.op === 'get' && typeof node.map === 'string' && m.counts?.[node.map])
|
|
24
|
+
countRead = true; });
|
|
25
|
+
costs.set(owner.name, shape + (countRead ? 100000 : 0));
|
|
26
|
+
if (!selected.has(owner))
|
|
27
|
+
continue;
|
|
28
|
+
const offered = new Set(), kind = countStrategyKind(m, family, owner), choice = finiteCountChoice(m);
|
|
29
|
+
if (kind === 'row') {
|
|
30
|
+
const row = discoverRowAgreement(m, owner);
|
|
31
|
+
// The generic row instantiation pool is optional, not a required edge.
|
|
32
|
+
// Actual ordinary/row scopes can add dependencies without admitting them.
|
|
33
|
+
if (choice)
|
|
34
|
+
for (const value of choice[1]) {
|
|
35
|
+
const fixed = { ...m, assume: all(...(m.assume ? [m.assume] : []), same(x(choice[0]), n(value))) }, support = rowCountSupport(fixed, family, owner, row, until);
|
|
36
|
+
for (const name of Object.keys(support?.options.seedInstances ?? {})) {
|
|
37
|
+
const law = family.find(l => l.name === name);
|
|
38
|
+
if (law)
|
|
39
|
+
offered.add(law);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
else if (kind === 'guard') {
|
|
44
|
+
const context = prepareGuardCountContext(m, owner, family);
|
|
45
|
+
for (const law of context?.shape.phase?.laws ?? [])
|
|
46
|
+
offered.add(law);
|
|
47
|
+
if (context && choice && [...choice[1]].some(value => discoverCountThresholdWrite(m, context.shape, { name: choice[0], value })?.increment === 1)) {
|
|
48
|
+
const pair = countLeaderPremise(m, context.shape, family);
|
|
49
|
+
if (pair)
|
|
50
|
+
offered.add(pair.law);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else if (kind === 'lifted') {
|
|
54
|
+
const shape = discoverLiftedCountGuard(m, owner, family);
|
|
55
|
+
if (shape) {
|
|
56
|
+
if (shape.rowAgreements[0])
|
|
57
|
+
offered.add(shape.rowAgreements[0].law);
|
|
58
|
+
const prerequisites = discoverLiftedCountPrerequisites(m, owner, family);
|
|
59
|
+
// Emitters try the offered candidates in this order. Limit the first
|
|
60
|
+
// attempt to this citation; a failed premise cannot be assumed instead.
|
|
61
|
+
if (prerequisites[0])
|
|
62
|
+
offered.add(prerequisites[0].law);
|
|
63
|
+
for (const law of shape.countShape.phase?.laws ?? [])
|
|
64
|
+
offered.add(law);
|
|
65
|
+
if (choice)
|
|
66
|
+
for (const value of choice[1]) {
|
|
67
|
+
const load = discoverCountRowLoad(m, shape, family, { name: choice[0], value });
|
|
68
|
+
if (load) {
|
|
69
|
+
offered.add(load.law);
|
|
70
|
+
for (const law of load.phaseLaws)
|
|
71
|
+
offered.add(law);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
offered.delete(owner);
|
|
77
|
+
const required = Object.freeze(family.filter(l => offered.has(l)).map(l => l.name));
|
|
78
|
+
out.set(owner.name, required);
|
|
79
|
+
if (kind) {
|
|
80
|
+
recipes.set(owner.name, [{ id: kind, kind: 'strategy', required }, ordinary]);
|
|
81
|
+
costs.set(owner.name, 1000000 + ({ guard: 1, row: 2, lifted: 3 }[kind]) * 10000 + shape);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return { requirements: out, recipes, costs };
|
|
85
|
+
}
|
|
86
|
+
export function countPrerequisitePlan(m, family, selected, until) {
|
|
87
|
+
return countPrerequisiteSchedule(m, family, selected, until).requirements;
|
|
88
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function countPrimitiveUnits(legacyUnits: number, leafUnits?: number): number;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Historical subquery constants were tuned for the twelve-counter clock.
|
|
2
|
+
// Full accounting must reuse the already granted W/120 leaf allowance, not
|
|
3
|
+
// reinterpret 150/250/600 as full-work limits. Callers still clamp to the same
|
|
4
|
+
// absolute leaf/strategy/root end; this helper never grants another budget.
|
|
5
|
+
import { completeWorkProfile } from "./work-profile.js";
|
|
6
|
+
export function countPrimitiveUnits(legacyUnits, leafUnits) {
|
|
7
|
+
return Math.max(0, completeWorkProfile.enabled ? (leafUnits ?? legacyUnits) : legacyUnits);
|
|
8
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Untrusted query projection. Only split conjunctions and prune disjuncts the
|
|
2
|
+
// existing path decides false. Callers must rebase and check the full goal.
|
|
3
|
+
import { walkOnce } from "./machine.js";
|
|
4
|
+
import { truth } from "../kernel/kernel.js";
|
|
5
|
+
export function projectCountFree(hyps, path, countMaps, otherWitnesses = new Set(), cofactor = false) {
|
|
6
|
+
const atPath = (c) => {
|
|
7
|
+
if (cofactor && truth(c, path) === true)
|
|
8
|
+
return [];
|
|
9
|
+
if (c.op === 'and')
|
|
10
|
+
return c.xs.flatMap(atPath);
|
|
11
|
+
if (c.op === 'or') {
|
|
12
|
+
if (c.xs.some(x => truth(x, path) === true))
|
|
13
|
+
return [];
|
|
14
|
+
const live = c.xs.filter(x => truth(x, path) !== false);
|
|
15
|
+
if (live.length === 1)
|
|
16
|
+
return atPath(live[0]);
|
|
17
|
+
}
|
|
18
|
+
let keep = true;
|
|
19
|
+
walkOnce(c, (node) => { if (node.op === 'get' && countMaps.has(node.map) || node.op === 'var' && otherWitnesses.has(node.name))
|
|
20
|
+
keep = false; });
|
|
21
|
+
return keep ? [c] : [];
|
|
22
|
+
};
|
|
23
|
+
return hyps.flatMap(atPath);
|
|
24
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type C } from './machine.js';
|
|
2
|
+
import { type Count, type CountInst, type Path } from '../kernel/kernel.js';
|
|
3
|
+
export declare function projectCountWitnessRoot(path: Path, counts: Count[], selected: CountInst[]): Path;
|
|
4
|
+
export declare function projectCountWitness(hyps: C[], counts: Count[], selected: CountInst[]): C[];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// A deliberately weaker member query, never an accepted proof by itself.
|
|
2
|
+
// Keep pointwise-map premises only at the selected CountInst witnesses. Scalar
|
|
3
|
+
// endpoint guards stay available; the caller must rebase/check the full goal.
|
|
4
|
+
import { walkOnce } from "./machine.js";
|
|
5
|
+
import { canon } from "../kernel/kernel.js";
|
|
6
|
+
// Keep the selected witness's activating comparison, but not unrelated count
|
|
7
|
+
// comparisons already accumulated by earlier transports. Rebase to the full
|
|
8
|
+
// root before accepting any returned tree.
|
|
9
|
+
export function projectCountWitnessRoot(path, counts, selected) {
|
|
10
|
+
const names = new Set(counts.map(count => count.v)), active = new Set(selected.map(inst => {
|
|
11
|
+
const row = {};
|
|
12
|
+
for (const [coefficient, id] of inst.terms)
|
|
13
|
+
row[id] = (row[id] ?? 0) + coefficient;
|
|
14
|
+
if (inst.unit)
|
|
15
|
+
row['1'] = -inst.unit;
|
|
16
|
+
return canon(row);
|
|
17
|
+
}));
|
|
18
|
+
return new Map([...path].filter(([, atom]) => active.has(canon(atom.lin)) || !Object.keys(atom.lin).some(name => names.has(name))));
|
|
19
|
+
}
|
|
20
|
+
export function projectCountWitness(hyps, counts, selected) {
|
|
21
|
+
const ids = new Set(selected.flatMap(inst => inst.terms.map(([, id]) => id))), maps = new Set(), endpoints = new Set(), witnesses = new Set(selected.map(inst => inst.wit));
|
|
22
|
+
for (const count of counts)
|
|
23
|
+
if (ids.has(count.v))
|
|
24
|
+
walkOnce(count.body, (node) => {
|
|
25
|
+
if (node.op === 'var' && node.name !== count.key)
|
|
26
|
+
endpoints.add(node.name);
|
|
27
|
+
if (node.op !== 'get')
|
|
28
|
+
return;
|
|
29
|
+
let member = false;
|
|
30
|
+
walkOnce(node.key, (key) => { if (key.op === 'var' && key.name === count.key)
|
|
31
|
+
member = true; });
|
|
32
|
+
if (member)
|
|
33
|
+
maps.add(node.map);
|
|
34
|
+
});
|
|
35
|
+
return hyps.filter(hyp => {
|
|
36
|
+
let pointwise = false, member = false, endpointOnly = true;
|
|
37
|
+
walkOnce(hyp, (node) => {
|
|
38
|
+
if (node.op === 'get' && maps.has(node.map)) {
|
|
39
|
+
pointwise = true;
|
|
40
|
+
walkOnce(node.key, (key) => { if (key.op === 'var' && !endpoints.has(key.name))
|
|
41
|
+
endpointOnly = false; });
|
|
42
|
+
}
|
|
43
|
+
if (node.op === 'var' && witnesses.has(node.name))
|
|
44
|
+
member = true;
|
|
45
|
+
});
|
|
46
|
+
return !pointwise || member || endpointOnly;
|
|
47
|
+
});
|
|
48
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type Law, type Machine } from './machine.js';
|
|
2
|
+
import { type CountLawProof, type ScopedCountProof } from './count-proof-scope.js';
|
|
3
|
+
export type CountRescopeEvent = Readonly<{
|
|
4
|
+
stage: 'original' | 'canonical' | 'drop';
|
|
5
|
+
premise?: string;
|
|
6
|
+
checked: boolean;
|
|
7
|
+
units: number;
|
|
8
|
+
reason?: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type CountRescopeOptions = Readonly<{
|
|
11
|
+
allowFullFallback?: (offered: ScopedCountProof | undefined) => boolean;
|
|
12
|
+
retainUncheckedOffer?: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
export declare function rescopeCountProof(m: Machine, owner: Law, family: Law[], proof: CountLawProof, _held: ReadonlySet<string>, until: number, observe?: (event: CountRescopeEvent) => void, options?: CountRescopeOptions): ScopedCountProof | undefined;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { scopeCountProof, scopeCountProofPair, replayScopedCountProof, isCheckedReducedScope } from "./count-proof-scope.js";
|
|
2
|
+
import { checkMC, countedObligations } from "../kernel/kernel.js";
|
|
3
|
+
import { clock, withDeadline } from "../kernel/prove.js";
|
|
4
|
+
import { checkWall } from "./wall.js";
|
|
5
|
+
import { startWork } from "./work-admission.js";
|
|
6
|
+
import { workFilter, workMap } from "./work-collections.js";
|
|
7
|
+
function uncheckedOffer(offered, checkWork) {
|
|
8
|
+
// Reuse the already captured full-scope payload. In particular, do not run
|
|
9
|
+
// scope capture, identity hashing, or checked-reduced stamping a second time.
|
|
10
|
+
const { checkedReduced, ...scope } = offered;
|
|
11
|
+
void checkedReduced;
|
|
12
|
+
return { ...scope, proof: { ...offered.proof, status: 'unchecked' }, suppliers: 'unresolved', checkWork };
|
|
13
|
+
}
|
|
14
|
+
export function rescopeCountProof(m, owner, family, proof, _held, until, observe, options = {}) {
|
|
15
|
+
return withDeadline(until, () => {
|
|
16
|
+
checkWall('counted checked rescope');
|
|
17
|
+
startWork('ticks', 1, 'counted checked rescope');
|
|
18
|
+
// Validate the offered declaration and infer the minimal legacy scope from
|
|
19
|
+
// the same row scan. Both keep the old proof/status/receipt behavior.
|
|
20
|
+
const start = clock(), { offered, inferred } = scopeCountProofPair(m, owner, family, proof, until);
|
|
21
|
+
if (inferred && clock() < until) {
|
|
22
|
+
const keep = new Set([owner.name]);
|
|
23
|
+
for (const premise of inferred.premises) {
|
|
24
|
+
startWork('ticks', 1, 'reduced context premise');
|
|
25
|
+
keep.add(premise.name);
|
|
26
|
+
}
|
|
27
|
+
const context = workFilter(family, l => keep.has(l.name), 'reduced context family');
|
|
28
|
+
const checked = replayScopedCountProof(m, context, inferred, until);
|
|
29
|
+
const scoped = checked && scopeCountProof(m, owner, context, checked, until);
|
|
30
|
+
if (scoped && isCheckedReducedScope(scoped, m, context)) {
|
|
31
|
+
const units = Math.max(0, clock() - start);
|
|
32
|
+
observe?.({ stage: 'canonical', checked: true, units });
|
|
33
|
+
return { ...scoped, checkWork: units };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
observe?.({ stage: 'canonical', checked: false, units: Math.max(0, clock() - start), ...(!offered ? { reason: 'scope-refused' } : {}) });
|
|
37
|
+
checkWall('counted checked rescope fallback');
|
|
38
|
+
if (clock() >= until)
|
|
39
|
+
return undefined;
|
|
40
|
+
const permitted = options.allowFullFallback?.(offered) ?? false;
|
|
41
|
+
checkWall('counted checked rescope permission');
|
|
42
|
+
if (clock() >= until)
|
|
43
|
+
return undefined;
|
|
44
|
+
if (!permitted) {
|
|
45
|
+
if (!options.retainUncheckedOffer || !offered)
|
|
46
|
+
return undefined;
|
|
47
|
+
observe?.({ stage: 'original', checked: false, units: 0, reason: 'unfunded-unchecked-offer' });
|
|
48
|
+
return uncheckedOffer(offered, Math.max(0, clock() - start));
|
|
49
|
+
}
|
|
50
|
+
const before = clock();
|
|
51
|
+
// This is at most one pass over the original INIT/STEP goals; no drop loop,
|
|
52
|
+
// fresh lease, reduced-context retry or fallback on an exception exists.
|
|
53
|
+
for (const { goal, decls } of countedObligations(m, family, { [owner.name]: proof.instances }, family.indexOf(owner))) {
|
|
54
|
+
startWork('ticks', 1, 'full fallback obligation');
|
|
55
|
+
const cert = proof.certs[goal.name];
|
|
56
|
+
if (clock() >= until || !cert || !checkMC(goal.hyps, decls, cert)) {
|
|
57
|
+
observe?.({ stage: 'original', checked: false, units: Math.max(0, clock() - before) });
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
observe?.({ stage: 'original', checked: true, units: Math.max(0, clock() - before) });
|
|
62
|
+
// A full-only acceptance has no reduced receipt and cannot erase recipe
|
|
63
|
+
// requirements. The caller must conservatively union those requirements.
|
|
64
|
+
if (clock() >= until)
|
|
65
|
+
return undefined;
|
|
66
|
+
if (offered)
|
|
67
|
+
return uncheckedOffer(offered, Math.max(0, clock() - start));
|
|
68
|
+
const fallback = scopeCountProof(m, owner, family, { ...proof, status: 'unchecked', premises: workMap(family, l => l.name, 'full fallback context') }, until);
|
|
69
|
+
return fallback && clock() < until ? { ...fallback, checkWork: Math.max(0, clock() - start) } : undefined;
|
|
70
|
+
});
|
|
71
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type Law, type Machine } from './machine.js';
|
|
2
|
+
import { type CountCert, type Goal, type Instances, type CountDecl } from '../kernel/kernel.js';
|
|
3
|
+
import { type WorkAmount } from './work-amount.js';
|
|
4
|
+
import { type ReplayDiagnosticContext } from './count-replay-diagnostic.js';
|
|
5
|
+
export type CountLawProof = {
|
|
6
|
+
status?: 'unchecked';
|
|
7
|
+
instances: Instances;
|
|
8
|
+
certs: Record<string, CountCert>;
|
|
9
|
+
premises?: readonly string[];
|
|
10
|
+
};
|
|
11
|
+
export type CountFamilyProof = {
|
|
12
|
+
instances: Record<string, Instances>;
|
|
13
|
+
certs: Record<string, CountCert>;
|
|
14
|
+
premises?: Record<string, readonly string[]>;
|
|
15
|
+
};
|
|
16
|
+
type Premise = Readonly<{
|
|
17
|
+
name: string;
|
|
18
|
+
key: string;
|
|
19
|
+
}>;
|
|
20
|
+
export type CheckedReducedContext = Readonly<{
|
|
21
|
+
kind: 'checked-reduced';
|
|
22
|
+
}>;
|
|
23
|
+
type CheckedBinding = {
|
|
24
|
+
token: CheckedReducedContext;
|
|
25
|
+
problem: string;
|
|
26
|
+
scope: string;
|
|
27
|
+
context: readonly Premise[];
|
|
28
|
+
laws: readonly Law[];
|
|
29
|
+
};
|
|
30
|
+
export declare const snapshotCountScopeBinding: (object: object) => Readonly<CheckedBinding> | undefined;
|
|
31
|
+
export declare function withCountScopeIdentityObservation<T>(observe: (work: WorkAmount) => void, run: () => T): T;
|
|
32
|
+
export declare const countScopeContextKey: (machine: Machine, laws: readonly Law[]) => string;
|
|
33
|
+
export type ScopedCountProof = Readonly<{
|
|
34
|
+
owner: Premise;
|
|
35
|
+
premises: readonly Premise[];
|
|
36
|
+
proof: CountLawProof;
|
|
37
|
+
sources: readonly Goal[];
|
|
38
|
+
sourceDecls?: readonly CountDecl[][];
|
|
39
|
+
unused: readonly string[];
|
|
40
|
+
suppliers?: 'unresolved' | 'resolved';
|
|
41
|
+
checkWork?: number;
|
|
42
|
+
checkedReduced?: CheckedReducedContext;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function isCheckedReducedScope(scoped: ScopedCountProof, machine: Machine, currentLaws?: readonly Law[]): boolean;
|
|
45
|
+
export declare function scopeCountProof(m: Machine, owner: Law, family: Law[], proof: CountLawProof, until: number): ScopedCountProof | undefined;
|
|
46
|
+
export declare function scopeCountProofPair(m: Machine, owner: Law, family: Law[], proof: CountLawProof, until: number): {
|
|
47
|
+
offered?: ScopedCountProof;
|
|
48
|
+
inferred?: ScopedCountProof;
|
|
49
|
+
};
|
|
50
|
+
export declare function resolveCountScopeSuppliers(m: Machine, family: Law[], scoped: ScopedCountProof, until: number): ScopedCountProof | undefined;
|
|
51
|
+
export type CountReplayDecline = Readonly<{
|
|
52
|
+
case: 1 | 2 | 3 | 4 | 5 | 6 | 7;
|
|
53
|
+
reason: string;
|
|
54
|
+
member: string;
|
|
55
|
+
obligation?: string;
|
|
56
|
+
premise?: string;
|
|
57
|
+
expected?: number;
|
|
58
|
+
actual?: number;
|
|
59
|
+
blockers?: readonly string[];
|
|
60
|
+
}>;
|
|
61
|
+
export declare function replayScopedCountProof(m: Machine, family: Law[], scoped: ScopedCountProof, until: number, options?: {
|
|
62
|
+
deferToClosing?: boolean;
|
|
63
|
+
onDecline?: (decline: CountReplayDecline) => void;
|
|
64
|
+
onTransportDecline?: (obligation: string) => void;
|
|
65
|
+
diagnostic?: ReplayDiagnosticContext;
|
|
66
|
+
sourceFamily?: readonly Law[];
|
|
67
|
+
}): CountLawProof | undefined;
|
|
68
|
+
export {};
|