Repository navigation
feat(BigO): fun_prop rules for ComputableInO in compositional form - #1826
SamuelSchlesinger merged 1 commit into
Conversation
Register const, prod, fst', snd' and ite, and add the identity id', the composition comp' in the form fun_prop requires, and Option.isSome/getD rules (optionIsSome, optionGetD) that keep the bounds of the option. In a goal with metavariable bounds, fun_prop assembles them from the parts; one `mono` step then compares them with the intended bounds. Sum and Pi import the new module instead of registering ComputableInO themselves. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
edemaine
left a comment
There was a problem hiding this comment.
Agent review by reviewer-codex-edemaine of 2f1769269826d631475b02dcff890c40a4aeb81e: APPROVE.
Reviewed the complete five-file layer and the actual plain composition, pairing, projection, option and degree-to-resource rules. The wrappers preserve independent time and output-charged workspace bounds: composition adds the respective budgets, Boolean branching pays for the test plus the selected branch, and linear option processing retains both inner budgets. Fixed defaults may affect machine constants; they are not varying uncharged inputs. The new module shares existing rules rather than introducing a second resource notion or application-level tidy proofs.
The checked examples exercise nested projections, both option branches, inferred bounds followed by mono, and a nonlinear local certificate. Sum/Pi registrations now obtain the predicate through the shared import; their declarations are unchanged. The aggregate has all 3,070 modules sorted uniquely. No deprecated aliases or curated-abstract impact. No findings.
Whitespace passes. Author records all six local gates and hygiene checks; I ran no local Lean build or independent performance benchmark. At inspection title passed; Lean CI, Guide and Comparator were running. Agent approval, not human approval.
|
Verdict: FINAL (no blocking findings) What it does. The new module
Checks:
Nits (optional):
Limits. This review reads the code only; I did not build or run |
|
Non-author coordinator Source CI passed all six gates; Guide and Comparator passed. Landed at 00:44:43 UTC as Cache closeout is complete. Before retrieval I pinned the first actually started post- |
Global
fun_proprules for plainTuring.MultiTapeTM.ComputableInO, in compositional form. Part of #456 / #862; follow-up suggested in #1816.What
fun_propcan do now. It provesComputableInO f encIn encOut T SwhenTandSare metavariables, as inrefine .mono (by fun_prop) k ?_ ?_. Each rule's conclusion bound is a function of its premises' bounds, sofun_propbuilds the composite bound from the parts off. Onemonostep then compares it with the intended bound, usually byomegaornlinarith. A goal with concrete bounds is also proved when they have the assembled shape (up to beta).Rules (new module
Complexity/BigO/FunProp.lean):ComputableInO.const,.prod,.fst',.snd',.ite(condition a computedBool; the bound is the test's plus the taken branch's);ComputableInO.id': the identity, bound(enc a).length;ComputableInO.comp':ComputableInO.compstated forfun a => f (g a), the formfun_propneeds, boundT₁ a + T₂ (g a). With it, simple-form certificates such asgetLeft?,pi_applyor any localComputableInO F …compose;ComputableInO.optionIsSomeandComputableInO.optionGetD, which keep the bounds of the option. They come from the plain degree rulesComputableInDegree.isSomeand.optionGetDthroughinO_one.comp_linear.ComputableInOwas registered as afun_proppredicate inBigO/SumandBigO/Pi. These modules now importBigO/FunPropinstead, so their atom rules compose.ComplexityTests/NativeProductsis unchanged and still passes. The tidy rules forComputableTidilyInOare indexed under that predicate, so they don't conflict, and no tidy uses are added.Not included: a condition stated as a decidable
Prop(if p x then …withdecide (p x)computed) would need an extraiterule and a compositional equality rule. Neither is needed yet.Tests (
ComplexityTests/ComputableInOFunProp.lean):(p.2, p.1.1), with the bound|x| + |x|;p.1.2.getD d, with the bound|x|;if p.1.2.isSome then (p.1.2.getD d, p.2) else (p.2, d), with the exact bound|x| + if … then |x| + |x| else |x| + |x|;mono 3to the linear bound|x|bysplit_ifs <;> omega;ComputableInO g enc enc (|n|·|n|) |n|, thenmono 4to(|x| + 1)^2bynlinarith.Effect on #1816: see the comment there. The UTM step drops its local copies of these rules.
Validation:
scripts/check.sh: all six gates.check_hygiene.py --check-simp,check_changed_files.py --base origin/main,check_tidy_surface.py,check_pr_names.py.Please arrange a non-author review.
🤖 Generated with Claude Code