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,68 @@
|
|
|
1
|
+
// A proposal selector only. Matching syntax proves no invariant and adds no premise.
|
|
2
|
+
import { walkOnce } from "./machine.js";
|
|
3
|
+
const atoms = (c) => c.op === 'and' ? c.xs.flatMap(atoms) : [c];
|
|
4
|
+
const variable = (e, name) => e.op === 'var' && e.name === name;
|
|
5
|
+
function packed(e, row, column) {
|
|
6
|
+
if (e.op !== 'add')
|
|
7
|
+
return;
|
|
8
|
+
const [a, b] = e.a.op === 'mul' ? [e.a, e.b] : [e.b, e.a];
|
|
9
|
+
if (a.op === 'mul' && variable(a.a, row) && variable(b, column) && Number.isSafeInteger(a.k) && a.k > 0)
|
|
10
|
+
return a.k;
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
export function discoverRowAgreement(m, law) {
|
|
14
|
+
if (!law.forall || law.keys?.length !== 2 || law.holds.op !== 'or' || law.holds.xs.length !== 2)
|
|
15
|
+
return;
|
|
16
|
+
const [left, right, column] = [law.forall, law.keys[0], law.keys[1]];
|
|
17
|
+
if (new Set([left, right, column]).size !== 3)
|
|
18
|
+
return;
|
|
19
|
+
const negated = law.holds.xs.find(c => c.op === 'not'), conclusion = law.holds.xs.find(c => c.op === '=');
|
|
20
|
+
if (negated?.op !== 'not' || conclusion?.op !== '=' || conclusion.a.op !== 'get' || conclusion.b.op !== 'get')
|
|
21
|
+
return;
|
|
22
|
+
const a = conclusion.a, b = conclusion.b, width = packed(a.key, left, column);
|
|
23
|
+
if (!width || packed(b.key, right, column) !== width || a.map !== b.map || !(a.map in (m.maps ?? {})) || m.counts?.[a.map])
|
|
24
|
+
return;
|
|
25
|
+
const fields = new Set(), marked = new Map();
|
|
26
|
+
for (const c of atoms(negated.x)) {
|
|
27
|
+
if (c.op !== '=')
|
|
28
|
+
continue;
|
|
29
|
+
const [x, y] = c.a.op === 'get' ? [c.a, c.b] : [c.b, c.a];
|
|
30
|
+
if (x.op !== 'get')
|
|
31
|
+
continue;
|
|
32
|
+
if (y.op === 'get' && x.map === y.map && (variable(x.key, left) && variable(y.key, right) || variable(x.key, right) && variable(y.key, left)))
|
|
33
|
+
fields.add(x.map);
|
|
34
|
+
if (y.op === 'const' && Number.isSafeInteger(y.value) && (variable(x.key, left) || variable(x.key, right))) {
|
|
35
|
+
const byRow = marked.get(x.map) ?? new Map();
|
|
36
|
+
byRow.set(x.key.op === 'var' ? x.key.name : '', y.value);
|
|
37
|
+
marked.set(x.map, byRow);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (!fields.size || [...fields].some(f => m.counts?.[f] || !(f in (m.maps ?? {}))))
|
|
41
|
+
return;
|
|
42
|
+
const markers = [...marked].flatMap(([map, rows]) => rows.has(left) && rows.get(left) === rows.get(right) ? [{ map, value: rows.get(left) }] : []);
|
|
43
|
+
let supported = true;
|
|
44
|
+
walkOnce(negated.x, (node) => { if (node.op === 'get' && !fields.has(node.map) && !markers.some(marker => marker.map === node.map))
|
|
45
|
+
supported = false; });
|
|
46
|
+
if (!supported)
|
|
47
|
+
return;
|
|
48
|
+
// A versioned row's fields move with a row copy. This deliberately excludes
|
|
49
|
+
// lookalike pairs containing a field updated only by an unrelated action.
|
|
50
|
+
const rowFlags = new Set();
|
|
51
|
+
walkOnce(m.step.maps?.[a.map], (node) => { if (node.op === 'flag')
|
|
52
|
+
rowFlags.add(node.name); });
|
|
53
|
+
let shared = rowFlags;
|
|
54
|
+
for (const field of fields) {
|
|
55
|
+
const copied = new Set();
|
|
56
|
+
walkOnce(m.step.maps?.[field], (node) => {
|
|
57
|
+
if (node.op !== 'if' || node.then.op !== 'get' || node.then.map !== field || node.then.key.op !== 'var' || !m.inputs.includes(node.then.key.name))
|
|
58
|
+
return;
|
|
59
|
+
for (const c of atoms(node.c))
|
|
60
|
+
if (c.op === 'flag')
|
|
61
|
+
copied.add(c.name);
|
|
62
|
+
});
|
|
63
|
+
shared = new Set([...shared].filter(flag => copied.has(flag)));
|
|
64
|
+
}
|
|
65
|
+
if (!shared.size)
|
|
66
|
+
return;
|
|
67
|
+
return { map: a.map, width, left, right, column, fields: [...fields].sort(), markers: markers.sort((a, b) => a.map.localeCompare(b.map)), guard: negated.x };
|
|
68
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Machine, type Request, type State } from './machine.js';
|
|
2
|
+
type Env = Record<string, number>;
|
|
3
|
+
export declare function sampleStep(m: Machine, run?: {
|
|
4
|
+
init: (params: {
|
|
5
|
+
[x: string]: number;
|
|
6
|
+
}) => State;
|
|
7
|
+
queries: (params: {
|
|
8
|
+
[x: string]: number;
|
|
9
|
+
}, st: State, input: Request) => {
|
|
10
|
+
[x: string]: number;
|
|
11
|
+
};
|
|
12
|
+
step: (params: {
|
|
13
|
+
[x: string]: number;
|
|
14
|
+
}, given: State, input: Request) => State;
|
|
15
|
+
}): (params: Env, st: State, input: Request) => State | undefined;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// Hot random walks reuse the existing persistent compiled step. No request,
|
|
2
|
+
// random draw, sample order or work counter is skipped. Cold/unsupported machines
|
|
3
|
+
// keep the interpreter. A refused request returns undefined; other errors retain
|
|
4
|
+
// the interpreter's exception behavior (the sampler ends that trial).
|
|
5
|
+
import { carriedView, compileC, fastStep, interpret, numbersOf } from "./machine.js";
|
|
6
|
+
import { allowed } from "./watch.js";
|
|
7
|
+
export function sampleStep(m, run = interpret(m)) {
|
|
8
|
+
let calls = 0, step = run.step;
|
|
9
|
+
let accepts = (params, st, input) => allowed(m, run, params, st, input);
|
|
10
|
+
return (params, st, input) => {
|
|
11
|
+
if (++calls === 1000) {
|
|
12
|
+
const fast = fastStep(m);
|
|
13
|
+
if (fast) {
|
|
14
|
+
step = fast;
|
|
15
|
+
const flags = Object.entries(m.step.flags ?? {}).map(([name, c]) => [name, compileC(c, m)]);
|
|
16
|
+
const assume = m.assume && compileC(m.assume, m);
|
|
17
|
+
accepts = !assume ? () => true : (params, st, input) => {
|
|
18
|
+
const env = { ...params, ...numbersOf(input), ...run.queries(params, st, input) };
|
|
19
|
+
const view = carriedView(m, st, input, undefined, params);
|
|
20
|
+
for (const [name, f] of flags)
|
|
21
|
+
env[`?${name}`] = f(env, view) ? 1 : 0;
|
|
22
|
+
return assume(env, view);
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return accepts(params, st, input) ? step(params, st, input) : undefined;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type ProxySearchState = {
|
|
2
|
+
rate: number;
|
|
3
|
+
model: boolean;
|
|
4
|
+
deadline: number;
|
|
5
|
+
deadlineEpr: number;
|
|
6
|
+
workCap: number;
|
|
7
|
+
wallEnd: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const proxySearchState: () => ProxySearchState | undefined;
|
|
10
|
+
export declare const inProxySearch: () => boolean;
|
|
11
|
+
export declare function projectedSearchWork(): number;
|
|
12
|
+
export declare function withPlainSearchPolicy<T>(hasCounts: boolean, run: () => T): T;
|
|
13
|
+
export declare function withPublicSearchPolicy<T>(hasCounts: boolean, run: () => T): T;
|
|
14
|
+
export declare function canUseCountedProxy(): boolean;
|
|
15
|
+
export declare function withCountedSearchPolicy<T>(rejecting: boolean, run: () => T): T;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// Search policy is not work accounting. The projection is a new deterministic
|
|
2
|
+
// heuristic, not a replay of the legacy clock (whose charges and wall differed).
|
|
3
|
+
import { completeWorkProfile } from "./work-profile.js";
|
|
4
|
+
import { workLedger } from "./work-admission.js";
|
|
5
|
+
import { legacyWeights } from "./work-kinds.js";
|
|
6
|
+
let policy;
|
|
7
|
+
export const proxySearchState = () => policy?.kind === 'proxy' ? policy.state : undefined;
|
|
8
|
+
export const inProxySearch = () => policy?.kind === 'proxy';
|
|
9
|
+
// No extra counter, weight, charge, grant, lease or root. Preserve declared order.
|
|
10
|
+
export function projectedSearchWork() {
|
|
11
|
+
let n = 0;
|
|
12
|
+
for (const [key, weight] of legacyWeights)
|
|
13
|
+
n += weight * Number(workLedger.counter(key));
|
|
14
|
+
return n;
|
|
15
|
+
}
|
|
16
|
+
// Public proveRule owns the selection, using its existing actual-machine test.
|
|
17
|
+
// A native parent locks its entire call tree, including nested plain public calls.
|
|
18
|
+
// A native public child of a proxy temporarily suspends it; proxy state is separate
|
|
19
|
+
// from all legacy/native control state and resumes only after that child exits.
|
|
20
|
+
export function withPlainSearchPolicy(hasCounts, run) {
|
|
21
|
+
if (!completeWorkProfile.enabled || !workLedger.inBudget() || policy?.kind === 'native'
|
|
22
|
+
|| policy?.kind === 'proxy' && !hasCounts)
|
|
23
|
+
return run();
|
|
24
|
+
const previous = policy;
|
|
25
|
+
policy = hasCounts ? { kind: 'native', locked: true } : { kind: 'proxy', state: {
|
|
26
|
+
rate: 0, model: false, deadline: Infinity, deadlineEpr: 0, workCap: Infinity, wallEnd: Infinity,
|
|
27
|
+
} };
|
|
28
|
+
try {
|
|
29
|
+
return run();
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
policy = previous;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// A public counted call defers its policy choice until searchCounted knows the
|
|
36
|
+
// branch. Explicit native scopes and rejecting ancestors remain locked.
|
|
37
|
+
export function withPublicSearchPolicy(hasCounts, run) {
|
|
38
|
+
if (!hasCounts)
|
|
39
|
+
return withPlainSearchPolicy(false, run);
|
|
40
|
+
if (!completeWorkProfile.enabled || !workLedger.inBudget() || policy?.kind === 'native' && policy.locked !== false)
|
|
41
|
+
return run();
|
|
42
|
+
const previous = policy;
|
|
43
|
+
policy = { kind: 'native', locked: false };
|
|
44
|
+
try {
|
|
45
|
+
return run();
|
|
46
|
+
}
|
|
47
|
+
finally {
|
|
48
|
+
policy = previous;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
export function canUseCountedProxy() {
|
|
52
|
+
return completeWorkProfile.enabled && workLedger.inBudget() && !(policy?.kind === 'native' && policy.locked !== false);
|
|
53
|
+
}
|
|
54
|
+
// Only the counted branch selector may relax an unresolved native policy.
|
|
55
|
+
export function withCountedSearchPolicy(rejecting, run) {
|
|
56
|
+
if (!completeWorkProfile.enabled || !workLedger.inBudget() || policy?.kind === 'native' && policy.locked !== false)
|
|
57
|
+
return run();
|
|
58
|
+
if (!rejecting && policy?.kind === 'proxy')
|
|
59
|
+
return run();
|
|
60
|
+
const previous = policy;
|
|
61
|
+
policy = rejecting ? { kind: 'native', locked: true } : { kind: 'proxy', state: { rate: 0, model: false, deadline: Infinity, deadlineEpr: 0, workCap: Infinity, wallEnd: Infinity } };
|
|
62
|
+
try {
|
|
63
|
+
return run();
|
|
64
|
+
}
|
|
65
|
+
finally {
|
|
66
|
+
policy = previous;
|
|
67
|
+
}
|
|
68
|
+
}
|
package/dist/core/solver.d.ts
CHANGED
|
@@ -87,7 +87,7 @@ export declare const costs: {
|
|
|
87
87
|
goalNodes: number;
|
|
88
88
|
translateRows: number;
|
|
89
89
|
};
|
|
90
|
-
export declare function solve(constraints: Constraint[], maxRows?: number, integral?: boolean): Verdict;
|
|
90
|
+
export declare function solve(constraints: Constraint[], maxRows?: number, integral?: boolean, more?: () => boolean): Verdict;
|
|
91
91
|
export declare const ratioRow: (T: Float64Array[], basis: number[], enter: number, cols: number, eps: number) => [number, number];
|
|
92
92
|
export declare function pivot(T: Float64Array[], z: Float64Array | undefined, basis: number[], leave: number, enter: number, cols: number): void;
|
|
93
93
|
export declare function refuteFast(constraints: Constraint[], maxRows?: number, integral?: boolean): Verdict | undefined;
|
package/dist/core/solver.js
CHANGED
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
// row is strict), so the answer is refuted or sat, the witness exact (`rational`), the derivation one check.ts takes
|
|
12
12
|
// with no cut: the integers are this with the cut rule, and a strict row over them is lin + 1 <= 0.
|
|
13
13
|
import { Q0, Q1, q, qadd, qcmp, qdiv, qneg, qnum, qrow, qsub } from "./q.js";
|
|
14
|
+
import { startWork, workCounterView } from "./work-admission.js";
|
|
15
|
+
import { completeWorkProfile } from "./work-profile.js";
|
|
14
16
|
// The process's environment (the switches and traces the searches read), empty where there is none.
|
|
15
17
|
export const env = globalThis.process?.env ?? {};
|
|
16
18
|
export const v = (name) => ({ [name]: 1 });
|
|
@@ -104,12 +106,19 @@ export const canon = (l) => JSON.stringify(Object.keys(l).sort().map(x => [x, l[
|
|
|
104
106
|
// The rows the solver has read and made, which a counted search reads as its clock (kernel/prove.ts's `counted`).
|
|
105
107
|
export const work = { n: 0 };
|
|
106
108
|
// What the searches did, by kind, beside work.n (research/query reads them: the cost of each query's parts).
|
|
107
|
-
export const costs = { solves: 0, solveRows: 0, fm: 0, fpivots: 0, fcells: 0, cdclNodes: 0, cdclRows: 0, scan: 0, pivots: 0, pivotRows: 0, plainNodes: 0, plainRows: 0,
|
|
108
|
-
values: 0, copies: 0, edges: 0, unitRows: 0, unfoldRows: 0, goalNodes: 0, translateRows: 0 }
|
|
109
|
-
|
|
109
|
+
export const costs = workCounterView({ solves: 0, solveRows: 0, fm: 0, fpivots: 0, fcells: 0, cdclNodes: 0, cdclRows: 0, scan: 0, pivots: 0, pivotRows: 0, plainNodes: 0, plainRows: 0,
|
|
110
|
+
values: 0, copies: 0, edges: 0, unitRows: 0, unfoldRows: 0, goalNodes: 0, translateRows: 0 }, { fm: 'fm', fcells: 'fcells', cdclNodes: 'cdclNodes', scan: 'scan', pivotRows: 'pivotRows', plainRows: 'plainRows',
|
|
111
|
+
values: 'values', copies: 'copies', edges: 'edges', unitRows: 'unitRows', unfoldRows: 'unfoldRows', goalNodes: 'goalNodes', translateRows: 'translateRows' });
|
|
112
|
+
// `more` is opt-in. Normal callers retain the exact charge/order path; bounded
|
|
113
|
+
// callers may stop before an elimination round or between generated rows.
|
|
114
|
+
export function solve(constraints, maxRows = 20_000, integral = true, more) {
|
|
115
|
+
if (more && !more())
|
|
116
|
+
return { kind: 'unknown' };
|
|
110
117
|
work.n += constraints.length;
|
|
111
118
|
costs.solves++;
|
|
112
119
|
costs.solveRows += constraints.length;
|
|
120
|
+
if (more && !more())
|
|
121
|
+
return { kind: 'unknown' };
|
|
113
122
|
const steps = [];
|
|
114
123
|
const lins = [], stricts = [];
|
|
115
124
|
const push = (step, lin, strict = false) => (steps.push(step), lins.push(lin), stricts.push(strict), lins.length - 1);
|
|
@@ -154,6 +163,8 @@ export function solve(constraints, maxRows = 20_000, integral = true) {
|
|
|
154
163
|
const keys = [], negKeys = [];
|
|
155
164
|
const key = (r) => (keys[r] ??= keyOf(lins[r])), negKey = (r) => (negKeys[r] ??= keyOf(scale(lins[r], -1)));
|
|
156
165
|
for (let changed = true; changed && contradiction() === undefined;) {
|
|
166
|
+
if (more && !more())
|
|
167
|
+
return { kind: 'unknown' };
|
|
157
168
|
changed = false;
|
|
158
169
|
const byKey = new Map(rows.map(r => [key(r), r]));
|
|
159
170
|
for (const r of rows) {
|
|
@@ -201,6 +212,8 @@ export function solve(constraints, maxRows = 20_000, integral = true) {
|
|
|
201
212
|
return sig;
|
|
202
213
|
};
|
|
203
214
|
for (let found = contradiction(); found === undefined; found = contradiction()) {
|
|
215
|
+
if (more && !more())
|
|
216
|
+
return { kind: 'unknown' };
|
|
204
217
|
// Each variable's rows by sign, in one pass (variables in the order they first appear).
|
|
205
218
|
const index = new Map();
|
|
206
219
|
for (const r of rows)
|
|
@@ -233,13 +246,25 @@ export function solve(constraints, maxRows = 20_000, integral = true) {
|
|
|
233
246
|
break;
|
|
234
247
|
if (choice.pos.length * choice.neg.length > 5 * maxRows)
|
|
235
248
|
return { kind: 'unknown' };
|
|
236
|
-
|
|
237
|
-
|
|
249
|
+
if (!more) {
|
|
250
|
+
work.n += choice.pos.length * choice.neg.length;
|
|
251
|
+
if (!completeWorkProfile.enabled)
|
|
252
|
+
costs.fm += choice.pos.length * choice.neg.length;
|
|
253
|
+
}
|
|
238
254
|
exact &&= choice.isExact;
|
|
239
255
|
eliminated.push({ x: choice.x, rows: [...choice.pos, ...choice.neg] });
|
|
240
256
|
const next = rows.filter(r => (lins[r][choice.x] ?? 0) === 0);
|
|
241
257
|
for (const p of choice.pos)
|
|
242
258
|
for (const n of choice.neg) {
|
|
259
|
+
if (more && !more())
|
|
260
|
+
return { kind: 'unknown' };
|
|
261
|
+
if (completeWorkProfile.enabled)
|
|
262
|
+
startWork('fm', 1, 'Fourier-Motzkin pair');
|
|
263
|
+
if (more) {
|
|
264
|
+
work.n++;
|
|
265
|
+
if (!completeWorkProfile.enabled)
|
|
266
|
+
costs.fm++;
|
|
267
|
+
}
|
|
243
268
|
const a = lins[p][choice.x], b = -lins[n][choice.x];
|
|
244
269
|
const combined = pushExact({ kind: 'combine', a: p, b: n, ma: b / gcd(a, b), mb: a / gcd(a, b) }, add(scale(lins[p], b / gcd(a, b)), scale(lins[n], a / gcd(a, b))), stricts[p] || stricts[n]);
|
|
245
270
|
next.push(tighten(combined));
|
|
@@ -259,6 +284,8 @@ export function solve(constraints, maxRows = 20_000, integral = true) {
|
|
|
259
284
|
if (rows.length > maxRows || inexact)
|
|
260
285
|
return { kind: 'unknown' };
|
|
261
286
|
}
|
|
287
|
+
if (more && !more())
|
|
288
|
+
return { kind: 'unknown' };
|
|
262
289
|
const found = contradiction();
|
|
263
290
|
if (found !== undefined)
|
|
264
291
|
return inexact ? { kind: 'unknown' } : { kind: 'refuted', steps: prune(steps, found) };
|
|
@@ -426,8 +453,15 @@ export function refuteFast(constraints, maxRows = 2_000, integral = true) {
|
|
|
426
453
|
const eps = 1e-9;
|
|
427
454
|
for (let iter = 0; iter < 50 * (R + m); iter++) {
|
|
428
455
|
work.n += 1 + ((R * cols) >> 8);
|
|
456
|
+
if (completeWorkProfile.enabled) {
|
|
457
|
+
const cells = R * cols;
|
|
458
|
+
if (!Number.isSafeInteger(cells) || cells < 0)
|
|
459
|
+
throw new RangeError('unsafe float tableau size');
|
|
460
|
+
startWork('fcells', Math.floor(cells / 256), 'float tableau iteration');
|
|
461
|
+
}
|
|
429
462
|
costs.fpivots++;
|
|
430
|
-
|
|
463
|
+
if (!completeWorkProfile.enabled)
|
|
464
|
+
costs.fcells += (R * cols) >> 8;
|
|
431
465
|
// Bland's rule: the first column with a negative reduced cost enters (no cycling on degenerate systems).
|
|
432
466
|
let enter = -1;
|
|
433
467
|
for (let j = 0; j < cols; j++)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export type Translation = 'exhaustive' | 'sampled' | 'unchecked' | 'error';
|
|
2
|
+
export type NativeObservation = {
|
|
3
|
+
where: string;
|
|
4
|
+
method?: string;
|
|
5
|
+
before: unknown;
|
|
6
|
+
after: unknown;
|
|
7
|
+
params: Record<string, unknown>;
|
|
8
|
+
inputs: Record<string, unknown>;
|
|
9
|
+
bindings: Record<string, unknown>;
|
|
10
|
+
args: unknown[];
|
|
11
|
+
result: unknown;
|
|
12
|
+
failed: boolean;
|
|
13
|
+
legacyResult?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export type NativeJournal = {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
complete: boolean;
|
|
18
|
+
scope: 'exhaustive' | 'sampled';
|
|
19
|
+
reason?: string;
|
|
20
|
+
observations: NativeObservation[];
|
|
21
|
+
};
|
|
22
|
+
export type TranslationFields = {
|
|
23
|
+
translation?: Translation;
|
|
24
|
+
translationChecks?: number;
|
|
25
|
+
translationWitness?: NativeObservation;
|
|
26
|
+
kernelProven?: boolean;
|
|
27
|
+
};
|
|
28
|
+
export declare function inheritSource(from: object, to: object, transparent?: boolean): void;
|
|
29
|
+
export declare function rememberNative(e: object, journal: NativeJournal): void;
|
|
30
|
+
export declare function attachSource(rule: object, e: object, generated: object[]): void;
|
|
31
|
+
export declare function attachNativeLaw(rule: object, law: object, name: string, method: string | undefined, evaluate: (observation: NativeObservation) => boolean): void;
|
|
32
|
+
type TranslatedVerdict<V> = Omit<V, 'proven' | 'checked'> & {
|
|
33
|
+
proven: boolean;
|
|
34
|
+
checked: boolean;
|
|
35
|
+
} & TranslationFields;
|
|
36
|
+
export declare function translationVerdict<V extends {
|
|
37
|
+
proven: boolean;
|
|
38
|
+
checked: boolean;
|
|
39
|
+
why?: string;
|
|
40
|
+
stuck?: string;
|
|
41
|
+
}>(rule: object, laws: object[], verdict: V): TranslatedVerdict<V>;
|
|
42
|
+
export declare const nativeSame: (a: unknown, b: unknown) => boolean;
|
|
43
|
+
export declare function nativeSnapshot(value: unknown, seen?: Map<object, unknown>): unknown;
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
// A non-enumerable, versioned marker survives independent module copies. Losing
|
|
2
|
+
// the private observations must downgrade a source proof, not turn it into a DSL proof.
|
|
3
|
+
const sourceMarker = Symbol.for('gdp-wired.source-proof.v1');
|
|
4
|
+
const marked = (value) => Object.prototype.hasOwnProperty.call(value, sourceMarker);
|
|
5
|
+
const mark = (value, enumerable = false) => { if (!marked(value))
|
|
6
|
+
Object.defineProperty(value, sourceMarker, { value: true, enumerable }); };
|
|
7
|
+
const markRule = (value) => {
|
|
8
|
+
mark(value);
|
|
9
|
+
// A Rule's immutable specification is spread by constructor-based transforms.
|
|
10
|
+
// Carry only the fail-closed marker, never a native journal, across such copies.
|
|
11
|
+
const spec = Object.getOwnPropertyDescriptor(value, 'spec')?.value;
|
|
12
|
+
if (spec && typeof spec === 'object')
|
|
13
|
+
mark(spec, true);
|
|
14
|
+
};
|
|
15
|
+
export function inheritSource(from, to, transparent = false) {
|
|
16
|
+
if (marked(from))
|
|
17
|
+
markRule(to);
|
|
18
|
+
const source = sources.get(from);
|
|
19
|
+
if (transparent && source)
|
|
20
|
+
sources.set(to, source);
|
|
21
|
+
}
|
|
22
|
+
const evidence = new WeakMap();
|
|
23
|
+
const sources = new WeakMap();
|
|
24
|
+
const nativeLaws = new WeakMap();
|
|
25
|
+
export function rememberNative(e, journal) { evidence.set(e, journal); }
|
|
26
|
+
export function attachSource(rule, e, generated) {
|
|
27
|
+
markRule(rule);
|
|
28
|
+
sources.set(rule, { root: rule, journal: evidence.get(e), generated: new Set(generated) });
|
|
29
|
+
}
|
|
30
|
+
export function attachNativeLaw(rule, law, name, method, evaluate) {
|
|
31
|
+
mark(law);
|
|
32
|
+
nativeLaws.set(law, { rule: sources.get(rule)?.root ?? rule, name, method, evaluate });
|
|
33
|
+
}
|
|
34
|
+
export function translationVerdict(rule, laws, verdict) {
|
|
35
|
+
const source = sources.get(rule), bound = laws.map(l => nativeLaws.get(l)).filter(x => x !== undefined);
|
|
36
|
+
if (!source && !bound.length && !marked(rule) && !laws.some(marked))
|
|
37
|
+
return verdict;
|
|
38
|
+
const journal = source?.journal;
|
|
39
|
+
const unchecked = (why) => ({ ...verdict, proven: false, checked: false, kernelProven: verdict.proven && verdict.checked, translation: 'unchecked', why: `source translation unchecked: ${why}` });
|
|
40
|
+
if (!journal?.enabled || !journal.complete)
|
|
41
|
+
return unchecked(journal?.reason ?? 'native source replay is unavailable or disabled');
|
|
42
|
+
if (bound.some(b => b.rule !== source?.root))
|
|
43
|
+
return unchecked('the source law belongs to a different rule');
|
|
44
|
+
if (laws.some(l => !nativeLaws.has(l) && !source.generated.has(l)))
|
|
45
|
+
return unchecked('a source proof contains a law with no native interpretation');
|
|
46
|
+
if (!verdict.proven || !verdict.checked)
|
|
47
|
+
return { ...verdict, translation: journal.scope };
|
|
48
|
+
let checks = 0;
|
|
49
|
+
for (const law of bound) {
|
|
50
|
+
let observed = 0;
|
|
51
|
+
for (const observation of journal.observations) {
|
|
52
|
+
if (law.method && observation.method !== law.method)
|
|
53
|
+
continue;
|
|
54
|
+
observed++;
|
|
55
|
+
checks++;
|
|
56
|
+
let holds;
|
|
57
|
+
try {
|
|
58
|
+
holds = law.evaluate(observation);
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
return unchecked(`native interpretation of ${law.name}: ${e instanceof Error ? e.message : String(e)}`);
|
|
62
|
+
}
|
|
63
|
+
if (!holds)
|
|
64
|
+
return { ...verdict, proven: false, checked: false, kernelProven: true, translation: 'error', translationChecks: checks,
|
|
65
|
+
translationWitness: observation, stuck: 'translation-error', why: `translation error: ${law.name} is false in the native code (${observation.where})` };
|
|
66
|
+
}
|
|
67
|
+
if (!observed)
|
|
68
|
+
return unchecked(`no native observation of ${law.method ?? law.name}`);
|
|
69
|
+
}
|
|
70
|
+
return { ...verdict, translation: journal.scope, translationChecks: checks };
|
|
71
|
+
}
|
|
72
|
+
const sourceIdentity = new WeakMap(), cloneIdentity = new WeakMap();
|
|
73
|
+
let nextIdentity = 0;
|
|
74
|
+
const identify = (original, clone) => {
|
|
75
|
+
let id = sourceIdentity.get(original);
|
|
76
|
+
if (id === undefined) {
|
|
77
|
+
id = ++nextIdentity;
|
|
78
|
+
sourceIdentity.set(original, id);
|
|
79
|
+
}
|
|
80
|
+
cloneIdentity.set(clone, id);
|
|
81
|
+
};
|
|
82
|
+
export const nativeSame = (a, b) => a === b || (a !== null && b !== null && typeof a === 'object' && typeof b === 'object' && cloneIdentity.has(a) && cloneIdentity.get(a) === cloneIdentity.get(b));
|
|
83
|
+
// Snapshot real JS values, preserving undefined, NaN, keys, aliasing and class prototypes.
|
|
84
|
+
// Functions are not invoked; laws cannot introduce arbitrary calls. An unsupported snapshot
|
|
85
|
+
// must make source proof finalization unchecked, never silently lose an observation.
|
|
86
|
+
export function nativeSnapshot(value, seen = new Map()) {
|
|
87
|
+
if (value === null || typeof value !== 'object')
|
|
88
|
+
return value;
|
|
89
|
+
if (seen.has(value))
|
|
90
|
+
return seen.get(value);
|
|
91
|
+
if (seen.size >= 10000)
|
|
92
|
+
throw new Error('native state exceeds the snapshot bound');
|
|
93
|
+
const tag = Object.prototype.toString.call(value);
|
|
94
|
+
if (tag === '[object Date]') {
|
|
95
|
+
const out = new Date(Number(value));
|
|
96
|
+
identify(value, out);
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
if (tag === '[object Map]') {
|
|
100
|
+
const out = new Map();
|
|
101
|
+
seen.set(value, out);
|
|
102
|
+
identify(value, out);
|
|
103
|
+
for (const [k, v] of value.entries())
|
|
104
|
+
out.set(nativeSnapshot(k, seen), nativeSnapshot(v, seen));
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
if (tag === '[object Set]') {
|
|
108
|
+
const out = new Set();
|
|
109
|
+
seen.set(value, out);
|
|
110
|
+
identify(value, out);
|
|
111
|
+
for (const v of value.values())
|
|
112
|
+
out.add(nativeSnapshot(v, seen));
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
const out = (Array.isArray(value) ? [] : Object.create(Object.getPrototypeOf(value)));
|
|
116
|
+
seen.set(value, out);
|
|
117
|
+
identify(value, out);
|
|
118
|
+
for (const key of Reflect.ownKeys(value)) {
|
|
119
|
+
const d = Object.getOwnPropertyDescriptor(value, key);
|
|
120
|
+
if ('value' in d)
|
|
121
|
+
Object.defineProperty(out, key, { ...d, value: nativeSnapshot(d.value, seen) });
|
|
122
|
+
else
|
|
123
|
+
Object.defineProperty(out, key, d);
|
|
124
|
+
}
|
|
125
|
+
return out;
|
|
126
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sourceDiagnostic(value: unknown, active?: Set<object>, depth?: number): unknown;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// JSON-safe native witnesses. Keep absence and non-finite numbers explicit; never
|
|
2
|
+
// invoke a getter while printing an error. This is diagnostic data, not a replay format.
|
|
3
|
+
export function sourceDiagnostic(value, active = new Set(), depth = 0) {
|
|
4
|
+
if (value === undefined)
|
|
5
|
+
return { $undefined: true };
|
|
6
|
+
if (typeof value === 'number' && !Number.isFinite(value))
|
|
7
|
+
return { $number: String(value) };
|
|
8
|
+
if (typeof value === 'bigint')
|
|
9
|
+
return { $bigint: String(value) };
|
|
10
|
+
if (typeof value === 'function' || typeof value === 'symbol')
|
|
11
|
+
return { $unsupported: typeof value };
|
|
12
|
+
if (value === null || typeof value !== 'object')
|
|
13
|
+
return value;
|
|
14
|
+
if (active.has(value))
|
|
15
|
+
return { $circular: true };
|
|
16
|
+
if (depth >= 32)
|
|
17
|
+
return { $truncated: true };
|
|
18
|
+
active.add(value);
|
|
19
|
+
const visit = (v) => sourceDiagnostic(v, active, depth + 1);
|
|
20
|
+
try {
|
|
21
|
+
if (value instanceof Date)
|
|
22
|
+
return { $date: Number.isNaN(Number(value)) ? 'Invalid Date' : value.toISOString() };
|
|
23
|
+
if (value instanceof Map)
|
|
24
|
+
return { $map: [...value].map(([k, v]) => [visit(k), visit(v)]) };
|
|
25
|
+
if (value instanceof Set)
|
|
26
|
+
return { $set: [...value].map(visit) };
|
|
27
|
+
if (Array.isArray(value))
|
|
28
|
+
return value.map(visit);
|
|
29
|
+
return Object.fromEntries(Object.entries(Object.getOwnPropertyDescriptors(value)).map(([k, d]) => [k, 'value' in d ? visit(d.value) : { $accessor: true }]));
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
active.delete(value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const stepWorkProfile: Readonly<{
|
|
2
|
+
id: "core-steps-v0";
|
|
3
|
+
enabled: boolean;
|
|
4
|
+
provisional: true;
|
|
5
|
+
}>;
|
|
6
|
+
export declare const provisionalStepWeights: Readonly<{
|
|
7
|
+
astNodes: 1;
|
|
8
|
+
evals: 1;
|
|
9
|
+
cubeTests: 1;
|
|
10
|
+
ticks: 1;
|
|
11
|
+
}>;
|
|
12
|
+
export declare function stepWork(): number;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// An opt-in research profile, not a calibration. D2 owns the eventual weights
|
|
2
|
+
// and W. Freeze the flag once: changing process.env during a proof must not
|
|
3
|
+
// remove already-counted work or change its unit definition.
|
|
4
|
+
import { coreMeter } from "./meter.js";
|
|
5
|
+
import { completeWorkProfile } from "./work-profile.js";
|
|
6
|
+
const environment = globalThis.process?.env;
|
|
7
|
+
export const stepWorkProfile = Object.freeze({ id: 'core-steps-v0', enabled: environment?.GDP_WORK_STEPS === '1' || completeWorkProfile.enabled, provisional: true });
|
|
8
|
+
export const provisionalStepWeights = Object.freeze({ astNodes: 1, evals: 1, cubeTests: 1, ticks: 1 });
|
|
9
|
+
export function stepWork() {
|
|
10
|
+
if (!stepWorkProfile.enabled || completeWorkProfile.enabled)
|
|
11
|
+
return 0;
|
|
12
|
+
return coreMeter.astNodes * provisionalStepWeights.astNodes + coreMeter.evals * provisionalStepWeights.evals
|
|
13
|
+
+ coreMeter.cubeTests * provisionalStepWeights.cubeTests + coreMeter.ticks * provisionalStepWeights.ticks;
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Law, type Machine } from './machine.js';
|
|
2
|
+
import { type Instances } from '../kernel/kernel.js';
|
|
3
|
+
export declare function strategyLawKey(law: Law): string;
|
|
4
|
+
export declare function strategyPremiseSelector(machine: Machine, family: readonly Law[], rejected: readonly Law[]): Readonly<{
|
|
5
|
+
find(predicate: (law: Law) => boolean): Law | undefined;
|
|
6
|
+
assertInstances: (instances: Instances) => void;
|
|
7
|
+
run<T>(instances: Instances, attempt: (laws: readonly Law[], instances: Instances) => T): T;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { checkWall } from "./wall.js";
|
|
2
|
+
// Ignore display labels and alpha-renaming, not free names, constants, maps,
|
|
3
|
+
// quantifier kinds or structure. Local all-binders shadow the outer binders.
|
|
4
|
+
export function strategyLawKey(law) {
|
|
5
|
+
const names = [law.forall, ...law.keys ?? [], ...law.some ?? []].filter((name) => name !== undefined);
|
|
6
|
+
if (new Set(names).size !== names.length)
|
|
7
|
+
throw new Error('duplicate strategy law binder');
|
|
8
|
+
const visit = (value, scope) => {
|
|
9
|
+
checkWall('strategy premise identity');
|
|
10
|
+
if (!value || typeof value !== 'object')
|
|
11
|
+
return value;
|
|
12
|
+
if (Array.isArray(value))
|
|
13
|
+
return value.map(v => visit(v, scope));
|
|
14
|
+
const object = value;
|
|
15
|
+
if (object.op === 'var' && typeof object.name === 'string') {
|
|
16
|
+
const index = scope.lastIndexOf(object.name);
|
|
17
|
+
return index < 0 ? ['free', object.name] : ['bound', scope.length - index - 1];
|
|
18
|
+
}
|
|
19
|
+
if (object.op === 'all' && typeof object.key === 'string') {
|
|
20
|
+
const local = [object.key, ...(object.keys ?? [])];
|
|
21
|
+
return ['all', local.length, visit(object.c, [...scope, ...local])];
|
|
22
|
+
}
|
|
23
|
+
return Object.keys(object).sort().map(key => [key, visit(object[key], scope)]);
|
|
24
|
+
};
|
|
25
|
+
return JSON.stringify([law.forall !== undefined, law.keys?.length ?? 0, law.some?.length ?? 0, visit(law.holds, names)]);
|
|
26
|
+
}
|
|
27
|
+
export function strategyPremiseSelector(machine, family, rejected) {
|
|
28
|
+
const rows = family.map(law => ({ law, name: law.name, key: strategyLawKey(law) }));
|
|
29
|
+
if (new Set(family.map(law => law.name)).size !== family.length)
|
|
30
|
+
throw new Error('ambiguous strategy law name');
|
|
31
|
+
const denied = new Set(rejected.map(strategyLawKey)), allowed = rows.filter(row => !denied.has(row.key));
|
|
32
|
+
const names = new Set(allowed.map(row => row.law.name)), familyNames = new Set(family.map(law => law.name));
|
|
33
|
+
const flags = new Set(Object.keys(machine.step.flags ?? {}).map(name => '?' + name).filter(name => !familyNames.has(name)));
|
|
34
|
+
const unchanged = () => {
|
|
35
|
+
for (const row of rows)
|
|
36
|
+
if (row.law.name !== row.name || strategyLawKey(row.law) !== row.key)
|
|
37
|
+
throw new Error('strategy family changed after selection');
|
|
38
|
+
};
|
|
39
|
+
const assertInstances = (instances) => {
|
|
40
|
+
unchanged();
|
|
41
|
+
for (const name of Object.keys(instances))
|
|
42
|
+
if (!names.has(name) && !flags.has(name))
|
|
43
|
+
throw new Error('rejected or unknown strategy premise: ' + name);
|
|
44
|
+
};
|
|
45
|
+
return Object.freeze({
|
|
46
|
+
find(predicate) {
|
|
47
|
+
unchanged();
|
|
48
|
+
const matches = allowed.filter(row => predicate(row.law));
|
|
49
|
+
unchanged();
|
|
50
|
+
if (matches.length > 1)
|
|
51
|
+
throw new Error('ambiguous strategy premise');
|
|
52
|
+
return matches[0]?.law;
|
|
53
|
+
},
|
|
54
|
+
assertInstances,
|
|
55
|
+
run(instances, attempt) {
|
|
56
|
+
assertInstances(instances);
|
|
57
|
+
// The same filtered family must build the goal; excluding a scalar's tuple
|
|
58
|
+
// alone would not exclude its automatically assumed state-law premise.
|
|
59
|
+
const result = attempt(Object.freeze(allowed.map(row => row.law)), instances);
|
|
60
|
+
assertInstances(instances);
|
|
61
|
+
return result;
|
|
62
|
+
},
|
|
63
|
+
});
|
|
64
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// Shared untrusted allowance rule; existing law-level behavior is unchanged.
|
|
2
|
+
// Pending excludes already-tried, kept and carried laws of this round.
|
|
3
|
+
export const attemptShare = (remaining, pending) => Math.max(0, remaining) / Math.max(1, pending.size);
|
|
4
|
+
export function supportBudget(remaining, share, priority, structural = false) {
|
|
5
|
+
return Math.max(0, Math.min(remaining, structural ? 5_000 : priority ? Math.max(share, remaining / 3) : share));
|
|
6
|
+
}
|