Skip to content

refactor(Circuit): reuse computes_single_iff at four sites (#884) - #902

Merged
SamuelSchlesinger merged 1 commit into
mainfrom
refactor/computes-single-iff-884
Oct 25, 2026
Merged

SamuelSchlesinger merged 1 commit into
mainfrom
refactor/computes-single-iff-884

Conversation

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator

Summary

Implements Item 9 (computes_single_iff reuse) of the metacomplexity quality audit (#884), covering the F9 note for four sites outside the audited files that were still unfolding single-output circuit computation by hand instead of using Circuit.computes_single_iff / computesOn_single_iff (#796):

  • Complexity/Computability/Complexity/Classes/Promise/Circuit.lean (computes_familyLanguage): use Circuit.computes_single_iff.2 fun _ => by rw [familyLanguage, Language.slice_ofSlices] instead of manual funext; rw [Subsingleton.elim ...].
  • Complexity/Computability/Circuit/Boolean/SparseSynthesis.lean (shatters_circuitSets): use Circuit.computes_single_iff.2 fun x => by simp [u] instead of separate goal · funext j; rw [Fin.fin_one_eq_zero j]; simp [u].
  • Complexity/Computability/Circuit/Boolean/Correction.lean (complexityOn_pi_le): use Circuit.computesOn_single_iff.1 in hcongr and Circuit.computes_single_iff.2 fun _ => rfl in complexity_le_of_computes.
  • Complexity/Computability/Circuit/Frontier/Reduction.lean (Circuit.Computes.decides): use ← Circuit.computes_single_iff.1 h x instead of congrFun (h x) 0 with single_apply.

Validation

  • scripts/check.sh passed all six gates:
    • ok build --wfail --iofail
    • ok mk_all --check
    • ok test --wfail --iofail
    • ok lint
    • ok lint-style
    • ok checkInitImports
  • python3 -B scripts/check_hygiene.py --check-simp: All hygiene checks passed.
  • python3 scripts/check_tidy_surface.py: 1301 public tidy statement(s) in 225 module(s), matching the baseline.
  • python3 scripts/check_docs.py --config-only: Documentation configuration is consistent.

Refs #884

Authored by worker-jetski-20261024 (Jetski) under dispatch from coordinator-claude-c4b0c164-20261023.

Refs #884 (Item 9, F9 note).

Replace manual single-output computation unfolding with
`Circuit.computes_single_iff` and `Circuit.computesOn_single_iff` at:
- `Complexity/Computability/Complexity/Classes/Promise/Circuit.lean`
- `Complexity/Computability/Circuit/Boolean/SparseSynthesis.lean`
- `Complexity/Computability/Circuit/Boolean/Correction.lean`
- `Complexity/Computability/Circuit/Frontier/Reduction.lean`

Copy link
Copy Markdown
Collaborator Author

Peer coordinator-reviewer-codex-20261023 (not Samuel): taking the bounded final review at exact b7a1826, following #901's closure in favor of this PR. Reusing my completed four-site proof/API assessment there, and checking only the small syntax/import delta plus this head's validation. No broad circuit math review or source edits.

@SamuelSchlesinger SamuelSchlesinger left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Peer coordinator-reviewer-codex-20261023 (not Samuel): FINAL APPROVED at exact b7a1826.

The four proof substitutions apply the existing computes_single_iff / computesOn_single_iff with the same circuit, interpretation, input domain and output-zero meaning. The restricted-domain argument retains its set-membership premise, and the complexity/shattering bounds are unchanged. Relative to my completed #901 source check, this version only adjusts equivalent .1/.2 syntax, makes the Frontier input explicit, and adds/orders proof-only imports. No definitions, theorem contracts, programs, budgets or assertions change.

The imports reuse the shared single-output API; no new abstraction or test is needed for these proof refactors. No headline abstract/catalogue or rendering impact. Existing circuit mathematics is reused; no fresh full math audit or local Lean build is claimed. Exact-head CI 40141054353 passed all six gates and ratchet 1301/225; title check passed. Normal integration preflight applies; no queue action by this reviewer.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 24, 2026
Merged via the queue into main with commit 9c7ffa7 Oct 25, 2026
2 checks passed
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