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,211 @@
|
|
|
1
|
+
// Section 46.2'/46.3': untrusted scheduling only. S is computed conservatively
|
|
2
|
+
// here; a checkedReduced marker must come from the accepted exact-scope replay.
|
|
3
|
+
// This graph never accepts a proof, replenishes fuel, or creates a recipe.
|
|
4
|
+
import { startWork } from "./work-admission.js";
|
|
5
|
+
import { checkWall } from "./wall.js";
|
|
6
|
+
const control = () => { checkWall('count recipe graph'); startWork('ticks', 1, 'count recipe graph'); };
|
|
7
|
+
// Shared conservative S computation for search and for the independently
|
|
8
|
+
// funded closing phase. Closing must not reuse a possibly stale search graph.
|
|
9
|
+
export function countRecipeRequirements(member, tick = control) {
|
|
10
|
+
const required = new Set();
|
|
11
|
+
if (!member.held) {
|
|
12
|
+
for (const recipe of member.recipes) {
|
|
13
|
+
tick();
|
|
14
|
+
if (!recipe.terminal)
|
|
15
|
+
for (const name of recipe.required ?? []) {
|
|
16
|
+
tick();
|
|
17
|
+
required.add(name);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
for (const name of member.held.premises) {
|
|
23
|
+
tick();
|
|
24
|
+
required.add(name);
|
|
25
|
+
}
|
|
26
|
+
const producing = member.recipes.find(recipe => { tick(); return recipe.id === member.held.recipeId; });
|
|
27
|
+
if (!producing)
|
|
28
|
+
throw Error('held member has no producing recipe');
|
|
29
|
+
if (!producing.terminal)
|
|
30
|
+
throw Error('completed recipe must be terminal');
|
|
31
|
+
if (!member.held.checkedReduced)
|
|
32
|
+
for (const name of producing.required ?? []) {
|
|
33
|
+
tick();
|
|
34
|
+
required.add(name);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return required;
|
|
38
|
+
}
|
|
39
|
+
export function countRecipeGraph(members, targets, tick = control, options = {}) {
|
|
40
|
+
const byName = new Map(), references = new Set(), requirements = new Map();
|
|
41
|
+
for (const member of members) {
|
|
42
|
+
tick();
|
|
43
|
+
if (byName.has(member.name) || !Number.isSafeInteger(member.reference) || member.reference < 0 || references.has(member.reference))
|
|
44
|
+
throw Error('invalid or duplicate recipe member');
|
|
45
|
+
byName.set(member.name, member);
|
|
46
|
+
references.add(member.reference);
|
|
47
|
+
const ids = new Set();
|
|
48
|
+
for (const recipe of member.recipes) {
|
|
49
|
+
tick();
|
|
50
|
+
if (!recipe.id || ids.has(recipe.id))
|
|
51
|
+
throw Error('duplicate recipe instance');
|
|
52
|
+
ids.add(recipe.id);
|
|
53
|
+
}
|
|
54
|
+
requirements.set(member.name, countRecipeRequirements(member, tick));
|
|
55
|
+
}
|
|
56
|
+
// Only the caller's explicitly natively checked external basis can discharge
|
|
57
|
+
// a missing pass member. Candidate expansion never supplies this authority.
|
|
58
|
+
const basis = new Set();
|
|
59
|
+
for (const name of options.basis ?? []) {
|
|
60
|
+
tick();
|
|
61
|
+
basis.add(name);
|
|
62
|
+
}
|
|
63
|
+
const blocked = new Set();
|
|
64
|
+
// A missing candidate is unobtainable in this pass. It participates in the
|
|
65
|
+
// same least fixed point rather than being silently dropped from a scope.
|
|
66
|
+
for (const required of requirements.values())
|
|
67
|
+
for (const name of required) {
|
|
68
|
+
tick();
|
|
69
|
+
if (!byName.has(name) && !basis.has(name))
|
|
70
|
+
blocked.add(name);
|
|
71
|
+
}
|
|
72
|
+
for (const member of members)
|
|
73
|
+
for (const recipe of member.recipes)
|
|
74
|
+
for (const name of recipe.required ?? []) {
|
|
75
|
+
tick();
|
|
76
|
+
if (!byName.has(name) && !basis.has(name))
|
|
77
|
+
blocked.add(name);
|
|
78
|
+
}
|
|
79
|
+
const eligible = (recipe) => {
|
|
80
|
+
tick();
|
|
81
|
+
if (recipe.terminal)
|
|
82
|
+
return false;
|
|
83
|
+
for (const name of recipe.required ?? []) {
|
|
84
|
+
tick();
|
|
85
|
+
if (blocked.has(name))
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
};
|
|
90
|
+
const isUsable = (member) => {
|
|
91
|
+
tick();
|
|
92
|
+
if (!member.held)
|
|
93
|
+
return false;
|
|
94
|
+
for (const name of requirements.get(member.name)) {
|
|
95
|
+
tick();
|
|
96
|
+
if (blocked.has(name))
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
};
|
|
101
|
+
let changed = true;
|
|
102
|
+
while (changed) {
|
|
103
|
+
changed = false;
|
|
104
|
+
for (const member of members) {
|
|
105
|
+
tick();
|
|
106
|
+
if (blocked.has(member.name) || isUsable(member))
|
|
107
|
+
continue;
|
|
108
|
+
let hasRecipe = false;
|
|
109
|
+
for (const recipe of member.recipes) {
|
|
110
|
+
tick();
|
|
111
|
+
if (eligible(recipe)) {
|
|
112
|
+
hasRecipe = true;
|
|
113
|
+
break;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
if (!hasRecipe) {
|
|
117
|
+
blocked.add(member.name);
|
|
118
|
+
changed = true;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
const usable = new Set();
|
|
123
|
+
for (const member of members) {
|
|
124
|
+
tick();
|
|
125
|
+
if (isUsable(member))
|
|
126
|
+
usable.add(member.name);
|
|
127
|
+
}
|
|
128
|
+
const reachable = (starts) => {
|
|
129
|
+
const seen = new Set(), queue = [];
|
|
130
|
+
for (const name of starts) {
|
|
131
|
+
tick();
|
|
132
|
+
queue.push(name);
|
|
133
|
+
}
|
|
134
|
+
for (let at = 0; at < queue.length; at++) {
|
|
135
|
+
tick();
|
|
136
|
+
const name = queue[at];
|
|
137
|
+
if (seen.has(name))
|
|
138
|
+
continue;
|
|
139
|
+
seen.add(name);
|
|
140
|
+
for (const prerequisite of requirements.get(name) ?? []) {
|
|
141
|
+
tick();
|
|
142
|
+
if (!seen.has(prerequisite))
|
|
143
|
+
queue.push(prerequisite);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
return seen;
|
|
147
|
+
};
|
|
148
|
+
const closure = reachable(targets), candidates = new Set();
|
|
149
|
+
for (const name of closure) {
|
|
150
|
+
tick();
|
|
151
|
+
candidates.add(name);
|
|
152
|
+
}
|
|
153
|
+
for (const target of targets) {
|
|
154
|
+
tick();
|
|
155
|
+
if (!byName.has(target) || blocked.has(target))
|
|
156
|
+
return { blocked, usable, closure, candidates, requirements, stop: 'target-blocked' };
|
|
157
|
+
}
|
|
158
|
+
// 46.15 changes consideration only. Score the expanded candidate domain
|
|
159
|
+
// through known edges; never add it to Req, S, or a proposal's proof scope.
|
|
160
|
+
let expand = false;
|
|
161
|
+
for (const name of closure) {
|
|
162
|
+
tick();
|
|
163
|
+
const member = byName.get(name);
|
|
164
|
+
if (!member || usable.has(name))
|
|
165
|
+
continue;
|
|
166
|
+
for (const recipe of member.recipes) {
|
|
167
|
+
tick();
|
|
168
|
+
if (recipe.required === undefined && eligible(recipe)) {
|
|
169
|
+
expand = true;
|
|
170
|
+
break;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (expand)
|
|
174
|
+
break;
|
|
175
|
+
}
|
|
176
|
+
if (expand)
|
|
177
|
+
for (const member of members) {
|
|
178
|
+
tick();
|
|
179
|
+
candidates.add(member.name);
|
|
180
|
+
}
|
|
181
|
+
const weights = new Map();
|
|
182
|
+
for (const name of candidates) {
|
|
183
|
+
tick();
|
|
184
|
+
for (const prerequisite of reachable([name])) {
|
|
185
|
+
tick();
|
|
186
|
+
if (prerequisite !== name && candidates.has(prerequisite))
|
|
187
|
+
weights.set(prerequisite, (weights.get(prerequisite) ?? 0) + 1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
let next, bestReference = Infinity;
|
|
191
|
+
for (const member of members) {
|
|
192
|
+
tick();
|
|
193
|
+
if (!candidates.has(member.name) || usable.has(member.name) || blocked.has(member.name))
|
|
194
|
+
continue;
|
|
195
|
+
let recipe;
|
|
196
|
+
for (const candidate of member.recipes) {
|
|
197
|
+
tick();
|
|
198
|
+
if (eligible(candidate) && (!recipe || (recipe.required === undefined && candidate.required !== undefined)))
|
|
199
|
+
recipe = candidate;
|
|
200
|
+
}
|
|
201
|
+
if (!recipe)
|
|
202
|
+
continue;
|
|
203
|
+
const candidate = { name: member.name, recipe, stranded: !!member.held, weight: weights.get(member.name) ?? 0, requiredSize: requirements.get(member.name).size };
|
|
204
|
+
const known = recipe.required !== undefined, previousKnown = next?.recipe.required !== undefined;
|
|
205
|
+
if (!next || candidate.weight > next.weight || candidate.weight === next.weight && (candidate.requiredSize > next.requiredSize || candidate.requiredSize === next.requiredSize && (known && !previousKnown || known === previousKnown && member.reference < bestReference))) {
|
|
206
|
+
next = candidate;
|
|
207
|
+
bestReference = member.reference;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
return next ? { blocked, usable, closure, candidates, requirements, next } : { blocked, usable, closure, candidates, requirements, stop: 'nothing-eligible' };
|
|
211
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type C, type Machine } from '../machine.js';
|
|
2
|
+
import { type Path } from '../../kernel/kernel.js';
|
|
3
|
+
export declare function actionGuard(m: Machine, selector: string, value: number | undefined): C | undefined;
|
|
4
|
+
export declare function activeCarried(m: Machine, path: Path): Set<string>;
|
|
5
|
+
export declare function copiesRows(m: Machine, root: Path): boolean;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// Untrusted action/parameter proposals from the machine's own flag shapes.
|
|
2
|
+
import { any, same, n, walkOnce, x } from "../machine.js";
|
|
3
|
+
import { substC, substE, truth } from "../../kernel/kernel.js";
|
|
4
|
+
import { walkLive } from "./live-dependencies.js";
|
|
5
|
+
export function actionGuard(m, selector, value) {
|
|
6
|
+
if (value === undefined)
|
|
7
|
+
return undefined;
|
|
8
|
+
const flags = Object.fromEntries(Object.entries(m.step.flags ?? {}).map(([name, q]) => [name, q.op === 'all' ? same(x(`?${name}`), n(1)) : q]));
|
|
9
|
+
const guards = [];
|
|
10
|
+
for (const q of Object.values(m.step.flags ?? {})) {
|
|
11
|
+
if (q.op === 'all')
|
|
12
|
+
continue;
|
|
13
|
+
let matches = false;
|
|
14
|
+
walkOnce(q, (o) => { if (o.op === '=' && [[o.a, o.b], [o.b, o.a]].some(([a, b]) => a.op === 'var' && a.name === selector && b.op === 'const' && b.value === value))
|
|
15
|
+
matches = true; });
|
|
16
|
+
if (matches)
|
|
17
|
+
guards.push(substC(q, { vars: {}, maps: {}, flags }));
|
|
18
|
+
}
|
|
19
|
+
return guards.length === 1 ? guards[0] : guards.length ? any(...guards) : undefined;
|
|
20
|
+
}
|
|
21
|
+
export function activeCarried(m, path) {
|
|
22
|
+
const out = new Set(), inputs = new Set(m.inputMaps ?? []);
|
|
23
|
+
for (const [name, q] of Object.entries(m.step.flags ?? {})) {
|
|
24
|
+
if (q.op !== 'all' || truth(same(x(`?${name}`), n(1)), path) !== true)
|
|
25
|
+
continue;
|
|
26
|
+
walkOnce(q.c, (o) => { if (o.op === 'get' && inputs.has(o.map))
|
|
27
|
+
out.add(o.map); });
|
|
28
|
+
}
|
|
29
|
+
if (!out.size && m.inputMaps?.[0])
|
|
30
|
+
out.add(m.inputMaps[0]);
|
|
31
|
+
return out;
|
|
32
|
+
}
|
|
33
|
+
// A live same-map read indexed by another input is a copy, unlike the
|
|
34
|
+
// unchanged per-member fallback. Its equal-row case may need both keys split.
|
|
35
|
+
export function copiesRows(m, root) {
|
|
36
|
+
const flags = {};
|
|
37
|
+
let copy = false;
|
|
38
|
+
for (const [name, c] of Object.entries(m.step.flags ?? {}))
|
|
39
|
+
flags[name] = c.op === 'all' ? same(x(`?${name}`), n(1)) : substC(c, { vars: {}, maps: {}, flags });
|
|
40
|
+
for (const [map, write] of Object.entries(m.step.maps ?? {})) {
|
|
41
|
+
if (!('each' in write))
|
|
42
|
+
continue;
|
|
43
|
+
walkLive(substE(write.value, { vars: {}, maps: {}, flags }), root, (o) => {
|
|
44
|
+
if (o.op !== 'get' || o.map !== map)
|
|
45
|
+
return;
|
|
46
|
+
walkOnce(o.key, (key) => { if (key.op === 'var' && key.name !== write.each && m.inputs.includes(key.name))
|
|
47
|
+
copy = true; });
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
return copy;
|
|
51
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type C } from '../machine.js';
|
|
2
|
+
import { type Goal, type Path, type Tree } from '../../kernel/kernel.js';
|
|
3
|
+
export declare function walkChoices(root: unknown, path: Path, visit: (value: any) => void): void;
|
|
4
|
+
export declare function booleanCandidates(g: Goal, root: Path, wits: Set<string>, extended?: boolean): {
|
|
5
|
+
c: C;
|
|
6
|
+
score: number;
|
|
7
|
+
}[];
|
|
8
|
+
export declare const booleanCore: typeof booleanCoreImpl;
|
|
9
|
+
declare function booleanCoreImpl(g: Goal, root: Path, wits: Set<string>, until: number, trace: object[], options?: {
|
|
10
|
+
model?: boolean;
|
|
11
|
+
folded?: boolean;
|
|
12
|
+
extended?: boolean;
|
|
13
|
+
scalarGuards?: boolean;
|
|
14
|
+
deferCheck?: boolean;
|
|
15
|
+
}): Tree | undefined;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
// Untrusted Boolean-core recipe: expose witness membership before unrelated
|
|
2
|
+
// conditional fields. Every terminal branch is an ordinary linear refutation.
|
|
3
|
+
import { same, walkOnce, x } from "../machine.js";
|
|
4
|
+
import { canon, columnTerm, facts, linear, truth } from "../../kernel/kernel.js";
|
|
5
|
+
import { scale, sub } from "../solver.js";
|
|
6
|
+
import { clock } from "../../kernel/prove.js";
|
|
7
|
+
import { walkLive } from "./live-dependencies.js";
|
|
8
|
+
import { foldPath } from "./fold-path.js";
|
|
9
|
+
import { closeKeyReads } from "./key-closure.js";
|
|
10
|
+
import { rebasePath } from "./rebase-path.js";
|
|
11
|
+
import { wallTree, check, refuteFast, grow, rowsAt } from "./ops.js";
|
|
12
|
+
// Unlike dependency slicing, proof-case discovery must still enter the
|
|
13
|
+
// operands of a comparison already forced true: its conditional columns
|
|
14
|
+
// can remain inconsistent until their own guards have been decided.
|
|
15
|
+
export function walkChoices(root, path, visit) {
|
|
16
|
+
const goals = new WeakSet(), conditions = new WeakSet();
|
|
17
|
+
const go = (value, condition = false) => {
|
|
18
|
+
const seen = condition ? conditions : goals;
|
|
19
|
+
if (!value || typeof value !== 'object' || seen.has(value))
|
|
20
|
+
return;
|
|
21
|
+
seen.add(value);
|
|
22
|
+
if (condition && ['not', 'and', 'or', '<', '<=', '='].includes(value.op) && truth(value, path) !== undefined)
|
|
23
|
+
return;
|
|
24
|
+
if (value.op === 'if') {
|
|
25
|
+
const chosen = truth(value.c, path);
|
|
26
|
+
if (chosen !== undefined) {
|
|
27
|
+
go(chosen ? value.then : value.else);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
visit(value);
|
|
31
|
+
go(value.c, true);
|
|
32
|
+
go(value.then);
|
|
33
|
+
go(value.else);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
visit(value);
|
|
37
|
+
for (const child of Array.isArray(value) ? value : Object.values(value))
|
|
38
|
+
go(child, condition);
|
|
39
|
+
};
|
|
40
|
+
go(root);
|
|
41
|
+
}
|
|
42
|
+
export function booleanCandidates(g, root, wits, extended = false) {
|
|
43
|
+
const walk = extended ? walkChoices : walkLive;
|
|
44
|
+
const chosen = new Map(), add = (c, score) => { if (truth(c, root) !== undefined)
|
|
45
|
+
return; const id = JSON.stringify(c), old = chosen.get(id); chosen.set(id, { c, score: score + (old?.score ?? 0) }); };
|
|
46
|
+
for (const h of g.hyps) {
|
|
47
|
+
let c = h;
|
|
48
|
+
while (c.op === 'not')
|
|
49
|
+
c = c.x;
|
|
50
|
+
if (c.op === '<' || c.op === '<=' || c.op === '=')
|
|
51
|
+
add(c, 1000);
|
|
52
|
+
}
|
|
53
|
+
walk(g.hyps, root, (o) => {
|
|
54
|
+
if (o.op === '=' && o.a.op === 'var' && o.b.op === 'var') {
|
|
55
|
+
const a = wits.has(o.a.name), b = wits.has(o.b.name);
|
|
56
|
+
if (!a && !b)
|
|
57
|
+
add(o, 10);
|
|
58
|
+
else if (a !== b)
|
|
59
|
+
add(o, 1500);
|
|
60
|
+
}
|
|
61
|
+
if ((o.op === '<' || o.op === '<=') && o.a.op === 'var' && o.b.op === 'var' && o.a.name !== o.b.name && !wits.has(o.a.name) && !wits.has(o.b.name))
|
|
62
|
+
add(o, extended ? 1400 : 750);
|
|
63
|
+
if (extended && ['<', '<=', '='].includes(o.op)) {
|
|
64
|
+
let left = false, right = false, witness = false;
|
|
65
|
+
walkLive(o.a, root, (e) => { if (e.op === 'get')
|
|
66
|
+
left = true; if (e.op === 'var' && wits.has(e.name))
|
|
67
|
+
witness = true; });
|
|
68
|
+
walkLive(o.b, root, (e) => { if (e.op === 'get')
|
|
69
|
+
right = true; if (e.op === 'var' && wits.has(e.name))
|
|
70
|
+
witness = true; });
|
|
71
|
+
if (left && right && witness)
|
|
72
|
+
add(o, 1000);
|
|
73
|
+
}
|
|
74
|
+
if (!['=', '<='].includes(o.op))
|
|
75
|
+
return;
|
|
76
|
+
// A lowered Boolean map write is still one membership predicate. Prefer
|
|
77
|
+
// its shared 0/1 value over independently splitting every internal guard.
|
|
78
|
+
const value = o.op === '=' && o.b.op === 'const' && o.b.value === 1 ? o.a : o.op === '<=' && o.a.op === 'const' && o.a.value === 1 ? o.b : undefined;
|
|
79
|
+
if (extended && value?.op === 'if' && value.then.op === 'const' && value.then.value === 1 && value.else.op === 'const' && value.else.value === 0) {
|
|
80
|
+
let hit = false;
|
|
81
|
+
walkOnce(value, (e) => { if (e.op === 'var' && wits.has(e.name))
|
|
82
|
+
hit = true; });
|
|
83
|
+
if (hit)
|
|
84
|
+
add(o, 1800);
|
|
85
|
+
}
|
|
86
|
+
const cell = o.op === '=' && o.a.op === 'get' && o.b.op === 'const' && o.b.value === 1 ? o.a : o.op === '<=' && o.a.op === 'const' && o.a.value === 1 && o.b.op === 'get' ? o.b : undefined;
|
|
87
|
+
if (!cell)
|
|
88
|
+
return;
|
|
89
|
+
let hit = false;
|
|
90
|
+
walkOnce(cell.key, (x) => { if (x.op === 'var' && wits.has(x.name))
|
|
91
|
+
hit = true; });
|
|
92
|
+
if (hit)
|
|
93
|
+
add(o, extended ? 1200 : o.op === '<=' ? 100 : 50);
|
|
94
|
+
});
|
|
95
|
+
// Equal witness keys are useful before splitting the two cells' values.
|
|
96
|
+
// Their equality is only a proposal: both key-order branches still check.
|
|
97
|
+
const cells = new Map();
|
|
98
|
+
walk(g.hyps, root, (o) => { if (o.op === 'get' && linear(o.key, root)) {
|
|
99
|
+
const xs = cells.get(o.map) ?? [];
|
|
100
|
+
if (!xs.some(k => JSON.stringify(k) === JSON.stringify(o.key)))
|
|
101
|
+
xs.push(o.key);
|
|
102
|
+
cells.set(o.map, xs);
|
|
103
|
+
} });
|
|
104
|
+
const mentions = (key) => { const out = new Set(); walkOnce(key, (o) => { if (o.op === 'var' && wits.has(o.name))
|
|
105
|
+
out.add(o.name); }); return out; };
|
|
106
|
+
for (const keys of cells.values())
|
|
107
|
+
for (let i = 0; i < keys.length; i++)
|
|
108
|
+
for (let j = i + 1; j < keys.length; j++) {
|
|
109
|
+
const a = keys[i], b = keys[j], wanted = mentions(a);
|
|
110
|
+
if ([...mentions(b)].some(w => wanted.has(w)))
|
|
111
|
+
add(same(a, b), 500);
|
|
112
|
+
}
|
|
113
|
+
return [...chosen.values()];
|
|
114
|
+
}
|
|
115
|
+
export const booleanCore = (...args) => wallTree('tree-reconstruction', () => booleanCoreImpl(...args));
|
|
116
|
+
function booleanCoreImpl(g, root, wits, until, trace, options = {}) {
|
|
117
|
+
const start = clock(), scalarGuards = options.scalarGuards ?? false, extended = options.extended ?? false;
|
|
118
|
+
// Lift the goal's own forced linear facts into the path, with a checked
|
|
119
|
+
// opposite branch for every cut. They need not consume the Boolean pool.
|
|
120
|
+
let pinned = new Map(root);
|
|
121
|
+
const prefix = [];
|
|
122
|
+
const pin = (split) => {
|
|
123
|
+
const id = canon(split);
|
|
124
|
+
if (pinned.get(id)?.holds === true)
|
|
125
|
+
return true;
|
|
126
|
+
if (clock() >= until)
|
|
127
|
+
return false;
|
|
128
|
+
const other = new Map(pinned).set(id, { lin: split, holds: false }), out = refuteFast(rowsAt(g, other), 256);
|
|
129
|
+
const no = out?.kind === 'refuted' ? { leaf: out.steps } : undefined;
|
|
130
|
+
if (!no || (!options.deferCheck && !check(g, no, other)))
|
|
131
|
+
return false;
|
|
132
|
+
prefix.push({ split, no });
|
|
133
|
+
pinned = new Map(pinned).set(id, { lin: split, holds: true });
|
|
134
|
+
return true;
|
|
135
|
+
};
|
|
136
|
+
for (let round = 0; round < 2 && clock() < until; round++)
|
|
137
|
+
for (const h of g.hyps)
|
|
138
|
+
for (const split of facts(h, pinned))
|
|
139
|
+
pin(split);
|
|
140
|
+
// Witness bounds and inactive scalar selectors can follow from the path
|
|
141
|
+
// without appearing as literal decisions. Prove these arithmetic guards
|
|
142
|
+
// before discovering candidates, so dead updates cannot crowd the pool.
|
|
143
|
+
const guards = new Map(), walk = scalarGuards ? walkChoices : walkLive;
|
|
144
|
+
walk(g.hyps, root, (o) => {
|
|
145
|
+
if (o.op === 'if')
|
|
146
|
+
walkOnce(o.c, (c) => {
|
|
147
|
+
if (!['<', '<=', '='].includes(c.op))
|
|
148
|
+
return;
|
|
149
|
+
let witness = false, plain = true;
|
|
150
|
+
walkOnce(c, (e) => { if (e.op === 'var' && wits.has(e.name))
|
|
151
|
+
witness = true; if (['get', 'if', 'sub', 'min', 'max', 'prod', 'tup', 'proj'].includes(e.op))
|
|
152
|
+
plain = false; });
|
|
153
|
+
if (plain && (scalarGuards || witness))
|
|
154
|
+
guards.set(JSON.stringify(c), c);
|
|
155
|
+
});
|
|
156
|
+
});
|
|
157
|
+
for (const c of guards.values())
|
|
158
|
+
for (const split of facts(c, pinned)) {
|
|
159
|
+
if (scalarGuards && truth(c, pinned) !== undefined)
|
|
160
|
+
break;
|
|
161
|
+
if (!pin(split)) {
|
|
162
|
+
const inverse = scale(split, -1);
|
|
163
|
+
inverse['1'] = (inverse['1'] ?? 0) + 1;
|
|
164
|
+
pin(inverse);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
const candidates = booleanCandidates(g, scalarGuards ? pinned : root, wits, extended).filter(({ c }) => truth(c, pinned) === undefined);
|
|
168
|
+
const selected = candidates.sort((a, b) => b.score - a.score).slice(0, 8), slots = [];
|
|
169
|
+
const expand = (c) => c.op === '=' ? [{ op: '<=', a: c.a, b: c.b }, { op: '<=', a: c.b, b: c.a }] : [c];
|
|
170
|
+
const cs = selected.flatMap(({ c }, slot) => { const parts = expand(c); slots.push(...parts.map(() => slot)); return parts; });
|
|
171
|
+
let nodes = 0, leaves = 0, last;
|
|
172
|
+
const go = (i, path, keysClosed = false, plan = cs) => {
|
|
173
|
+
if (clock() >= until)
|
|
174
|
+
return undefined;
|
|
175
|
+
nodes++;
|
|
176
|
+
const out = refuteFast(rowsAt(g, path), 1000);
|
|
177
|
+
if (out?.kind === 'refuted')
|
|
178
|
+
return { leaf: out.steps };
|
|
179
|
+
if (i === plan.length) {
|
|
180
|
+
leaves++;
|
|
181
|
+
const out = grow(g, path, { nodes: 0, until, units: true });
|
|
182
|
+
if ('tree' in out)
|
|
183
|
+
return out.tree;
|
|
184
|
+
last ??= { path: [...path], outcome: out.stuck, ...(options.model && 'witness' in out ? { model: out.witness, columns: Object.fromEntries(Object.keys(out.witness ?? {}).filter(name => name.startsWith('⟦')).slice(0, 8).map(name => [name, columnTerm(name)])) } : {}) };
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
if (extended && !keysClosed) {
|
|
188
|
+
let field = false;
|
|
189
|
+
walkOnce(plan[i], (o) => { if (o.op === 'get')
|
|
190
|
+
field = true; });
|
|
191
|
+
if (field) {
|
|
192
|
+
const reads = [];
|
|
193
|
+
walkChoices(g.hyps, path, (o) => { if (o.op === 'get')
|
|
194
|
+
reads.push({ map: o.map, key: o.key }); });
|
|
195
|
+
const begun = clock(), closed = closeKeyReads(g, path, reads, wits, until);
|
|
196
|
+
// Refresh only the unspent choice slots. Fold expression operands, not
|
|
197
|
+
// whole forced hypotheses, so their indicator structure stays visible.
|
|
198
|
+
const folded = new WeakMap(), fold = (e) => {
|
|
199
|
+
const found = folded.get(e);
|
|
200
|
+
if (found)
|
|
201
|
+
return found;
|
|
202
|
+
const out = foldPath({ name: 'candidate operand', hyps: [same(e, x('boolean$probe'))] }, closed.path).goal.hyps[0];
|
|
203
|
+
const result = out?.op === '=' ? out.a : e;
|
|
204
|
+
folded.set(e, result);
|
|
205
|
+
return result;
|
|
206
|
+
};
|
|
207
|
+
const fresh = new Map();
|
|
208
|
+
for (const candidate of booleanCandidates(g, closed.path, wits, true)) {
|
|
209
|
+
const c = candidate.c, normalized = c.op === '<' || c.op === '<=' || c.op === '=' ? { ...c, a: fold(c.a), b: fold(c.b) } : c;
|
|
210
|
+
if (truth(normalized, closed.path) !== undefined)
|
|
211
|
+
continue;
|
|
212
|
+
const id = JSON.stringify(normalized), old = fresh.get(id);
|
|
213
|
+
fresh.set(id, { c: normalized, score: Math.max(old?.score ?? 0, candidate.score) });
|
|
214
|
+
}
|
|
215
|
+
const remaining = Math.max(0, 8 - (slots[i] ?? 8)), refreshed = [...fresh.values()].sort((a, b) => b.score - a.score).slice(0, remaining).flatMap(({ c }) => expand(c));
|
|
216
|
+
let tree = go(0, closed.path, true, refreshed);
|
|
217
|
+
if (tree)
|
|
218
|
+
for (const cut of [...closed.cuts].reverse())
|
|
219
|
+
tree = { split: cut.split, yes: tree, no: cut.no };
|
|
220
|
+
trace.push({ stage: 'key-closure', facts: closed.cuts.length, ms: Math.round(clock() - begun), proposed: !!tree });
|
|
221
|
+
return tree;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
const c = plan[i], known = truth(c, path);
|
|
225
|
+
if (known !== undefined)
|
|
226
|
+
return go(i + 1, path, keysClosed, plan);
|
|
227
|
+
if (c.op !== '<' && c.op !== '<=')
|
|
228
|
+
return undefined;
|
|
229
|
+
const a = linear(c.a, path), b = linear(c.b, path);
|
|
230
|
+
if (!a || !b)
|
|
231
|
+
return undefined;
|
|
232
|
+
const split = sub(a, b);
|
|
233
|
+
if (c.op === '<')
|
|
234
|
+
split['1'] = (split['1'] ?? 0) + 1;
|
|
235
|
+
const id = canon(split), yes = go(i + 1, new Map(path).set(id, { lin: split, holds: true }), keysClosed, plan), no = yes && go(i + 1, new Map(path).set(id, { lin: split, holds: false }), keysClosed, plan);
|
|
236
|
+
return yes && no ? { split, yes, no } : undefined;
|
|
237
|
+
};
|
|
238
|
+
let tree = go(0, pinned);
|
|
239
|
+
if (tree) {
|
|
240
|
+
const paths = [new Map(root)];
|
|
241
|
+
for (const p of prefix)
|
|
242
|
+
paths.push(new Map(paths.at(-1)).set(canon(p.split), { lin: p.split, holds: true }));
|
|
243
|
+
let removed = 0;
|
|
244
|
+
for (let i = prefix.length - 1; i >= 0; i--) {
|
|
245
|
+
const p = prefix[i], shorter = rebasePath(g, tree, paths[i + 1], paths[i], until);
|
|
246
|
+
if (shorter) {
|
|
247
|
+
tree = shorter;
|
|
248
|
+
removed++;
|
|
249
|
+
}
|
|
250
|
+
else
|
|
251
|
+
tree = { split: p.split, yes: tree, no: p.no };
|
|
252
|
+
}
|
|
253
|
+
trace.push({ stage: 'pin-prune', removed, kept: prefix.length - removed });
|
|
254
|
+
}
|
|
255
|
+
const accepted = !!tree && (options.deferCheck || check(g, tree, root)), checked = accepted && !options.deferCheck;
|
|
256
|
+
trace.push({ stage: 'boolean-core', facts: prefix.length, cuts: cs.length, nodes, leaves, ms: Math.round(clock() - start), checked, proposed: !!tree, deferred: !!options.deferCheck, ...(options.model ? { choices: cs.map(c => ({ op: c.op, ...('a' in c ? { a: JSON.stringify(c.a).slice(0, 180), b: JSON.stringify(c.b).slice(0, 180) } : {}) })) } : {}), ...(last ? { last } : {}) });
|
|
257
|
+
return accepted ? tree : undefined;
|
|
258
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Untrusted first split for a small count core: carried membership at the
|
|
2
|
+
// certificate's witness, before branching through large post-state terms.
|
|
3
|
+
import { n } from "../machine.js";
|
|
4
|
+
import { canon, linear, truth } from "../../kernel/kernel.js";
|
|
5
|
+
import { sub } from "../solver.js";
|
|
6
|
+
import { clock } from "../../kernel/prove.js";
|
|
7
|
+
import { walkLive } from "./live-dependencies.js";
|
|
8
|
+
import { check, grow } from "./ops.js";
|
|
9
|
+
export function carriedCase(g, root, maps, wits, until, trace) {
|
|
10
|
+
let cell;
|
|
11
|
+
walkLive(g.hyps, root, (o) => { if (!cell && o.op === 'get' && maps.includes(o.map) && o.key.op === 'var' && wits.has(o.key.name) && truth({ op: '<=', a: n(1), b: o }, root) === undefined)
|
|
12
|
+
cell = o; });
|
|
13
|
+
if (!cell)
|
|
14
|
+
return undefined;
|
|
15
|
+
const value = linear(cell, root);
|
|
16
|
+
if (!value)
|
|
17
|
+
return undefined;
|
|
18
|
+
const split = sub({ '1': 1 }, value), id = canon(split), started = clock();
|
|
19
|
+
const noPath = new Map(root).set(id, { lin: split, holds: false }), no = grow(g, noPath, { nodes: 0, until, units: true });
|
|
20
|
+
const yesPath = new Map(root).set(id, { lin: split, holds: true }), yes = 'tree' in no && clock() < until ? grow(g, yesPath, { nodes: 0, until, units: true }) : undefined;
|
|
21
|
+
const tree = 'tree' in no && yes && 'tree' in yes ? { split, yes: yes.tree, no: no.tree } : undefined, checked = !!tree && check(g, tree, root);
|
|
22
|
+
trace.push({ stage: 'carried-core', cell, ms: Math.round(clock() - started), no: 'tree' in no, yes: !!yes && 'tree' in yes, checked });
|
|
23
|
+
return checked ? tree : undefined;
|
|
24
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Goal, type LemmaCut, type Path, type Tree } from '../../kernel/kernel.js';
|
|
2
|
+
declare const stats: {
|
|
3
|
+
leafChecks: number;
|
|
4
|
+
leafHits: number;
|
|
5
|
+
leafFallbacks: number;
|
|
6
|
+
fullHyps: number;
|
|
7
|
+
sliceHyps: number;
|
|
8
|
+
independentChecks: number;
|
|
9
|
+
independentHits: number;
|
|
10
|
+
retargetChecks: number;
|
|
11
|
+
retargetHits: number;
|
|
12
|
+
};
|
|
13
|
+
export declare const conditionalProofStats: () => Readonly<typeof stats>;
|
|
14
|
+
/** Keep exactly the hypotheses cited by base/product inputs, then relocate all
|
|
15
|
+
* inputs including square/product offsets. The unchanged kernel checks the
|
|
16
|
+
* sliced literal certificate; malformed and unused products are not dropped. */
|
|
17
|
+
export declare function slicedCheck(goal: Goal, tree: Tree, path: Path): boolean;
|
|
18
|
+
export declare function independentHit(goal: Goal, lemma: LemmaCut): boolean;
|
|
19
|
+
export declare function rememberIndependent(goal: Goal, lemma: LemmaCut): void;
|
|
20
|
+
export declare function retargetHit(lemma: LemmaCut, key: string): LemmaCut | undefined;
|
|
21
|
+
export declare function rememberRetarget(lemma: LemmaCut, key: string, result: LemmaCut): void;
|
|
22
|
+
export declare function targetIndex(goal: Goal, until: number): Map<string, number> | undefined;
|
|
23
|
+
export {};
|