gdp-wired 0.47.0 → 0.49.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 +17 -6
- package/dist/core/bmc.js +10 -7
- package/dist/core/carry.d.ts +15 -0
- package/dist/core/carry.js +651 -0
- package/dist/core/check.js +7 -2
- package/dist/core/cli.d.ts +3 -1
- package/dist/core/cli.js +28 -8
- 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.d.ts +24 -0
- package/dist/core/count-cases.js +321 -0
- package/dist/core/count-cert-grow.d.ts +4 -0
- package/dist/core/count-cert-grow.js +37 -0
- 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 +11 -0
- package/dist/core/count-cert-transport.js +109 -0
- 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-completion.d.ts +9 -0
- package/dist/core/count-completion.js +27 -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-cubes.d.ts +8 -0
- package/dist/core/count-cubes.js +69 -0
- package/dist/core/count-demand.d.ts +37 -0
- package/dist/core/count-demand.js +361 -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-facts.d.ts +52 -0
- package/dist/core/count-facts.js +247 -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-focus-proof.d.ts +8 -0
- package/dist/core/count-focus-proof.js +140 -0
- package/dist/core/count-focused.d.ts +22 -0
- package/dist/core/count-focused.js +676 -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-ranges.d.ts +5 -0
- package/dist/core/count-ranges.js +65 -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/action-guard.d.ts +5 -0
- package/dist/core/count-recovery/action-guard.js +51 -0
- package/dist/core/count-recovery/boolean-core.d.ts +16 -0
- package/dist/core/count-recovery/boolean-core.js +258 -0
- package/dist/core/count-recovery/carried-case.d.ts +2 -0
- package/dist/core/count-recovery/carried-case.js +24 -0
- package/dist/core/count-recovery/conditional-check-cache.d.ts +23 -0
- package/dist/core/count-recovery/conditional-check-cache.js +131 -0
- package/dist/core/count-recovery/conditional-cuts.d.ts +6 -0
- package/dist/core/count-recovery/conditional-cuts.js +319 -0
- package/dist/core/count-recovery/conditional-proof.d.ts +53 -0
- package/dist/core/count-recovery/conditional-proof.js +348 -0
- package/dist/core/count-recovery/derivability-closure.d.ts +14 -0
- package/dist/core/count-recovery/derivability-closure.js +534 -0
- package/dist/core/count-recovery/empty-count-source.d.ts +2 -0
- package/dist/core/count-recovery/empty-count-source.js +40 -0
- package/dist/core/count-recovery/field-bound-lemmas.d.ts +23 -0
- package/dist/core/count-recovery/field-bound-lemmas.js +640 -0
- package/dist/core/count-recovery/field-case.d.ts +5 -0
- package/dist/core/count-recovery/field-case.js +89 -0
- package/dist/core/count-recovery/field-demand.d.ts +46 -0
- package/dist/core/count-recovery/field-demand.js +47 -0
- package/dist/core/count-recovery/field-only.d.ts +3 -0
- package/dist/core/count-recovery/field-only.js +18 -0
- package/dist/core/count-recovery/fold-path.d.ts +6 -0
- package/dist/core/count-recovery/fold-path.js +35 -0
- package/dist/core/count-recovery/frame-lemmas.d.ts +9 -0
- package/dist/core/count-recovery/frame-lemmas.js +120 -0
- package/dist/core/count-recovery/guard-cases.d.ts +12 -0
- package/dist/core/count-recovery/guard-cases.js +139 -0
- package/dist/core/count-recovery/key-closure.d.ts +14 -0
- package/dist/core/count-recovery/key-closure.js +62 -0
- package/dist/core/count-recovery/leaf-allowance.d.ts +4 -0
- package/dist/core/count-recovery/leaf-allowance.js +7 -0
- package/dist/core/count-recovery/lift-count-proxies.d.ts +6 -0
- package/dist/core/count-recovery/lift-count-proxies.js +175 -0
- package/dist/core/count-recovery/live-dependencies.d.ts +6 -0
- package/dist/core/count-recovery/live-dependencies.js +76 -0
- package/dist/core/count-recovery/member-inclusions.d.ts +11 -0
- package/dist/core/count-recovery/member-inclusions.js +168 -0
- package/dist/core/count-recovery/member-premises.d.ts +29 -0
- package/dist/core/count-recovery/member-premises.js +114 -0
- package/dist/core/count-recovery/natural-cases.d.ts +6 -0
- package/dist/core/count-recovery/natural-cases.js +59 -0
- package/dist/core/count-recovery/ops.d.ts +6 -0
- package/dist/core/count-recovery/ops.js +8 -0
- package/dist/core/count-recovery/pre-state-source.d.ts +8 -0
- package/dist/core/count-recovery/pre-state-source.js +18 -0
- package/dist/core/count-recovery/rebase-path.d.ts +9 -0
- package/dist/core/count-recovery/rebase-path.js +70 -0
- 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/rename-proof.d.ts +2 -0
- package/dist/core/count-recovery/rename-proof.js +102 -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.d.ts +16 -0
- package/dist/core/count-recovery/row-cases.js +292 -0
- package/dist/core/count-recovery/scalar-guards.d.ts +7 -0
- package/dist/core/count-recovery/scalar-guards.js +291 -0
- package/dist/core/count-recovery/source-memo.d.ts +12 -0
- package/dist/core/count-recovery/source-memo.js +67 -0
- 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-select.d.ts +16 -0
- package/dist/core/count-select.js +24 -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 +598 -0
- package/dist/core/count-support.js +2081 -0
- package/dist/core/count-tier-budget.d.ts +14 -0
- package/dist/core/count-tier-budget.js +64 -0
- package/dist/core/count-unions.d.ts +2 -0
- package/dist/core/count-unions.js +139 -0
- package/dist/core/count-unwritten-prefix.d.ts +24 -0
- package/dist/core/count-unwritten-prefix.js +97 -0
- package/dist/core/count-witness-flags.d.ts +9 -0
- package/dist/core/count-witness-flags.js +37 -0
- package/dist/core/count-write-frames.d.ts +12 -0
- package/dist/core/count-write-frames.js +206 -0
- package/dist/core/count-write-shape.d.ts +15 -0
- package/dist/core/count-write-shape.js +73 -0
- package/dist/core/counts.d.ts +49 -7
- package/dist/core/counts.js +1679 -165
- 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 +59 -6
- package/dist/core/dsl.js +459 -112
- package/dist/core/effect.js +8 -1
- package/dist/core/evaluation-admission.d.ts +1 -0
- package/dist/core/evaluation-admission.js +3 -0
- package/dist/core/exists.d.ts +7 -2
- package/dist/core/exists.js +131 -24
- package/dist/core/extract-check.d.ts +7 -1
- package/dist/core/extract-check.js +130 -13
- package/dist/core/extract-read.d.ts +22 -8
- package/dist/core/extract-read.js +29 -11
- package/dist/core/extract-shapes.js +122 -41
- package/dist/core/extract-standalone.js +53 -9
- package/dist/core/extract.js +9 -3
- package/dist/core/field-laws.d.ts +4 -0
- package/dist/core/field-laws.js +238 -0
- package/dist/core/finite-frontiers.d.ts +5 -0
- package/dist/core/finite-frontiers.js +116 -0
- package/dist/core/finite-houdini.d.ts +58 -0
- package/dist/core/finite-houdini.js +502 -0
- package/dist/core/finite-model.d.ts +13 -0
- package/dist/core/finite-model.js +68 -0
- package/dist/core/finite-tiny.d.ts +72 -0
- package/dist/core/finite-tiny.js +1080 -0
- package/dist/core/fixtures/count-completion/paxos-decision.json +1 -0
- package/dist/core/fresh.js +5 -1
- package/dist/core/infer.d.ts +1 -1
- package/dist/core/infer.js +76 -38
- package/dist/core/kind.js +2 -1
- package/dist/core/laws.d.ts +2 -1
- package/dist/core/laws.js +47 -14
- package/dist/core/lemma-cuts.d.ts +38 -0
- package/dist/core/lemma-cuts.js +366 -0
- package/dist/core/linear-admission.d.ts +14 -0
- package/dist/core/linear-admission.js +151 -0
- package/dist/core/machine.d.ts +44 -4
- package/dist/core/machine.js +342 -63
- package/dist/core/meter.d.ts +22 -0
- package/dist/core/meter.js +34 -0
- package/dist/core/mutate.d.ts +55 -0
- package/dist/core/mutate.js +210 -0
- package/dist/core/native-domain.d.ts +6 -0
- package/dist/core/native-domain.js +114 -0
- package/dist/core/native-law.d.ts +3 -0
- package/dist/core/native-law.js +174 -0
- package/dist/core/nonterm.js +4 -3
- 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 +25 -0
- package/dist/core/quorum-laws.js +263 -0
- 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/relational.js +10 -2
- package/dist/core/relevance.d.ts +4 -0
- package/dist/core/relevance.js +79 -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 +5 -0
- package/dist/core/runtime-wall.js +4 -0
- package/dist/core/sample-step.d.ts +16 -0
- package/dist/core/sample-step.js +28 -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/source-check.d.ts +44 -0
- package/dist/core/source-check.js +126 -0
- package/dist/core/source-diagnostic.d.ts +1 -0
- package/dist/core/source-diagnostic.js +34 -0
- 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/support-budget.d.ts +2 -0
- package/dist/core/support-budget.js +6 -0
- package/dist/core/system.js +6 -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 +11 -0
- package/dist/core/wall.js +37 -0
- package/dist/core/watch.d.ts +1 -1
- package/dist/core/watch.js +15 -2
- 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.d.ts +4 -0
- package/dist/kernel/cdcl.js +109 -41
- package/dist/kernel/epr.js +23 -8
- package/dist/kernel/kernel.d.ts +56 -0
- package/dist/kernel/kernel.js +466 -64
- package/dist/kernel/model-sequence.d.ts +2 -2
- package/dist/kernel/model-sequence.js +4 -3
- package/dist/kernel/model-values.d.ts +2 -0
- package/dist/kernel/model-values.js +60 -0
- package/dist/kernel/prove.d.ts +59 -3
- package/dist/kernel/prove.js +524 -130
- package/dist/kernel/prover-rows.d.ts +30 -0
- package/dist/kernel/prover-rows.js +125 -0
- 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/emit.d.ts +47 -2
- package/dist/lean-kernel/emit.js +270 -36
- package/dist/lean-kernel/lean-terms.d.ts +1 -0
- package/dist/lean-kernel/lean-terms.js +13 -5
- 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/library.js +4 -0
- package/dist/lean-kernel/qalpha.d.ts +7 -0
- package/dist/lean-kernel/qalpha.js +40 -0
- package/package.json +5 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { workLedger } from "./work-admission.js";
|
|
2
|
+
import { compareWork, zeroWork } from "./work-amount.js";
|
|
3
|
+
export function countRescopeFunding(bank = workLedger) {
|
|
4
|
+
const owner = bank.currentScope(), rootEpoch = bank.snapshot().rootEpoch;
|
|
5
|
+
return {
|
|
6
|
+
retainUncheckedOffer: true,
|
|
7
|
+
allowFullFallback: () => {
|
|
8
|
+
if (!owner || owner.kind === 'root' || !bank.inBudget())
|
|
9
|
+
return false;
|
|
10
|
+
const active = bank.snapshot();
|
|
11
|
+
if (active.rootEpoch !== rootEpoch || !active.activeEndpoints.some(scope => scope.id === owner.id))
|
|
12
|
+
return false;
|
|
13
|
+
const left = bank.available();
|
|
14
|
+
return left !== null && compareWork(left, zeroWork) > 0;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Machine } from './machine.js';
|
|
2
|
+
export type Restriction = {
|
|
3
|
+
base: string;
|
|
4
|
+
input: string;
|
|
5
|
+
positive: string;
|
|
6
|
+
negative: string;
|
|
7
|
+
};
|
|
8
|
+
export declare function restrictedCounts(m: Machine, selected?: readonly string[], cap?: number, memberKey?: string): {
|
|
9
|
+
machine: Machine;
|
|
10
|
+
entries: Restriction[];
|
|
11
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Fresh conservative count definitions for opt-in proof strategies.
|
|
2
|
+
// Pure definitions only: original fields, transitions and counts are unchanged.
|
|
3
|
+
import { get, n, not, x } from "./machine.js";
|
|
4
|
+
import { substE } from "../kernel/kernel.js";
|
|
5
|
+
export function restrictedCounts(m, selected = Object.keys(m.counts ?? {}), cap = 32, memberKey) {
|
|
6
|
+
if (!Number.isSafeInteger(cap) || cap < 0 || cap > 128)
|
|
7
|
+
throw Error('invalid restricted-count cap');
|
|
8
|
+
const entries = [], added = {}, occupied = new Set([...Object.keys(m.counts ?? {}), ...Object.keys(m.maps ?? {}), ...(m.inputMaps ?? []), ...Object.keys(m.state)]);
|
|
9
|
+
for (const base of new Set(selected)) {
|
|
10
|
+
const source = m.counts?.[base];
|
|
11
|
+
if (!source)
|
|
12
|
+
continue;
|
|
13
|
+
if (memberKey && memberKey !== source.key && JSON.stringify(source).includes(JSON.stringify(memberKey)))
|
|
14
|
+
throw Error('restricted-count binder capture');
|
|
15
|
+
const definition = memberKey && memberKey !== source.key ? { ...source, key: memberKey, body: substE(source.body, { vars: { [source.key]: x(memberKey) }, maps: {}, flags: {} }) } : source;
|
|
16
|
+
for (const input of new Set(m.inputMaps ?? [])) {
|
|
17
|
+
if (entries.length >= cap)
|
|
18
|
+
break;
|
|
19
|
+
const positive = `${base}$restricted$${input}`, negative = `${positive}$not`;
|
|
20
|
+
if (occupied.has(positive) || occupied.has(negative))
|
|
21
|
+
throw Error('restricted-count name collision');
|
|
22
|
+
occupied.add(positive);
|
|
23
|
+
occupied.add(negative);
|
|
24
|
+
const guard = { op: '<', a: n(0), b: get(input, x(definition.key)) };
|
|
25
|
+
added[positive] = { ...definition, body: { op: 'if', c: guard, then: definition.body, else: n(0) } };
|
|
26
|
+
added[negative] = { ...definition, body: { op: 'if', c: not(guard), then: definition.body, else: n(0) } };
|
|
27
|
+
entries.push({ base, input, positive, negative });
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return { machine: entries.length ? { ...m, counts: { ...m.counts, ...added } } : m, entries };
|
|
31
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type WorkLedger } from './work-admission.js';
|
|
2
|
+
import { type WorkAmount } from './work-amount.js';
|
|
3
|
+
export declare const countRetryFuel = 6;
|
|
4
|
+
export type CountAttemptResult = 'unfinished' | 'proposal' | 'decline' | 'hard-cap';
|
|
5
|
+
export declare class CountAttemptTickets {
|
|
6
|
+
private left;
|
|
7
|
+
private active;
|
|
8
|
+
private ended;
|
|
9
|
+
private runs;
|
|
10
|
+
constructor(retries?: number);
|
|
11
|
+
start(): boolean;
|
|
12
|
+
finish(result: CountAttemptResult): void;
|
|
13
|
+
snapshot(): Readonly<{
|
|
14
|
+
remaining: number;
|
|
15
|
+
started: number;
|
|
16
|
+
active: boolean;
|
|
17
|
+
terminal: boolean;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export type CountSlice = Readonly<{
|
|
21
|
+
key: string;
|
|
22
|
+
allocation: WorkAmount;
|
|
23
|
+
scopeId: number;
|
|
24
|
+
rootEpoch: number;
|
|
25
|
+
caseKey?: string;
|
|
26
|
+
physicalKey?: string;
|
|
27
|
+
}>;
|
|
28
|
+
export type CountAttemptStop = Readonly<{
|
|
29
|
+
kind: 'soft-slice';
|
|
30
|
+
key: string;
|
|
31
|
+
allocation: WorkAmount;
|
|
32
|
+
scopeId: number;
|
|
33
|
+
rootEpoch: number;
|
|
34
|
+
caseKey?: string;
|
|
35
|
+
physicalKey?: string;
|
|
36
|
+
}> | Readonly<{
|
|
37
|
+
kind: 'hard-cap';
|
|
38
|
+
reason: 'unclassified' | 'enclosing-limit' | 'scope-entry';
|
|
39
|
+
error: unknown;
|
|
40
|
+
}>;
|
|
41
|
+
export declare function countAttemptStop(error: unknown, slices: readonly CountSlice[], bank?: WorkLedger): CountAttemptStop;
|
|
42
|
+
export type CountRetryKey = Readonly<{
|
|
43
|
+
key: string;
|
|
44
|
+
allocation: WorkAmount;
|
|
45
|
+
used: WorkAmount;
|
|
46
|
+
}>;
|
|
47
|
+
export type CountRetryHeadroom = Readonly<{
|
|
48
|
+
scope: string;
|
|
49
|
+
remaining: WorkAmount;
|
|
50
|
+
}>;
|
|
51
|
+
export type CountRetryFunding = Readonly<{
|
|
52
|
+
key: string;
|
|
53
|
+
amount: WorkAmount;
|
|
54
|
+
}>;
|
|
55
|
+
export type CountRetryPlan = Readonly<{
|
|
56
|
+
kind: 'admitted';
|
|
57
|
+
need: WorkAmount;
|
|
58
|
+
keys: readonly CountRetryKey[];
|
|
59
|
+
funding?: readonly CountRetryFunding[];
|
|
60
|
+
rootEpoch: number;
|
|
61
|
+
}> | Readonly<{
|
|
62
|
+
kind: 'refused';
|
|
63
|
+
reason: 'hard-cap' | 'unknown-key' | 'changed-slice' | 'headroom' | 'missing-root';
|
|
64
|
+
scope?: string;
|
|
65
|
+
need?: WorkAmount;
|
|
66
|
+
}>;
|
|
67
|
+
export declare function planCountRetry(keys: readonly CountRetryKey[], stop: CountAttemptStop, headrooms: readonly CountRetryHeadroom[], bank?: WorkLedger): CountRetryPlan;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Section46 admission metadata, not proof authority. The inventory is fixed per
|
|
2
|
+
// pass; no result can mint another recipe instance or replenish its tickets.
|
|
3
|
+
import { workLedger } from "./work-admission.js";
|
|
4
|
+
import { compareWork, workAdd, workAmount, workShare } from "./work-amount.js";
|
|
5
|
+
export const countRetryFuel = 6;
|
|
6
|
+
export class CountAttemptTickets {
|
|
7
|
+
left;
|
|
8
|
+
active = false;
|
|
9
|
+
ended = false;
|
|
10
|
+
runs = 0;
|
|
11
|
+
constructor(retries = countRetryFuel) {
|
|
12
|
+
if (!Number.isSafeInteger(retries) || retries < 0 || retries > countRetryFuel)
|
|
13
|
+
throw new RangeError('invalid retry fuel');
|
|
14
|
+
this.left = retries + 1;
|
|
15
|
+
}
|
|
16
|
+
start() {
|
|
17
|
+
if (this.active || this.ended || this.left === 0)
|
|
18
|
+
return false;
|
|
19
|
+
this.left--;
|
|
20
|
+
this.runs++;
|
|
21
|
+
this.active = true;
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
finish(result) {
|
|
25
|
+
if (!this.active)
|
|
26
|
+
throw new Error('attempt result without a started ticket');
|
|
27
|
+
this.active = false;
|
|
28
|
+
if (result !== 'unfinished' || this.left === 0)
|
|
29
|
+
this.ended = true;
|
|
30
|
+
}
|
|
31
|
+
snapshot() {
|
|
32
|
+
return Object.freeze({ remaining: this.left, started: this.runs, active: this.active, terminal: this.ended });
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function countAttemptStop(error, slices, bank = workLedger) {
|
|
36
|
+
if (slices.length > 64 || !bank.inBudget())
|
|
37
|
+
return { kind: 'hard-cap', reason: 'unclassified', error };
|
|
38
|
+
const refusal = bank.capacityRefusal(error);
|
|
39
|
+
if (!refusal)
|
|
40
|
+
return { kind: 'hard-cap', reason: 'unclassified', error };
|
|
41
|
+
if (refusal.reason === 'scope-entry')
|
|
42
|
+
return { kind: 'hard-cap', reason: 'scope-entry', error };
|
|
43
|
+
// An equally limiting enclosing scope wins over a soft slice. Never infer a
|
|
44
|
+
// slice from phase text, a clock subtraction, or the last event observed.
|
|
45
|
+
if (refusal.limiting.length === 1 && refusal.limiting[0].kind === 'scope') {
|
|
46
|
+
const rootEpoch = bank.snapshot().rootEpoch;
|
|
47
|
+
const matches = slices.filter(slice => slice.scopeId === refusal.limiting[0].id && slice.rootEpoch === rootEpoch);
|
|
48
|
+
if (matches.length === 1 && validAmount(matches[0].allocation, true)) {
|
|
49
|
+
const slice = matches[0];
|
|
50
|
+
return { kind: 'soft-slice', key: slice.key, allocation: slice.allocation, scopeId: slice.scopeId, rootEpoch: slice.rootEpoch, ...(slice.caseKey !== undefined ? { caseKey: slice.caseKey } : {}), ...(slice.physicalKey !== undefined ? { physicalKey: slice.physicalKey } : {}) };
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return { kind: 'hard-cap', reason: 'enclosing-limit', error };
|
|
54
|
+
}
|
|
55
|
+
const numericLimit = 1n << 4096n;
|
|
56
|
+
const validAmount = (a, positive = false) => a.den > 0n && a.den <= numericLimit && a.num <= numericLimit && (positive ? a.num > 0n : a.num >= 0n);
|
|
57
|
+
export function planCountRetry(keys, stop, headrooms, bank = workLedger) {
|
|
58
|
+
// Preparation is paid separately, before the atomic admission decision.
|
|
59
|
+
// Refusing a prepared round starts no strategy body or ticket.
|
|
60
|
+
bank.start('ticks', 1, 'count retry metadata header');
|
|
61
|
+
if (keys.length === 0 || keys.length > 64 || headrooms.length > 64)
|
|
62
|
+
throw new RangeError('unbounded retry metadata');
|
|
63
|
+
const names = new Set();
|
|
64
|
+
for (let i = 0; i < keys.length; i++) {
|
|
65
|
+
bank.start('ticks', 1, 'count retry key validation');
|
|
66
|
+
const key = keys[i];
|
|
67
|
+
if (!key.key || key.key.length > 256 || names.has(key.key) || !validAmount(key.allocation, true) || !validAmount(key.used))
|
|
68
|
+
throw new RangeError('invalid retry key');
|
|
69
|
+
names.add(key.key);
|
|
70
|
+
}
|
|
71
|
+
for (let i = 0; i < headrooms.length; i++) {
|
|
72
|
+
bank.start('ticks', 1, 'count retry ancestor validation');
|
|
73
|
+
if (!validAmount(headrooms[i].remaining))
|
|
74
|
+
throw new RangeError('invalid retry headroom');
|
|
75
|
+
}
|
|
76
|
+
if (stop.kind !== 'soft-slice')
|
|
77
|
+
return { kind: 'refused', reason: 'hard-cap' };
|
|
78
|
+
let raised;
|
|
79
|
+
for (let i = 0; i < keys.length; i++) {
|
|
80
|
+
bank.start('ticks', 1, 'count retry key selection');
|
|
81
|
+
if (keys[i].key === stop.key)
|
|
82
|
+
raised = keys[i];
|
|
83
|
+
}
|
|
84
|
+
if (!raised)
|
|
85
|
+
return { kind: 'refused', reason: 'unknown-key' };
|
|
86
|
+
if (compareWork(raised.allocation, stop.allocation) !== 0)
|
|
87
|
+
return { kind: 'refused', reason: 'changed-slice' };
|
|
88
|
+
const next = [], funding = [];
|
|
89
|
+
let need = workAmount(0n);
|
|
90
|
+
for (let i = 0; i < keys.length; i++) {
|
|
91
|
+
bank.start('ticks', 1, 'count retry allowance preparation');
|
|
92
|
+
const key = keys[i];
|
|
93
|
+
const allocation = key === raised ? workShare(key.allocation, 2n, 1n) : key.allocation;
|
|
94
|
+
// D F4(a): funding for repeated work is not a new per-key cap. In
|
|
95
|
+
// particular aggregate leaf use must not enlarge every individual leaf.
|
|
96
|
+
const contribution = key === raised ? allocation : compareWork(key.allocation, key.used) < 0 ? key.used : key.allocation;
|
|
97
|
+
next.push(Object.freeze({ key: key.key, allocation, used: workAmount(0n) }));
|
|
98
|
+
funding.push(Object.freeze({ key: key.key, amount: contribution }));
|
|
99
|
+
need = workAdd(need, contribution);
|
|
100
|
+
}
|
|
101
|
+
const live = bank.available();
|
|
102
|
+
if (live === null || !bank.inBudget() || stop.rootEpoch !== bank.snapshot().rootEpoch)
|
|
103
|
+
return { kind: 'refused', reason: 'missing-root', need };
|
|
104
|
+
for (let i = 0; i < headrooms.length; i++) {
|
|
105
|
+
bank.start('ticks', 1, 'count retry ancestor comparison');
|
|
106
|
+
const boundary = headrooms[i];
|
|
107
|
+
if (compareWork(need, boundary.remaining) > 0)
|
|
108
|
+
return { kind: 'refused', reason: 'headroom', scope: boundary.scope, need };
|
|
109
|
+
}
|
|
110
|
+
const remaining = bank.available();
|
|
111
|
+
if (compareWork(need, remaining) > 0)
|
|
112
|
+
return { kind: 'refused', reason: 'headroom', scope: 'effective-ledger', need };
|
|
113
|
+
return Object.freeze({ kind: 'admitted', need, keys: Object.freeze(next), funding: Object.freeze(funding), rootEpoch: stop.rootEpoch });
|
|
114
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type WorkLedger } from './work-admission.js';
|
|
2
|
+
import { CountAttemptTickets, type CountAttemptStop, type CountRetryPlan, type CountSlice } from './count-retry-budget.js';
|
|
3
|
+
export type CountRoundValue<T> = Readonly<{
|
|
4
|
+
kind: 'proposal';
|
|
5
|
+
value: T;
|
|
6
|
+
}> | Readonly<{
|
|
7
|
+
kind: 'decline';
|
|
8
|
+
reason: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type CountRoundResult<T> = CountRoundValue<T> | Readonly<{
|
|
11
|
+
kind: 'unfinished';
|
|
12
|
+
stop: CountAttemptStop;
|
|
13
|
+
}> | Readonly<{
|
|
14
|
+
kind: 'hard-cap';
|
|
15
|
+
stop: CountAttemptStop;
|
|
16
|
+
}> | Readonly<{
|
|
17
|
+
kind: 'not-started';
|
|
18
|
+
reason: string;
|
|
19
|
+
}>;
|
|
20
|
+
export declare function runCountRetryRound<T>(plan: CountRetryPlan, tickets: CountAttemptTickets, run: () => CountRoundValue<T>, options?: {
|
|
21
|
+
bank?: WorkLedger;
|
|
22
|
+
slices?: readonly CountSlice[];
|
|
23
|
+
eligible?: () => boolean;
|
|
24
|
+
}): CountRoundResult<T>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Atomic admission of a prepared retry. Metadata preparation is already paid;
|
|
2
|
+
// this boundary does not start a ticket or a callback when the live bank refuses.
|
|
3
|
+
import { BudgetExpired, workLedger } from "./work-admission.js";
|
|
4
|
+
import { countAttemptStop } from "./count-retry-budget.js";
|
|
5
|
+
export function runCountRetryRound(plan, tickets, run, options = {}) {
|
|
6
|
+
if (plan.kind === 'refused')
|
|
7
|
+
return { kind: 'not-started', reason: plan.reason };
|
|
8
|
+
const bank = options.bank ?? workLedger;
|
|
9
|
+
if (!bank.inBudget() || plan.rootEpoch !== bank.snapshot().rootEpoch)
|
|
10
|
+
return { kind: 'not-started', reason: 'missing-root' };
|
|
11
|
+
if (tickets.snapshot().terminal || tickets.snapshot().active)
|
|
12
|
+
return { kind: 'not-started', reason: 'tickets' };
|
|
13
|
+
try {
|
|
14
|
+
bank.checkAmount(plan.need, 'count retry admission');
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (error instanceof BudgetExpired)
|
|
18
|
+
return { kind: 'not-started', reason: 'headroom' };
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
return bank.withBudget(plan.need, () => {
|
|
22
|
+
if (options.eligible && !options.eligible())
|
|
23
|
+
return { kind: 'not-started', reason: 'ineligible' };
|
|
24
|
+
// Ticket commitment and user code are inside the already funded round. Any
|
|
25
|
+
// failure of this bookkeeping quantum is hard and starts no user callback.
|
|
26
|
+
bank.start('ticks', 1, 'count retry ticket commitment');
|
|
27
|
+
if (!tickets.start())
|
|
28
|
+
return { kind: 'not-started', reason: 'tickets' };
|
|
29
|
+
try {
|
|
30
|
+
const value = run();
|
|
31
|
+
tickets.finish(value.kind);
|
|
32
|
+
return value;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
if (!(error instanceof BudgetExpired)) {
|
|
36
|
+
tickets.finish('hard-cap');
|
|
37
|
+
throw error;
|
|
38
|
+
}
|
|
39
|
+
const stop = countAttemptStop(error, options.slices ?? [], bank);
|
|
40
|
+
tickets.finish(stop.kind === 'soft-slice' ? 'unfinished' : 'hard-cap');
|
|
41
|
+
return stop.kind === 'soft-slice' ? { kind: 'unfinished', stop } : { kind: 'hard-cap', stop };
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type E, type Law, type Machine } from './machine.js';
|
|
2
|
+
import { type RowAgreementShape } from './row-agreement-shape.js';
|
|
3
|
+
import { type CountRequestBuilder, type CountStrategyOptions, type CountStrategyProof } from './count-strategy.js';
|
|
4
|
+
import { type CountCert, type Goal, type Instances, type Path } from '../kernel/kernel.js';
|
|
5
|
+
export declare function rowAgreementWrittenKeys(m: Machine, shape: RowAgreementShape): string[];
|
|
6
|
+
export type RowAgreementTrace = {
|
|
7
|
+
stage: 'leaf';
|
|
8
|
+
outcome: string;
|
|
9
|
+
goal: Goal;
|
|
10
|
+
path: Path;
|
|
11
|
+
hyps?: number;
|
|
12
|
+
units?: number;
|
|
13
|
+
wallMs?: number;
|
|
14
|
+
witness?: Record<string, number>;
|
|
15
|
+
method?: 'linear' | 'cdcl' | 'symmetry';
|
|
16
|
+
symmetryEnabled?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type RowAgreementOptions = CountStrategyOptions & {
|
|
19
|
+
premiseScoped?: boolean;
|
|
20
|
+
observe?: (trace: RowAgreementTrace) => void;
|
|
21
|
+
seedInstances?: Instances;
|
|
22
|
+
onlySeededPremises?: boolean;
|
|
23
|
+
witnessFlags?: boolean;
|
|
24
|
+
fastClosure?: boolean;
|
|
25
|
+
symmetryReuse?: boolean;
|
|
26
|
+
diagonalFirst?: boolean;
|
|
27
|
+
sparseOwn?: boolean;
|
|
28
|
+
operationPath?: boolean;
|
|
29
|
+
diagonalAlias?: boolean;
|
|
30
|
+
framePremisesOnly?: boolean;
|
|
31
|
+
ownRows?: E[];
|
|
32
|
+
premiseRows?: E[];
|
|
33
|
+
};
|
|
34
|
+
export declare function proposeRowAgreementInitial(m: Machine, family: Law[], law: Law, until: number, requestFor: CountRequestBuilder): CountCert | undefined;
|
|
35
|
+
export declare function proveRowAgreementCase(m: Machine, family: Law[], law: Law, shape: RowAgreementShape, until: number, requestFor: CountRequestBuilder, options?: RowAgreementOptions): CountStrategyProof | undefined;
|
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
// Experimental written-row proposer. Standalone results check INIT and STEP;
|
|
2
|
+
// composition may request only an unchecked STEP proposal for its final check.
|
|
3
|
+
// The optional composition hook owns production dispatch; no trusted shortcut.
|
|
4
|
+
import { n, same, walkOnce, x } from "./machine.js";
|
|
5
|
+
import { countGuardTree } from "./count-guard-tree.js";
|
|
6
|
+
import { countFrameConditions, fixedCountFrameCase } from "./count-frames.js";
|
|
7
|
+
import { strategyLeafUntil } from "./count-strategy.js";
|
|
8
|
+
import { canon, check, checkMC, countedObligations, leafConstraints, mcGoal, substC, substE, truth } from "../kernel/kernel.js";
|
|
9
|
+
import { clock, fullRate, fullWork, pastWall, withDeadline } from "../kernel/prove.js";
|
|
10
|
+
import { growCdcl } from "../kernel/cdcl.js";
|
|
11
|
+
import { seedCountWitnessFlags } from "./count-witness-flags.js";
|
|
12
|
+
import { refuteFast } from "./solver.js";
|
|
13
|
+
import { rowSymmetryCache } from "./count-row-symmetry.js";
|
|
14
|
+
import { operationRefutation } from "./count-row-reindex.js";
|
|
15
|
+
import { countPremiseView } from "./count-premise-view.js";
|
|
16
|
+
import { rebasePath } from "./count-recovery/rebase-path.js";
|
|
17
|
+
import { countStageTrace } from "./count-stage-trace.js";
|
|
18
|
+
import { traceNow } from "./trace-clock.js";
|
|
19
|
+
// Operation tests are often already inlined, and a row equality can be an
|
|
20
|
+
// ancestor of the operation guard. Prune only branches decided by the fixed
|
|
21
|
+
// operation; proposing extra row splits is safe, omitting them loses proofs.
|
|
22
|
+
export function rowAgreementWrittenKeys(m, shape) {
|
|
23
|
+
const choice = fixedCountFrameCase(m);
|
|
24
|
+
if (!choice)
|
|
25
|
+
return [];
|
|
26
|
+
const path = new Map(countFrameConditions(choice).map(lin => [canon(lin), { lin, holds: true }]));
|
|
27
|
+
const rows = new Set(), flags = Object.create(null);
|
|
28
|
+
for (const [name, condition] of Object.entries(m.step.flags ?? {}))
|
|
29
|
+
flags[name] = condition.op === 'all' ? same(x('?' + name), n(1)) : substC(condition, { vars: {}, maps: {}, flags });
|
|
30
|
+
for (const map of [shape.map, ...shape.fields, ...shape.markers.map(marker => marker.map)]) {
|
|
31
|
+
const write = m.step.maps?.[map];
|
|
32
|
+
if (!write)
|
|
33
|
+
continue;
|
|
34
|
+
if (!('each' in write)) {
|
|
35
|
+
if (write.key.op !== 'var' || !m.inputs.includes(write.key.name))
|
|
36
|
+
continue;
|
|
37
|
+
let guarded = false, active = false;
|
|
38
|
+
walkOnce(substE(write.value, { vars: {}, maps: {}, flags }), (part) => {
|
|
39
|
+
if (part.op !== '=')
|
|
40
|
+
return;
|
|
41
|
+
const [v, value] = part.a.op === 'var' ? [part.a, part.b] : [part.b, part.a];
|
|
42
|
+
if (v.op !== 'var' || v.name !== choice.name || value.op !== 'const' || !choice.values.includes(value.value))
|
|
43
|
+
return;
|
|
44
|
+
guarded = true;
|
|
45
|
+
active ||= value.value === choice.value;
|
|
46
|
+
});
|
|
47
|
+
if (!guarded || active)
|
|
48
|
+
rows.add(write.key.name);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const visit = (value) => {
|
|
52
|
+
if (!value || typeof value !== 'object')
|
|
53
|
+
return;
|
|
54
|
+
const node = value;
|
|
55
|
+
if (node.op === 'if') {
|
|
56
|
+
const condition = substC(node.c, { vars: {}, maps: {}, flags }), active = truth(condition, path);
|
|
57
|
+
if (active !== false)
|
|
58
|
+
walkOnce(condition, (part) => {
|
|
59
|
+
if (part.op !== '=')
|
|
60
|
+
return;
|
|
61
|
+
const [v, key] = part.a.op === 'var' && part.a.name === write.each ? [part.a, part.b] : [part.b, part.a];
|
|
62
|
+
if (v.op === 'var' && v.name === write.each && key.op === 'var' && m.inputs.includes(key.name))
|
|
63
|
+
rows.add(key.name);
|
|
64
|
+
});
|
|
65
|
+
if (active !== false)
|
|
66
|
+
visit(node.then);
|
|
67
|
+
if (active !== true)
|
|
68
|
+
visit(node.else);
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
for (const child of Array.isArray(value) ? value : Object.values(node))
|
|
72
|
+
visit(child);
|
|
73
|
+
};
|
|
74
|
+
visit(write.value);
|
|
75
|
+
}
|
|
76
|
+
return [...rows];
|
|
77
|
+
}
|
|
78
|
+
// An unchecked INIT proposal for a single-check composition. No STEP or supplied premise.
|
|
79
|
+
export function proposeRowAgreementInitial(m, family, law, until, requestFor) {
|
|
80
|
+
return withDeadline(until, () => {
|
|
81
|
+
const target = family.indexOf(law);
|
|
82
|
+
if (target < 0 || clock() >= until || pastWall())
|
|
83
|
+
return;
|
|
84
|
+
const packets = countedObligations(m, family, {}, target);
|
|
85
|
+
if (packets.length !== 2)
|
|
86
|
+
return;
|
|
87
|
+
const packet = packets[0], request = requestFor(packet.goal, packet.decls), goal = mcGoal(packet.goal.hyps, packet.decls, request);
|
|
88
|
+
const result = goal && growCdcl(goal, new Map(), { nodes: 0, until });
|
|
89
|
+
return result && 'tree' in result ? { ...request, tree: result.tree } : undefined;
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
export function proveRowAgreementCase(m, family, law, shape, until, requestFor, options = {}) {
|
|
93
|
+
return withDeadline(until, () => {
|
|
94
|
+
const stages = countStageTrace(options.tailTrace, 'row-case-total');
|
|
95
|
+
try {
|
|
96
|
+
stages.mark('row-case-setup', 'untrusted-assembly');
|
|
97
|
+
const index = family.indexOf(law);
|
|
98
|
+
if (index < 0 || clock() >= until || pastWall() || !law.forall || law.keys?.length !== 2)
|
|
99
|
+
return;
|
|
100
|
+
// Only operation proposals may defer. Standalone INIT/STEP behavior stays checked.
|
|
101
|
+
const deferChecks = options.deferToComposition === true && options.deferRowChecks === true;
|
|
102
|
+
const frameOnly = options.framePremisesOnly && fixedCountFrameCase(m) && !rowAgreementWrittenKeys(m, shape).length;
|
|
103
|
+
const a = x(law.forall + '#'), b = x(law.keys[0]), column = x(law.keys[1]), keyed = new Set();
|
|
104
|
+
walkOnce(m.step.maps, (node) => { if (node.op === 'get' && !m.counts?.[node.map] && node.key.op === 'var' && m.inputs.includes(node.key.name))
|
|
105
|
+
keyed.add(node.key.name); });
|
|
106
|
+
// A small proposal pool: the goal's two rows and actual request row keys.
|
|
107
|
+
// No count law is seeded indiscriminately, and no supplied premise is added.
|
|
108
|
+
const rows = [a, b, ...(options.premiseRows ?? [...keyed].slice(0, 4).map(x))], instances = Object.fromEntries(Object.entries(options.seedInstances ?? {}).map(([name, terms]) => [name, [...terms]]));
|
|
109
|
+
const ownRows = options.ownRows ?? rows.slice(2);
|
|
110
|
+
const put = (l, tuples) => {
|
|
111
|
+
const old = instances[l.name] ?? [], arity = 1 + (l.keys?.length ?? 0);
|
|
112
|
+
for (let i = 0; i < old.length; i += arity)
|
|
113
|
+
tuples.push(old.slice(i, i + arity));
|
|
114
|
+
const unique = [...new Map(tuples.map(tuple => [JSON.stringify(tuple), tuple])).values()];
|
|
115
|
+
instances[l.name] = unique.flat();
|
|
116
|
+
};
|
|
117
|
+
stages.mark('row-premise-instantiation', 'untrusted-assembly');
|
|
118
|
+
for (const l of family) {
|
|
119
|
+
if ((frameOnly || options.onlySeededPremises) && l !== law)
|
|
120
|
+
continue;
|
|
121
|
+
const keys = [...(l.forall ? [l.forall] : []), ...(l.keys ?? [])];
|
|
122
|
+
let counted = false, columnKey;
|
|
123
|
+
walkOnce(l.holds, (node) => {
|
|
124
|
+
if (node.op !== 'get')
|
|
125
|
+
return;
|
|
126
|
+
if (m.counts?.[node.map])
|
|
127
|
+
counted = true;
|
|
128
|
+
const key = node.key;
|
|
129
|
+
if (key.op === 'add') {
|
|
130
|
+
const [base, suffix] = key.a.op === 'mul' ? [key.a, key.b] : [key.b, key.a];
|
|
131
|
+
if (base.op === 'mul' && base.k === shape.width && suffix.op === 'var' && keys.includes(suffix.name))
|
|
132
|
+
columnKey = suffix.name;
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
if (counted || !keys.length)
|
|
136
|
+
continue;
|
|
137
|
+
if (keys.length === 1)
|
|
138
|
+
put(l, rows.map(row => [row]));
|
|
139
|
+
else if (keys.length === 2)
|
|
140
|
+
put(l, columnKey === keys[1] ? rows.map(row => [row, column]) : rows.flatMap(row => rows.map(other => [row, other])));
|
|
141
|
+
else if (l === law)
|
|
142
|
+
put(l, frameOnly ? [[a, b, column]] : options.sparseOwn ? [[a, b, column], ...ownRows.flatMap(row => [[row, b, column], [a, row, column]])] : rows.flatMap(row => rows.map(other => [row, other, column])));
|
|
143
|
+
}
|
|
144
|
+
if (!frameOnly)
|
|
145
|
+
for (const [name, flag] of Object.entries(m.step.flags ?? {}))
|
|
146
|
+
if (flag.op === 'all' && !flag.keys?.length)
|
|
147
|
+
instances['?' + name] = [...rows, column];
|
|
148
|
+
if (Object.values(instances).reduce((n, terms) => n + terms.length, 0) > 2048)
|
|
149
|
+
return;
|
|
150
|
+
stages.mark('row-obligation-build', 'untrusted-assembly');
|
|
151
|
+
let packets = countedObligations(m, family, { [law.name]: instances }, index), step = packets.at(-1);
|
|
152
|
+
if (!step)
|
|
153
|
+
return;
|
|
154
|
+
stages.mark('row-request-build', 'untrusted-assembly');
|
|
155
|
+
let request = requestFor(step.goal, step.decls);
|
|
156
|
+
if (options.witnessFlags)
|
|
157
|
+
for (let round = 0; round < 2; round++) {
|
|
158
|
+
stages.mark('row-witness-seed', 'untrusted-assembly', round);
|
|
159
|
+
const seeded = seedCountWitnessFlags(m, instances, [{ decls: step.decls, cert: request }], true);
|
|
160
|
+
if (seeded === instances)
|
|
161
|
+
break;
|
|
162
|
+
Object.assign(instances, seeded);
|
|
163
|
+
if (clock() >= until || pastWall() || Object.values(instances).reduce((n, terms) => n + terms.length, 0) > 2048)
|
|
164
|
+
return;
|
|
165
|
+
stages.mark('row-witness-obligation-build', 'untrusted-assembly', round);
|
|
166
|
+
packets = countedObligations(m, family, { [law.name]: instances }, index);
|
|
167
|
+
step = packets.at(-1);
|
|
168
|
+
if (!step)
|
|
169
|
+
return;
|
|
170
|
+
stages.mark('row-witness-request-build', 'untrusted-assembly', round);
|
|
171
|
+
request = requestFor(step.goal, step.decls);
|
|
172
|
+
}
|
|
173
|
+
stages.mark('row-mc-goal-build', 'untrusted-assembly');
|
|
174
|
+
const goal = mcGoal(step.goal.hyps, step.decls, request);
|
|
175
|
+
if (!goal)
|
|
176
|
+
return;
|
|
177
|
+
stages.mark('row-symmetry-setup', 'untrusted-assembly');
|
|
178
|
+
options.trace?.({ query: 'row-context', goal, request, decls: step.decls });
|
|
179
|
+
const mirror = options.symmetryReuse ? rowSymmetryCache(goal, request, law.forall + '#', law.keys[0], until, options.tailTrace, deferChecks) : undefined;
|
|
180
|
+
const close = (path) => {
|
|
181
|
+
if (clock() >= until || pastWall())
|
|
182
|
+
return;
|
|
183
|
+
const start = fullWork(), wall = options.tailTrace || options.observe ? traceNow() : 0, leafEnd = strategyLeafUntil(until, options);
|
|
184
|
+
const leafStages = countStageTrace(options.tailTrace, 'row-leaf-total');
|
|
185
|
+
try {
|
|
186
|
+
leafStages.mark('row-symmetry-get', 'untrusted-assembly');
|
|
187
|
+
const reused = mirror?.get(path);
|
|
188
|
+
leafStages.mark('row-fast-linear', 'untrusted-search');
|
|
189
|
+
const fast = !reused && options.fastClosure ? refuteFast(leafConstraints(goal, path)) : undefined;
|
|
190
|
+
let scopedTree;
|
|
191
|
+
if (!reused && fast?.kind !== 'refuted' && options.premiseScoped) {
|
|
192
|
+
const scopedEnd = Math.min(leafEnd, clock() + Math.max(0, leafEnd - clock()) * 3 / 4), seen = new Set();
|
|
193
|
+
for (const guardReads of [false, true]) {
|
|
194
|
+
const scopeStart = fullWork();
|
|
195
|
+
leafStages.mark('row-premise-view', 'untrusted-assembly', Number(guardReads));
|
|
196
|
+
const scoped = countPremiseView(goal, m, law, step.goal.hyps.at(-1), step.goal.hyps.slice(0, 2), scopedEnd, guardReads);
|
|
197
|
+
if (!scoped || seen.has(scoped.selected.join(',')))
|
|
198
|
+
continue;
|
|
199
|
+
seen.add(scoped.selected.join(','));
|
|
200
|
+
const attemptEnd = scopedEnd;
|
|
201
|
+
leafStages.mark('row-scoped-search', 'untrusted-search', Number(guardReads));
|
|
202
|
+
const result = growCdcl(scoped.goal, path, { nodes: 0, until: attemptEnd });
|
|
203
|
+
leafStages.mark('row-scoped-transport', 'untrusted-assembly', Number(guardReads));
|
|
204
|
+
const candidate = 'tree' in result ? rebasePath(scoped.goal, result.tree, path, path, until, goal) : undefined;
|
|
205
|
+
leafStages.mark(deferChecks ? 'row-scoped-proposal' : 'row-scoped-check', deferChecks ? 'untrusted-assembly' : 'trusted-check', Number(guardReads));
|
|
206
|
+
scopedTree = candidate && (deferChecks || check(goal, candidate, path)) ? candidate : undefined;
|
|
207
|
+
options.trace?.({ query: 'premise-scope', goal: scoped.goal, path: new Map(path), guardReads, outcome: scopedTree ? deferChecks ? 'unchecked-proposal' : 'proved' : 'tree' in result ? 'transport-rejected' : result.stuck, hyps: scoped.goal.hyps.length, fullHyps: goal.hyps.length, selected: scoped.selected, omitted: scoped.omitted, allowed: scoped.allowed, scopeUnits: (fullWork() - scopeStart) / fullRate, units: (fullWork() - start) / fullRate });
|
|
208
|
+
if (scopedTree)
|
|
209
|
+
break;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
leafStages.mark('row-full-search', 'untrusted-search');
|
|
213
|
+
const result = reused ? { tree: reused } : fast?.kind === 'refuted' ? { tree: { leaf: fast.steps } } : scopedTree ? { tree: scopedTree } : growCdcl(goal, path, { nodes: 0, until: leafEnd });
|
|
214
|
+
const capped = leafEnd < until && clock() >= leafEnd;
|
|
215
|
+
leafStages.mark(deferChecks ? 'row-leaf-proposal' : 'row-leaf-check', deferChecks ? 'untrusted-assembly' : 'trusted-check');
|
|
216
|
+
const tree = 'tree' in result && (deferChecks || check(goal, result.tree, path)) && clock() < until ? result.tree : undefined;
|
|
217
|
+
leafStages.mark('row-symmetry-put', 'untrusted-assembly');
|
|
218
|
+
if (tree)
|
|
219
|
+
mirror?.put(path, tree);
|
|
220
|
+
options.observe?.({ stage: 'leaf', ...(options.symmetryReuse ? { symmetryEnabled: mirror !== undefined } : {}), method: reused ? 'symmetry' : fast?.kind === 'refuted' ? 'linear' : 'cdcl', outcome: tree ? deferChecks ? 'unchecked-proposal' : 'proved' : capped ? 'leaf-cap' : clock() >= until ? 'pool-exhausted' : 'stuck' in result ? result.stuck : 'rejected-proof', goal, path: new Map(path), hyps: goal.hyps.length, units: (fullWork() - start) / fullRate, ...(wall ? { wallMs: traceNow() - wall } : {}), ...('witness' in result ? { witness: result.witness } : {}) });
|
|
221
|
+
return tree;
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
leafStages.finish();
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
stages.mark('row-case-tree', 'untrusted-search');
|
|
228
|
+
const split = countGuardTree(until);
|
|
229
|
+
const writtenRows = rowAgreementWrittenKeys(m, shape).slice(0, 4).map(x);
|
|
230
|
+
const finish = (path) => options.diagonalAlias && writtenRows.some(row => truth(same(a, row), path) === true && truth(same(b, row), path) === true)
|
|
231
|
+
? split.condition(same(a, b), path, close, close) : close(path);
|
|
232
|
+
// Written-row cases are ordinary exhaustive equality splits. Extra splits
|
|
233
|
+
// only cost work; they cannot establish an invariant or authorize a fact.
|
|
234
|
+
const choose = (i, path) => {
|
|
235
|
+
if (i >= writtenRows.length)
|
|
236
|
+
return finish(path);
|
|
237
|
+
const written = writtenRows[i];
|
|
238
|
+
return split.condition(same(a, written), path, p => split.condition(same(b, written), p, q => choose(i + 1, q), q => choose(i + 1, q)), p => split.condition(same(b, written), p, q => choose(i + 1, q), q => choose(i + 1, q)));
|
|
239
|
+
};
|
|
240
|
+
const run = (path) => options.diagonalFirst ? split.condition(same(a, b), path, close, p => choose(0, p)) : choose(0, path);
|
|
241
|
+
const fixed = options.operationPath ? fixedCountFrameCase(m) : undefined;
|
|
242
|
+
const tree = fixed ? split.rows(countFrameConditions(fixed), new Map(), run, path => operationRefutation(leafConstraints(goal, path), fixed.name)) : run(new Map());
|
|
243
|
+
if (!tree)
|
|
244
|
+
return;
|
|
245
|
+
stages.mark('row-case-return', 'untrusted-assembly');
|
|
246
|
+
const stepCert = { ...request, tree };
|
|
247
|
+
if (options.deferToComposition)
|
|
248
|
+
return { instances, certs: { [step.goal.name]: stepCert }, ...(deferChecks ? { status: 'unchecked' } : {}) };
|
|
249
|
+
if (!checkMC(step.goal.hyps, step.decls, stepCert))
|
|
250
|
+
return;
|
|
251
|
+
const certs = { [step.goal.name]: stepCert };
|
|
252
|
+
for (const initial of packets.slice(0, -1)) {
|
|
253
|
+
if (clock() >= until || pastWall())
|
|
254
|
+
return;
|
|
255
|
+
const base = requestFor(initial.goal, initial.decls), initialGoal = mcGoal(initial.goal.hyps, initial.decls, base);
|
|
256
|
+
const result = initialGoal && growCdcl(initialGoal, new Map(), { nodes: 0, until });
|
|
257
|
+
if (!result || !('tree' in result))
|
|
258
|
+
return;
|
|
259
|
+
const cert = { ...base, tree: result.tree };
|
|
260
|
+
if (!checkMC(initial.goal.hyps, initial.decls, cert))
|
|
261
|
+
return;
|
|
262
|
+
certs[initial.goal.name] = cert;
|
|
263
|
+
}
|
|
264
|
+
return clock() < until && !pastWall() ? { instances, certs } : undefined;
|
|
265
|
+
}
|
|
266
|
+
finally {
|
|
267
|
+
stages.finish();
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { type CountCert, type CountDecl } from '../kernel/kernel.js';
|
|
2
|
+
export declare function identicalRowCountAliases(decls: CountDecl[], reads: CountCert['reads'], rowMap: string, prefix: string, more?: () => boolean): CountCert['insts'];
|
|
3
|
+
export declare function restrictedRowCountAliases(decls: CountDecl[], reads: CountCert['reads'], voteMap: string, prefix: string, more?: () => boolean): CountCert['insts'];
|