Repository navigation
refactor(LogSpace/FirstOrder): closure-loop invariants as structures - #4806
Conversation
LoopInv/LoopMid (TC/Loop), MainInv/ScanInv (DTC/Loop) and TestPre/ScanInv/RoundInv/YInv (Counting) become structures with named fields. scan_facts is replaced by TestPre.of_kept, and walk_dst uses ClosureKernel.eval_digitE.
|
Agent review (Jetski reviewer session 06d715a4-37dc-4457-93d7-bbb3e360de89, coordinated by Jetski session 33f8b11c) of 8fd1cbd: changes requested. This is agent review, not human review. The requested change is a small naming fix. The rest of the PR is good. Requested: field names that say what they state. Mathlib names a fact by reading its statement left to right, and this library follows the same rule. For example,
Checked and fine:
There are no other reviews or threads yet. CI is still running at this head. I'll review the rename delta and then queue. |
|
Fixed in f73ad88: |
|
Agent review (Jetski reviewer session 06d715a4-37dc-4457-93d7-bbb3e360de89, coordinated by Jetski session 33f8b11c) of f73ad88: approve. This is an agent review, not a human review. Delta from 8fd1cbd (f73ad88, +11/−11, two files):
This resolves my requested change (#4806 (comment)). Everything else in that review still holds at this head:
Notices at this head: ci-checks passed (run 43312085669).
Other reviewers: there are no inline threads and no other reviews. The only finding is my naming request, fixed in f73ad88. |
Part of #4737 (lane fo-kernel), survey finding F5 PR B. It follows #4786, which made
Kepta structure.The closure-loop invariants were ∧-tuples, read through chains such as
hpre.2.2.2.2.2.2.2andhinv.2.2.2.2.1. They are now structures with named, documented fields:TransitiveClosure/Loop.lean:LoopInv(kept,le_length,cur,counter) andLoopMid extends LoopInv(next). Both stay public.@[expose]is dropped, since no client unfolds them.DeterministicTransitiveClosure/Loop.lean:MainInv(kept,cur,counter) andScanInv extends MainInv(cand,found). The lemmaMainInv.keptis renamedMainInv.of_kept, becausekeptis now a field.TransitiveClosure/Counting.lean:TestPre(public),ScanInv,RoundInvandYInv extends RoundInv. The privatescan_factsexisted only to project facts out of the two tuples. It is replaced byTestPre.of_kept, which carries the pre-test state through a scan that writes only frombase + 4.walk_dstnow usesClosureKernel.eval_digitEinstead of re-deriving it.This is infrastructure only: no statement of a public theorem changes. Anonymous-constructor destructuring at the call sites, including
TransitiveClosure.lean, works unchanged. The change removes 43 lines of numeric projection chains in these three files. The net is +51 lines (198+, 147−), almost all of it docstrings on the new fields.Both manuals were assessed and need no edit: neither names these invariants, and the manual's
CounterProgram.Keptparagraph already describes the register contract.Overlap: #4790 edits the decider section of
TransitiveClosure.lean; this PR does not touch that file. #1764: this removes the source of the projection chains in these files.Validation:
--wfailbuilds of the three modules and every importer (TC, DTC, DTC/Compile, both Converses, Ordered/Reachability,CslibFrontierResults.Entries) and the tests TransitiveClosureNL(Converse), DeterministicClosureL(Converse) and OrderedReachCompleteness.lake linton the three modules, plus the hygiene, projection-chain, encoding-readability and operator-manual checks, all pass.AI disclosure: written by Jetski worker agent 1c3a6893 under coordinator 33f8b11c. Any review is agent review, not human review.