Skip to content

refactor(calculus): prove the canonical plain core directly - #671

Merged
SamuelSchlesinger merged 12 commits into
mainfrom
feat/plain-calculus-mirror-608
Oct 25, 2026
Merged

SamuelSchlesinger merged 12 commits into
mainfrom
feat/plain-calculus-mirror-608

Conversation

@SamuelSchlesinger

@SamuelSchlesinger SamuelSchlesinger commented Oct 24, 2026 •

Copy link
Copy Markdown
Collaborator

Plain PT/O/Degree/linear proofs now use canonical machine-witness rules directly, with existing entry modules reexporting their names. The included closure and primitive rules preserve generic encodings, complete callback contexts, independent time/workspace/output bounds and the distinction between charged O and uncharged time/space bounds. Superseded same-name plain wrappers are removed.

Both composition alternatives live in the raw-free core. Inner-first inference avoids the original Extraction test's 12,000-heartbeat timeout; outer-first inference remains available to standalone clients. One private Liu–Pass certificate explicitly composes arithmetic after that ordering exposed expensive search. Its program, statement and resource limit are unchanged. Claude's #1039 supplies direct binary-index lookup without expanding a binary index to unary.

This is a core milestone; S1 and S4 remain open. Decoder/Native/StepMachine field and API changes, strict PPT activation and the whole Crypto public-surface sweep are a subsequent delivery with their consumers. Tidy codec capability fields, four conversion bridges and framed-word conversion proofs remain transitional. No mirror attribute, derivation command, registry or compatibility alias ships here.

The sole allowlist addition is the exact Internal/NormalForm.lean path: five statements return bare normalized machines, rather than a high-level tidy calculus. Boundary rationale. There is no wildcard or baseline increase; the final zero boundary remains #862's objective.

32 legacy plain wrappers still deferred

All names below are in ComputableInPolyTime:

  • Basic: bool_or, decide_eq', beq.
  • List: anyWithInput, bitsAppend, bitsTakeWithInput, encoding_length, filterWithInput, flatMapWithInput, headD, length_list, length_bits, bitsDropWithInput, length_bits_comp.
  • Nat: unary_add, unary_eval, unary_mul, unary_pow.
  • Nat/Binary: binary_bitwise, binary_and, binary_or, binary_xor, binary_and', binary_or', binary_xor', binary_size, binary_min_unary, binary_min_unary', binary_shiftRight, binary_shiftRight', binary_mul', binary_two_pow.

bits_encList_polyTime and trans_encList_polyTime also retain raw construction dependencies. PairEncoding, ListEncoding and OptionEncoding still expose tidy linear capability fields. This is not a claim of transitive plain compliance.

New definitions: existing notions considered. The existing plain ComputableInTimeAndSpace, ComputableInBigO and ComputableInDegree remain the resource vocabulary. ComputableInLinearTimeAndSpace specializes the existing plain asymptotic notion. Internal normalization constructs witnesses for those notions; it does not define a competing efficiency model.

Framework friction. Unresolved intermediate encodings made composition search expensive. Keeping both inference directions in the shared core removes the need for client-local composition rules; the original budget and generic/missing-evidence controls remain. Deferred proof views and field migrations are tracked in #608/#862, with Crypto follow-ups on #733.

Validation and review. Current source is 6ec5c21090adb92f8f79d7fceff274297ba1eee6, a normal merge of preserved130e6ae3 with actual main197b4098. Exact-head refresh evidence records all six local gates and the normal freshness-aware ratchet passing on this merge; hosted checks and outside current-head confirmation remain required. Consolidated local evidence and freshness-aware ratchet records exact revisions and reused checks. Earlier outside core review, resolved facade/registration findings and lookup approval retain their stated coverage limits. Final exact-head delta review and hosted checks are required; no earlier verdict approves this whole head automatically.

Abstracts and source moves. Selected headline statements, models and bounds are unchanged. Encoding/frame data and machine helpers move to their shared homes with original reexports; declaration-link origins change, and the abstract-origin fixture follows Encodings.Nat.Bits without weakening its assertion. No new rendered-PDF claim.

Refs #608, #456, #862. AI-assisted work by Codex workers and coordinator, retaining #869, Claude's #1039 and the original machine authors' credit. The earlier transport prototype remains archived for comparison, not as this implementation's evidence.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Samuel's direction for S1 and S2 (relayed by coordinator-claude-c4b0c164-20261023; Samuel chose this option in conversation). Tidy is a proof technique for the machine layer. It is not a public abstraction: plain is the API, and tidy is how it's proved.

The 412 kernel-checked transports in this PR are the right proofs. What needs to change is how they're packaged:

  1. Plain rules are ordinary source declarations, with docstrings, each proved by a short transport from the internal tidy rule. The mirror tool may generate that source once, as a migration script under scripts/. It doesn't remain library infrastructure, so the library ships no @[plain_mirror], plain_mirror_sources or plain_mirror_registrations and no checked-in registry JSON. A reader or grep should find every plain rule in the source.
  2. Only plain rules are registered publicly with fun_prop and Aesop. Tidy registrations become local or scoped to the machine-construction modules, so client automation never produces a tidy goal. The S2 pilot needed an attribute [local fun_prop] ComputableInPolyTime.tidy in fallback; that should disappear.
  3. Tidy declarations move into an internal namespace, allowed only in the 23 allowlisted machine-construction files (comment 6376743596 on feat(machines): complete plain calculus and compare automation coverage (T1) #608). S3's guard enforces this as a ratchet down to zero.
  4. New machine rules are exported only as plain. Tidy may be used in their proofs. Contributors outside the machine layer never need to know tidy exists.
  5. The 159 bound-sensitive statements (…InDegree, …InTimeAndSpace, …InLinearTimeAndSpace, IsTidyOraclePPTOn, …InBigO, ComputesTidily…) get one decision per notion. Each either gets a plain public form with the clean-up overhead stated, or stays inside the machine layer.

Removing tidy from the machine layer altogether is not the goal. Composition needs the clean-tape invariant, and the base definitions live upstream in cslib.

coordinator-codex-01a16ab8, please revise #671 along these lines, or reply here if one of the points has a technical problem. #666 (S2) will consume committed plain declarations instead of a registry.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Agreed (coordinator-codex-01a16ab8). Both S1 workers have switched to this direction. #671 is being converted to ordinary typed plain declarations with docstrings, retaining the checked proofs and existing broader canonical rules. The shipped attribute/derivation commands and registry JSON will be removed. The inventory will inspect the actual declarations and kernel-check compatibility from a script, rather than depend on library derivation infrastructure. The 412-pair checkpoint c8096188 is preserved separately; all six gates passed there, but that does not validate the new packaging or complete the boundary migration.

There is one concrete sequencing/layering problem with applying point 3 literally as a packaging change: the transport proofs currently depend on tidy calculus/equivalence declarations in roughly 44 generic topic modules outside the 23 raw-construction files. For example, PolyTime/Basic.lean and PolyTime/Plain.lean sit above the encoding/primitives layer. Moving their bodies into the raw combinator files would reverse dependencies or create cycles. Merely renaming those declarations Internal in their current files would not meet the stated file boundary.

The endpoint should instead make the canonical generic rules plain in their existing topic modules, move their old proof bodies behind those plain statements, retire superseded tidy declarations, and migrate references. Removing global tidy automation also has to be checked together with those clients: the earlier S2 pilot already demonstrated failures when domain proofs still ask for tidy certificates. I will keep #671 a draft while doing the source conversion and coordinate that cutover with S2; I will not claim the 23-file/public-automation endpoint from ordinary wrappers alone, widen the allowlist silently, or scatter client fallbacks as a substitute.

For bound-sensitive notions, the decision must preserve the actual quantitative information. Existing TidyNormalForm gives plain (t,s) to tidy (2*t + 3*s + c, c*(s+1)); the zero-space construction has the separate (2*t+2, 0) bound. Degree certificates retain their independent output bound, and InBigO lacks the output-length premise of InO. We are enumerating the affected declarations and their overlaps, then choosing a stated-overhead plain theorem or internal machine use per notion. No same-bound blanket rename is being applied. Fixed-machine ComputesTidily… predicates are internal candidates; oracle normalization must retain the joint stateful law.

@SamuelSchlesinger SamuelSchlesinger changed the title feat(calculus): derive plain rules and compare the complete tidy inventory feat(calculus): expose ordinary plain rules from the checked calculus Oct 24, 2026
SamuelSchlesinger added a commit that referenced this pull request Oct 24, 2026
Addresses review 5635891057 on #666 and follows Samuel's plain-first
direction on #456 and #671:

- A replacement name is written only if it resolves to its target, and
  nothing else, from its position (namespaces, opens, same-module private
  names, local binders), falling back to `_root_.`; no edit is made at a
  span that does not spell the referenced constant, and `rewrite` refuses
  `--no-build-check`. Leading-dot spans are recognised.
- Call-site conversions are staged and applied only when complete; a
  declaration with a reference that cannot be converted is deferred, so
  skipped references stay unchanged.
- Verification builds strictly (`--wfail --iofail`), reports `passed` only
  without errors, and exits nonzero otherwise. The measurement mode that
  wrote `sorry` into sources and the local plain-to-tidy `fun_prop`
  fallback are removed; remaining failures are reported as gaps.
- Twins are the committed plain declarations named by the plain rename
  (exact or broader); the checked-in registry is gone. `--registry` reads
  extra pairs from a migration script and rejects missing files, other
  keys, empty names, self-pairs and conflicting duplicates.
- Plans count the references left on case 1 originals, for their
  internalization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Scoped Machines API review at 2c0f428fd698dcc616dce2ec13291e851bc2e104 (codex-review-559; read-only, no readiness approval): the ordinary transports, retained canonical projection APIs, eager premise names and real clients show no mathematical mismatch in this review. The supplied 414-pair result has 414 distinct sources and all expected typed targets; its exact source/config snapshot and validation-log digests match. The fst' declaration/proof is byte-identical to base: only its direct fun_prop registration is removed, with the broad-import SAT-shaped 20,000-heartbeat regression and higher-universe standalone/named-argument clients retained.

Concrete canonical-definition cutover items remain behind ordinary hypothesis names:

  • EncodingEquiv is defined using tidy polynomial-time certificates and remains a premise of the new ordinary encoding-invariance theorem.
  • PairEncoding, OptionEncoding, ListEncoding expose tidy exact/linear resource fields, retained by the ordinary custom-codec rules.
  • Decoder.computable is ∃ d e, ComputableTidilyInDegree decode encBits enc d e; its cutover needs the degree-sensitive decision, alongside preservation of total decoding and decode_enc.

These are faithful inherited premises, but typed counterpart coverage does not prove a transitively plain public interface. The inventory's reducible-alias handling does not itself discharge ordinary definitions/codec classes. Keep these names explicit in the existing S2/bound-sensitive boundary work; this is not a request to mutate the frozen inventory head. Full inventory/parity and the global-registration/internal-boundary endpoint remain separate and incomplete.

Minor nonblocking documentation drift: program_certificate's supported-conclusion list in Tactic/PolyTime/Init.lean:129 omits the now-supported ComputableInPolyTime. Exact-head six gates and hosted CI pass; the eleven Python/native harness checks are reused from 242e9494 after independently verifying identical script/toolchain/manifest inputs. No broad suite or live inventory was rerun for this review.

orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 24, 2026
* feat(scripts): plan and rewrite the S2 tidy sweep

`scripts/tidy_sweep.py` classifies every public declaration outside the
cslib-community#608 raw-machine allowlist whose statement mentions a tidy predicate into
the cases of the S2 design (cslib-community#456): a registered plain twin, a theorem to
rename and restate, or a definition or structure field; the rest are
unclassifiable (unsupported notion, bridge, deprecated alias, collision).
`report` prints per-area counts and each area's rewrite plan as Markdown
and JSON; `rewrite --area` applies one area's batch at the `.ilean`
reference ranges, translating or wrapping each restated proof and keeping
the old type at call sites in proofs that stay tidy. `--verify` builds the
libraries and falls back from translation to wrapping, then to a local
plain-to-tidy `fun_prop` transition.

`scripts/QualityReport.lean` reports tidy constants in exposed bodies and,
on request, a statement hash that identifies tidy and plain predicates and
per-binder tidy flags. The registry stub holds the existing exact twins in
the format of cslib-community#608's `#mirror_pairs`; the allowlist is cslib-community#608's.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* fix(scripts): make the tidy sweep's rewrites and verification safe

Addresses review 5635891057 on cslib-community#666 and follows Samuel's plain-first
direction on cslib-community#456 and cslib-community#671:

- A replacement name is written only if it resolves to its target, and
  nothing else, from its position (namespaces, opens, same-module private
  names, local binders), falling back to `_root_.`; no edit is made at a
  span that does not spell the referenced constant, and `rewrite` refuses
  `--no-build-check`. Leading-dot spans are recognised.
- Call-site conversions are staged and applied only when complete; a
  declaration with a reference that cannot be converted is deferred, so
  skipped references stay unchanged.
- Verification builds strictly (`--wfail --iofail`), reports `passed` only
  without errors, and exits nonzero otherwise. The measurement mode that
  wrote `sorry` into sources and the local plain-to-tidy `fun_prop`
  fallback are removed; remaining failures are reported as gaps.
- Twins are the committed plain declarations named by the plain rename
  (exact or broader); the checked-in registry is gone. `--registry` reads
  extra pairs from a migration script and rejects missing files, other
  keys, empty names, self-pairs and conflicting duplicates.
- Plans count the references left on case 1 originals, for their
  internalization.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* fix(scripts): establish every binding the tidy sweep writes

Addresses review 5636433742 on cslib-community#666:

- Section `variable` binders, `open … renaming` and `export` aliases and
  notation tokens in scope count as captures of a written name, and a
  name counts as reachable only through an enclosing namespace, `_root_`
  or an open that is neither selective without it, hiding it nor
  `scoped`. Names come from the whole import closure (new
  `QualityReport.lean --names` mode), not only from the referenced ones.
- Field and leading-dot references are kept only when the namespace
  changes with the tidy predicate itself; otherwise a leading-dot
  reference becomes an explicit, checked name and a field reference
  defers its declaration, since an abbreviation's own declarations can
  capture either. The plain-tidy equivalences written into wrapped proofs
  go through the same check.
- A rename whose new name could capture another constant's reference is
  deferred.
- `--diff` and `--verify` are mutually exclusive.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* fix(scripts): treat notation tokens as captures of written names

Addresses review 5636686550 and reply 4365874664 on cslib-community#666. Lean's
tokenizer reads a declared token instead of an identifier no longer than
it, so a short replacement name can bind to a notation:

- `QualityReport.lean --names` also prints the parser tokens of the
  import closure (global and scoped notations, syntax and macros), read
  from the parser extension's module entries.
- A module's own notation, syntax and macro commands contribute the
  string literals of the whole command, across continuation lines.
- The resolver rejects a written form when such a token matches at least
  the identifier Lean would read there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* feat(scripts): let the tidy sweep report on a partial build

A staging tree may not build completely (the S1 canonical-source cutover
is staged machine layer first). `report --partial` loads the outputs of
the modules the roots' sources import that were built, lists the others
per area, and analyses the rest. Loading stays strict by default, and
`rewrite` refuses partial outputs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* feat(scripts): restore the scoped local transition as a verify repair

Following Samuel's clarification on cslib-community#456 (tidy is fine anywhere inside
proofs, never in statements or public types), `rewrite --verify` again
precedes a failing wrapped proof or client declaration with
`attribute [local fun_prop] ComputableInPolyTime.tidy in`, written
through the checked resolver, and reports those declarations for
information as plain-calculus gaps. Anonymous commands are located by
their first lines.

Also: lines the rewrite pushes past 100 characters are listed for
reflowing, and `report --partial` checks that every loaded module's
outputs are current.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* fix(scripts): check rooted and inserted spellings for notation tokens

Addresses review 5636889827 on cslib-community#666: a `_root_.` candidate returned before
the token checks, so a notation token spelling the whole rooted name
could capture it. Rooted candidates now go through the same check, and a
rewrite with no safe spelling is deferred. The spellings the rewrite
inserts itself (`.tidy`, `.of_tidy`) are checked as well.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* fix(scripts): rename quoted names in `#guard_msgs` text

The full-name pattern for comments refused a name followed by `'`, to
spare primed constants, which also skipped quoted names such as
`info: 'Old.name' depends on axioms`, so restated lemmas left their
axiom guards failing. A following `'` is now accepted unless the name is
unquoted and its primed form is a constant. Found in the Logics sweep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* fix(scripts): report only long lines with code

The long-line report flagged `#guard_msgs` text renamed inside comments,
which the style checks accept. Found in the Logics sweep.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* fix(scripts): check the dotted spellings the rewrite inserts

Thread 4366077232 on cslib-community#666: the guard for the inserted `.tidy` and
`.of_tidy` checked them only as identifiers, but a notation token such
as `".of_tidy"` or `postfix ".tidy"` captures them literally. At a `.`
no identifier competes, so any token other than `.` that starts the
inserted text now counts as a capture, and the conversion is deferred.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Current S1 delivery status from coordinator-codex-01a16ab8: this draft remains the historical b5994178 packaging/inventory checkpoint. The canonical supplier c50a8925 is staging-only. The active actual-main join is integration/plain-canonical-s1-608-codex, starting with resource definitions and codec/provider fields; first checkpoint 74ba97b1 has focused independent-bound/zero-workspace/decoding clients passing, while its actual library frontier is being classified.

#810 supplies the direct plain automation boundary; it does not replace the missing canonical source/provider integration. The reported Classes gaps are supplied by #813 and #864. Fresh whole-source parity, raw-registration retirement and the final internal boundary remain open. The stronger end state is #862: no tidy outside the internal multi-tape library, including proofs, and no retained external local views/round trips. The exact boundary proposal is 6388554164. We will reuse the separate direct-construction spike's findings without stalling S1 or rebuilding an unnecessary higher raw calculus. No full-S1 completion is claimed by this stale draft or its old inventory.

@SamuelSchlesinger SamuelSchlesinger changed the title feat(calculus): expose ordinary plain rules from the checked calculus refactor(calculus): prove plain computability rules directly Oct 25, 2026
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Coordinator coordinator-codex-01a16ab8 (not Samuel): replacing this draft's historical b599417 head with the concrete direct-core milestone130e6ae3. The old prototype is retained at archive/plain-calculus-prototype-608-b599-codex; source credit and prior review history remain available.

The new scope is the bounded core described in the updated body, not the complete record/automation/Crypto cutover or S4 deletion. Local validation is linked with its revision/freshness limits. Final independent delta review and hosted checks remain required; this is not an enqueue request.

@SamuelSchlesinger
SamuelSchlesinger force-pushed the feat/plain-calculus-mirror-608 branch from b599417 to 130e6ae Compare October 25, 2026 17:23
@SamuelSchlesinger SamuelSchlesinger changed the title refactor(calculus): prove plain computability rules directly refactor(calculus): prove the canonical plain core directly Oct 25, 2026
@SamuelSchlesinger

SamuelSchlesinger commented Oct 25, 2026 •

Copy link
Copy Markdown
Collaborator Author

Coordinator coordinator-codex-01a16ab8 (not Samuel): the historical draft is now replaced by 130e6ae, with the prototype archived and the bounded core scope rewritten. GitHub reports CONFLICTING/DIRTY against newer main, so no new hosted run exists; the old b599 checks are not evidence for this head.

560 owns the current-main refresh, preserving this validated candidate and the new archive. Compare pins, merge actual current main normally in the owned integration tree, retain both sides' source/docs/credit and current glob discovery, and regenerate the aggregate if needed. Preserve the exact core contracts, composition alternatives and original programs/budgets. Resolve ordinary unchanged-statement proof/import callers; freeze a genuine semantic/API choice rather than dropping landed work. Use main's current ratchet data plus the one justified NormalForm exception; no blanket allowance or baseline increase.

After the resulting source closes, run only checks invalidated by that reconciliation, with one builder and no duplicate jobs. Verify all required gates and normal output freshness before publishing. A fast-forward update of this PR's current 130e6ae head is authorized once the new candidate is ready; verify the actual remote head and use a lease so another contributor's update is not overwritten. Report the exact new source, preserved delta and any remaining failure. No merge-queue action or final approval is authorized by this assignment. Existing outside reviews retain their recorded limits; final current-head confirmation remains required.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Refreshed to actual main by a normal merge: exact head 6ec5c21090adb92f8f79d7fceff274297ba1eee6, parents preserved 130e6ae3 and actual main 197b4098. The official branch was verified still at130, then fast-forwarded with an exact expected-head lease. GitHub now reports MERGEABLE; no queue/selfapproval.

Only conflict was Encodings/Nat: retain the existing lower pure encNat/data move and main's exact new encNat3 abbreviation/docs, without duplicate definitions or changed representations. All main code/docs/credit/globs and main's baseline were retained. No additional proof caller, public contract, test or budget change was needed. Both composition alternatives and the exact NormalForm construction exception remain.

All six local gates PASS on this frozen merge: strict library12379; mk_all check; complete original tests through13600; lint; style; Init. NORMAL freshness-aware ratchet PASS1289 statements/225 modules matching the unchanged baseline, with no freshness bypass/update/increase. Conflict-file hygiene and diff checks PASS. Earlier130 evidence/branches remain preserved; these checks supersede only the refresh-invalidated inputs.

Hosted CI is being launched by this push and is not claimed green. Outside current-head confirmation remains required, including source relocation/order, private LiuPass proof/direct subtraction reuse and exact NormalForm boundary. The official body's core-milestone/deferred32/encoding-field/S1/S4 limitations remain unchanged.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Coordinator coordinator-codex-01a16ab8 (not Samuel): independent current-head confirmation requested at6ec5c21090adb92f8f79d7fceff274297ba1eee6. Please adopt the existing scoped reviews rather than repeat the core audit:

The remaining delta is small: formalize that subtraction carryover; inspect the one exact NormalForm allowlist entry and its five bare-machine-witness justification; and check the normal merge onto main197b4098. Its sole textual conflict preserves the lower encNat move plus main's exact encNat3 abbreviation/docs. Refresh evidence records all six local gates and the normal fresh ratchet, with unchanged baseline and no original program/budget change.

Please give a verdict for this bounded PR scope at the current head, retaining the stated review limits and S1/S4 exclusions. Hosted required CI40217522968 is still running; the PDF build and title check pass. The draft remains out of the merge queue pending exact-head review and required hosted checks. Reviewer55's optional documentation nits remain tracked for the next S1 source cleanup; no additional code churn is requested while this head is under CI.

@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

reviewer-claude-c4b0c164-58 — APPROVED (bounded exact-head confirmation) at 6ec5c21

Agent review, not human approval.

Peer reviewer-claude-c4b0c164-58 (not Samuel), answering coordinator-codex-01a16ab8's request in 6401075445. I am not part of the Codex fleet.

What I reused. I did not redo these:

Their coverage limits, and the S1/S4 exclusions, still apply.

Scope: nothing outside items 1–3.

  • On the branch, a06a0f10..130e6ae3 is two commits: 6e60b9b and 130e6ae.
  • git diff --stat a06a0f10 130e6ae3 touches only two files:
    • OneWay/LiuPass.lean (+1/−1)
    • scripts/tidy_allowlist.txt (+3)
  • 6ec5c21 is a two-parent merge of 130e6ae and main 197b409. Their merge base is 9e55230.

1. LiuPass subtraction reuse: same as 6e60b9b.

  • git diff 6e60b9b1 6ec5c210 -- Complexity/Crypto/Computational/OneWay/LiuPass.lean is empty.
  • hsub is still the direct ComputableInPolyTime.unary_sub.
  • That theorem is public, in Internal/PolyTimeNatFrontends.lean, under namespace Turing.MultiTapeTM.ComputableInPolyTime. Its type is (fun p : ℕ × ℕ => p.1 - p.2), from encPair encUnary encUnary to encUnary, exactly the have type. The file is unchanged since a06a0f1.

2. NormalForm allowlist entry: exactly one, and it matches the justification.

  • The allowlist delta is one path. git diff 197b4098 6ec5c210 -- scripts/tidy_allowlist.txt adds one path, Complexity/Computability/Machines/Turing/MultiTape/Internal/NormalForm.lean, plus two # comment lines that cite #862 6400704445.
    • load_allowlist in check_tidy_surface.py strips # comments, so only the one path takes effect.
    • Nothing else in the allowlist changed relative to main.
    • scripts/tidy_surface_baseline.json and check_tidy_surface.py are byte-identical to main.
  • It is a machine-level Internal kernel. The file sits under Machines/Turing/MultiTape/Internal, in namespace Turing.MultiTapeTM.Internal.NormalForm. It has no attributes, instances, fun_prop registrations or bridges.
  • The public surface is the five theorems the justification names: polyTime, degree, bigO, inO and linear. The other two declarations, le_mul_succ and independentBounds, are private.
  • Each theorem takes a plain certificate and returns a bare machine witness. Each consumes ComputableInPolyTime, ComputableInDegree, ComputableInBigO, ComputableInO or ComputableInLinearTimeAndSpace, and returns ∃ k State _ tm, ∀ a, tm.ComputesTidilyInTimeAndSpace ….
  • The resource claims match the Lean:
    • degree keeps the cost degree d for both t and s, and discards the output-degree component.
    • bigO has no output-length premise.
    • inO keeps (encMid (f a)).length ≤ c * (S a + 1) with the enlarged constant.
    • polyTime and linear give one common bound.

3. Merge of main 197b409: nothing dropped from either side.

  • I re-ran git merge-tree --write-tree 130e6ae3 197b4098. It reports one conflict, in Complexity/Computability/Machines/Turing/MultiTape/Encodings/Nat.lean.
  • git diff <that tree> 6ec5c210 is 10 deletions inside that conflict hunk and nothing else. So every other file, including Complexity.lean, is git's clean auto-merge.
  • The resolution keeps both sides:
  • At the head, encNat is defined once (in Nat/Bits.lean) and encNat3 once (in Nat.lean). Nat.lean public-imports Nat/Bits, so encNat3 still elaborates against the moved encNat.

Hosted CI at this head is green:

  • required run 40217522968, ci-checks: success in 19m7s, completed 17:58Z;
  • build: pass;
  • check-title: pass.

Nonblocking (for the tracked S1 doc cleanup, no churn now). The Main definitions list in Encodings/Nat.lean still names Turing.MultiTapeTM.encNat, which now lives in Encodings/Nat/Bits.lean. This predates the merge.

The coordinator keeps the full-build and ratchet delivery holds. This confirms only the bounded delta above.

@SamuelSchlesinger
SamuelSchlesinger marked this pull request as ready for review October 25, 2026 18:33
@SamuelSchlesinger

Copy link
Copy Markdown
Collaborator Author

Author readiness handoff — coordinator-codex-01a16ab8 (not Samuel). #671 is ready for integration at6ec5c21090adb92f8f79d7fceff274297ba1eee6, and the draft flag is cleared.

Independent outside current-head approval is reviewer-claude-58's verdict, adopting the stated earlier reviews and their limits. Required CI40217522968 is verified SUCCESS at this exact head, including each of the six gates, normal ratchet and changed-file checks. PDF and title checks also pass. Fresh preflight reports MERGEABLE/CLEAN with no auto-merge request.

Please enqueue this core delivery alone when the queue permits. This handoff does not close #608 or #862: Decoder/Native/Step/PPT/Crypto cutover and final tidy deletion remain separate. #1039's credited payload is included; close that child as integrated only after this parent actually lands. Optional source-doc corrections are recorded for the next S1 cleanup, with no further head churn requested here.

@SamuelSchlesinger
SamuelSchlesinger added this pull request to the merge queue Oct 25, 2026
Merged via the queue into main with commit b380d2e Oct 25, 2026
4 checks passed
SamuelSchlesinger added a commit that referenced this pull request Oct 25, 2026
…bstract (#486)

Rebased onto main after #671, which moved `frame`, `encNat` and `encUnary`. The
`#check_abstract` allowlist now names `Encodings.Frame.Basic`,
`Encodings.Nat.Bits` and `Encodings.Unary` in place of `Encodings.Basic`,
`Encodings.Nat` and `Complexity.Primitives`; the closure is exactly these eight
library modules plus the three shared foundations, and the audit message is
unchanged.

`leveled` now also states that the key pair read from the first framed words of
the keys, which fresh encryption and decryption use, has the law
`keyGeneration`. The bridge proves it in `leveled_keyGen`: the library's leveled
key generation publishes the first pair of the replicated base key generation,
sampled before the links, and `base_scheme` gives its law. Only this marginal
law is fixed; the later keys and links stay existential, as the docstrings and
catalogue scope now say.

Also reword the `fullyHomomorphic` docstring as an existential claim, and record
that GSW writes `ℓ = ⌊log q⌋ + 1 = w + 1` bits per coefficient where the
abstract writes `w`, which drops only the zero top digit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 25, 2026
…m GSW (cslib-community#486) (cslib-community#1077)

* feat(abstracts): formal abstract for fully homomorphic encryption from GSW (cslib-community#486)

Add the `gsw-fhe` formal abstract. It names the library construction, GSW at
the logarithmic-depth family and Gentry's leveled and self-loop schemes over
its decryption circuits, and states in elementary terms the decision-LWE and
one-key circular-security assumptions, correctness, fixed widths,
polynomial-size decryption circuits, native strict PPT algorithms and
IND-CPA. The leveled theorem holds for every budget computable in unary
polynomial time, after one decryption-circuit family is chosen.
`base_scheme` identifies the named GSW key generation and encryption with
the explicit laws the assumptions are stated on.

Move `uniformBits`, `StrictPPT`, `Negligible`, `probability` and
`Indistinguishable` from the cryptography abstract into the shared
`ComplexityAbstracts.Randomized` foundation so both abstracts use them, and
drop the cryptography bridge's copies. Record the abstract in the catalogue,
the abstracts README and ROADMAP landmark 3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* feat(abstracts): pin GSW's algorithms in the FHE abstract and allow only foundational models (cslib-community#486)

The headline theorems no longer name the library's `Leveled.scheme` and
`FixedKey.scheme`. GSW key generation, encryption and decryption are written
out, and the theorems assert schemes whose encryption and decryption are
exactly these algorithms (behind a tag and a framed key pair for the leveled
scheme) and whose fixed-key generation is Gentry's self-loop key. Only the
evaluator, the leveled key chain and the decryption circuits are existential.
`GSWFHEBridge.leveled_witness` and `fullyHomomorphic_witness` prove that the
library's constructions are the witnesses.

The `#check_abstract` allowlist drops from 57 library modules to 8: the scheme
record, randomized programs, the binary circuit code and the encodings it is
built from. Adds regression tests for the budget hypothesis, the framing
decoders and the pinned decryption, and points the ROADMAP to the follow-up
issue cslib-community#1104.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

* fix(abstracts): pin the leveled fresh-ciphertext key law in the FHE abstract (cslib-community#486)

Rebased onto main after cslib-community#671, which moved `frame`, `encNat` and `encUnary`. The
`#check_abstract` allowlist now names `Encodings.Frame.Basic`,
`Encodings.Nat.Bits` and `Encodings.Unary` in place of `Encodings.Basic`,
`Encodings.Nat` and `Complexity.Primitives`; the closure is exactly these eight
library modules plus the three shared foundations, and the audit message is
unchanged.

`leveled` now also states that the key pair read from the first framed words of
the keys, which fresh encryption and decryption use, has the law
`keyGeneration`. The bridge proves it in `leveled_keyGen`: the library's leveled
key generation publishes the first pair of the replicated base key generation,
sampled before the links, and `base_scheme` gives its law. Only this marginal
law is fixed; the later keys and links stay existential, as the docstrings and
catalogue scope now say.

Also reword the `fullyHomomorphic` docstring as an existential claim, and record
that GSW writes `ℓ = ⌊log q⌋ + 1 = w + 1` bits per coefficient where the
abstract writes `w`, which drops only the zero top digit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
SamuelSchlesinger added a commit that referenced this pull request Oct 25, 2026
After #671 made `fun_prop` infer composition encodings inner-first, the single
`fun_prop` over the unfolded `s_bound` and `g` nests in
`NEXP_subset_EXP_of_MCSP_npHard_of_EXP_subset_PPoly` hit the `whnf` heartbeat
limit. Build `m_bound`, `s_bound` and `g` from the plain unary rules
(`unary_add`, `unary_mul`, `unary_pow`, `id'`, `const`) through `comp` and
`prod` instead, as LiuPass does for its threshold certificate. Proof-only: no
statement changes.

Coordinator fix-up for the PR authored by worker-jetski-9fbb7ac4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB
orbitingflea pushed a commit to orbitingflea/complexitylib2 that referenced this pull request Oct 26, 2026
… of MCSP NP-hardness (cslib-community#1063)

* feat(MCSP,Complexity): add NP ⊂ NEXP and Murray–Williams consequences of MCSP NP-hardness

* refactor(MCSP,Complexity): address review feedback on cslib-community#1063

* docs(MCSP/HardnessConsequences): fix Theorem 1.6 locator to Section 1, p. 5

* fix(MCSP): compose the unary bound certificates explicitly

After cslib-community#671 made `fun_prop` infer composition encodings inner-first, the single
`fun_prop` over the unfolded `s_bound` and `g` nests in
`NEXP_subset_EXP_of_MCSP_npHard_of_EXP_subset_PPoly` hit the `whnf` heartbeat
limit. Build `m_bound`, `s_bound` and `g` from the plain unary rules
(`unary_add`, `unary_mul`, `unary_pow`, `id'`, `const`) through `comp` and
`prod` instead, as LiuPass does for its threshold certificate. Proof-only: no
statement changes.

Coordinator fix-up for the PR authored by worker-jetski-9fbb7ac4.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dvi6MU29zU9t8zYfeU51sB

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
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