Skip to content

feat(search): close BBR via multi-block reduced Schmüdgen + i=0 refutation#78

Merged
kim-em merged 5 commits into
mainfrom
bbr-closed-refutation
May 27, 2026
Merged

feat(search): close BBR via multi-block reduced Schmüdgen + i=0 refutation#78
kim-em merged 5 commits into
mainfrom
bbr-closed-refutation

Conversation

@kim-em
Copy link
Copy Markdown
Collaborator

@kim-em kim-em commented May 27, 2026

This PR closes the BBR Lemma 7.2 polynomial (degree-8 bivariate, integer coefficients up to ~5.8×10¹², reported by Maksym Radziwill on Zulip) via by sos, with a fully kernel-checked proof — #print axioms shows only propext, Classical.choice, Quot.sound (no native_decide).

The mechanism is Harrison's HOL Light REAL_SOS, identified by instrumenting it directly: BBR closes through the i=0 branch of REAL_NONLINEAR_PROVER's tryall loop — the strict refutation −1 = σ₀ + σ₁·(−P) proving 0 < P by contradiction — not the i=1 Artin form P = σ₀ + σ₁·(−P). The −1 target yields a far better-conditioned reduced SDP whose float Gram rounds cleanly to a rational certificate.

Two pieces:

  • Multi-block reduced Schmüdgen encoder (tryReducedSchmudgenSdp and helpers). Generalises the existing single-block reduced encoding (tryReducedPureSdp) to any number of PSD blocks: polynomial-identity equations are eliminated over ℚ before CSDP, so CSDP sees a pure-PSD problem with no equality constraints — far better conditioned than the dense tryOneSdp, whose equality constraints are primal-infeasible at BBR's coefficient scale. Reached only by the closed strict-refutation, via an explicit refutation flag threaded from runClosedRefutation through runFeasibilitySearch. There is no dense fallback, and no other goal touches the encoder — every non-refutation goal stays on tryOneSdp, byte-identical to its pre-feature path.

  • Closed strict-refutation path (runClosedRefutation + closeSosClosedRefutation). Searches for −1 = σ₀ + σ₁·(−p) against gs ++ [−p]. Soundness reuses the existing sos_strict_product_sound with strictGs = [], exponent = 1 (so the target is −(strictProductPoly [])¹ = −1 and the strict-positivity hypothesis is vacuous, yielding 0 < p), then le_of_lt. Tried on unconstrained closed goals after plain SOS fails — one extra CSDP solve per such hard failure, sound (a false −1 certificate is impossible).

SOSTest/BBR.lean becomes a direct by sos regression test (needs maxRoundingDenom := 1 <<< 66, the wider denominator schedule now in main via #77). The BBR module is a genuine live degree-8 SDP solve (~57s); it was a failing ~21s search before. Removing the encoder fallback returns every other module to its main timing (e.g. isolated SOSTest.DivMod 13s, vs 17s when constrained-closed goals detoured through the encoder). lake test is green.

Deliberately minimal: this is the smallest addition to main that closes BBR. It does NOT include the closed-Artin path (#76), the pivot-priority primitive, or #73's pure-SOS dispatch change — none of which BBR needs. main's pure-SOS dispatch (symmetry-gated useReducedPure, tryDirectSos) is left untouched.

🤖 Prepared with Claude Code

kim-em added a commit that referenced this pull request May 27, 2026
… goals

Per review (Codex on #78) and timing: the default-on refutation added a
failure-path CSDP solve to every closed goal that plain SOS fails. Gating
to `gs`/`ps` empty keeps BBR (unconstrained) closing while removing the
extra solve from constrained closed goals (e.g. the div/mod regression
tests), cutting that collateral cost. The constrained refutation
(Harrison's general form) is deferred.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
kim-em and others added 3 commits May 28, 2026 05:36
…ation

Closes the BBR Lemma 7.2 polynomial (degree-8 bivariate, integer
coefficients to ~5.8×10¹²) via `by sos`, fully kernel-checked (axioms:
propext, Classical.choice, Quot.sound — no native_decide).

Two pieces, both modelled on Harrison's HOL Light REAL_SOS:

* Multi-block reduced Schmüdgen encoder (`tryReducedSchmudgenSdp` and
  helpers `multiBlockEquations`, `multiBlockGramMats`,
  `buildMultiBlockReducedProblem`, `multiBlockReconstructGram`,
  `tryReducedSchmudgenDenominator`). It generalises the existing
  single-block reduced encoding (`tryReducedPureSdp`) to any number of
  PSD blocks: the polynomial-identity equations are eliminated over ℚ
  before CSDP runs, so CSDP solves a pure-PSD problem with no equality
  constraints — far better conditioned than dense `tryOneSdp`, whose
  equality constraints are primal-infeasible at BBR's coefficient scale.
  Reached via a new `useReducedSchmudgen` dispatch branch for closed
  constrained goals (gs non-empty, ps empty); falls back to `tryOneSdp`.

* Closed strict-refutation path (`runClosedRefutation` +
  `closeSosClosedRefutation`). To prove `0 ≤ p` it searches for
  `−1 = σ₀ + σ₁·(−p)` (σ SOS) against `gs ++ [−p]`, proving the stronger
  `0 < p` by contradiction. This is Harrison's actual BBR mechanism — the
  i=0 branch of `REAL_NONLINEAR_PROVER`'s `tryall` loop (target `−1`), not
  the i=1 Artin form `p = σ₀ + σ₁·(−p)`. The `−1` target is far better
  conditioned; its certificate rounds cleanly. Soundness reuses the
  existing `sos_strict_product_sound` with `strictGs = []`, `exponent = 1`
  (`−(strictProductPoly [])¹ = −1`, vacuous strict hypothesis ⇒ `0 < p`),
  then `le_of_lt`. The tactic tries this by default on closed goals after
  plain SOS fails: one extra CSDP solve per hard closed failure (~5s on
  the suite), sound (a false `−1` certificate is impossible).

`SOSTest/BBR.lean` is a direct `by sos` regression test (needs
`maxRoundingDenom := 1 <<< 66`, the wider schedule from the base PR).
`lake test` green.

Depends on the niceDenominators 2^66 schedule (PR #77, this branch's base).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
… goals

Per review (Codex on #78) and timing: the default-on refutation added a
failure-path CSDP solve to every closed goal that plain SOS fails. Gating
to `gs`/`ps` empty keeps BBR (unconstrained) closing while removing the
extra solve from constrained closed goals (e.g. the div/mod regression
tests), cutting that collateral cost. The constrained refutation
(Harrison's general form) is deferred.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…, drop fallback

The multi-block reduced Schmüdgen encoder was reached via a
`useReducedSchmudgen` gate that fired on every closed constrained goal
(gs non-empty, ps empty), then fell back to `tryOneSdp` when the encoder
did not close. That made every constrained-closed goal pay for an encoder
attempt it did not need — the only goal that actually needs the encoder is
the closed strict-refutation (`runClosedRefutation`), whose target is the
constant −1 and for which `tryOneSdp` returns primal-infeasible at scale.

Replace the goal-shape gate with an explicit `refutation : Bool` flag
threaded from `runClosedRefutation` through `runFeasibilitySearch` to
`runFeasibilitySearchCore`. Only refutations route to the encoder, and
they do so with no dense fallback. Every other goal stays on `tryOneSdp`,
byte-identical to its pre-feature path.

Isolated DivMod rebuild drops 17s → 13s (the removed encoder detour);
BBR Lemma 7.2 still closes in ~57s; full SOSTest suite green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kim-em kim-em force-pushed the bbr-closed-refutation branch from 9d92822 to b3d78f4 Compare May 27, 2026 19:46
@kim-em kim-em changed the base branch from extend-niceDenominators-harrison to main May 27, 2026 19:46
Two dead-code cleanups in the multi-block reduced encoder, exposed while
auditing the refutation path:

- `SchmudgenDenomResult` (a 4-constructor inductive carrying `atBlock` /
  `cert` diagnostic payloads) was never consumed — the sole caller
  collapsed every failure constructor to `_` and read no payload. Collapse
  `tryReducedSchmudgenDenominator` to `Option (Certificate n)`.

- `scaleFloat` was hardcoded `1.0` (uniform matrix scaling needs no inverse
  on the dual), so `yOrig = sol.y.map (· * 1.0)` was bit-identical to
  `sol.y`. Drop it and the `let _ := scaleFloat` lint-suppression; pass
  `sol.y` directly, keeping the uniform-scaling rationale as a comment.

Behaviour-preserving: BBR still closes (~55s), full SOSTest green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two minor follow-ups from review of #78:

- `runClosedRefutation` accepted a `ps` (equality-constraint) parameter
  the reduced refutation encoder does not honour: `tryReducedSchmudgenSdp`
  has no `ps` argument and checks its certificate against `[]`, so a call
  with `ps ≠ []` would return a certificate that fails `Certificate.checks`
  (fails safe — never an unsound proof, but confusing). Reject `ps ≠ []`
  up front with `return none` and a comment. The tactic already gates this
  path to empty `gs`/`ps`, so behaviour is unchanged in practice.

- `Config.maxRoundingDenom` doc said `niceDenominators` tops out at `2^24`;
  it now extends to `2^66` (Harrison's `find_rounding` schedule, #77),
  filtered by the default `2^24` cap. Corrected.

BBR still closes (~58s), full SOSTest green.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kim-em kim-em merged commit b644f47 into main May 27, 2026
1 check passed
@kim-em kim-em deleted the bbr-closed-refutation branch May 27, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant