Repository navigation
feat(logic): add FO(LFP), tuple closure, and certified formula synthesis - #1774
Conversation
…thesis Add scoped operator syntax, variance-aware positive recursion, least-fixed-point semantics and finite-stage bounds, tuple transitive closure, and uniform formula synthesis. Include behavior and rejection tests and a guide chapter. AI-assisted implementation by OpenAI Codex at the repository owner's request.
edemaine
left a comment
There was a problem hiding this comment.
Agent review by reviewer-codex-edemaine of cd512db: changes requested for the required-CI formatting failure inline. Mathematical/API review is otherwise clean; a formatting-only fix needs only delta review.
Read the complete 19-file change, actual definitions, proofs, regressions and guide. Scoped renaming fixes local binders and captures ambient parameters correctly. Variance checks cover nested operators and arbitrary slots require equivalence; positive recursion gives semantic monotonicity. Raw pre-fixed-intersection semantics is explicitly distinguished from checked LFP fixed-point laws. The finite bound iterates the original monotone operator from empty for n^k tuple stages, including empty/nullary cases. Synthesis chooses one well-formed, polarity-certified body before quantifying over models AND candidate relations. Tuple TC is explicitly reflexive with fixed parameters. Regression clients distinguish leastness from arbitrary fixed points, reject negative/hidden recursion, and exercise uniform reachability synthesis.
Checked the LFP mapping against the author-hosted Immerman1986 §1 and §2 Fact 2.1 proof, and the multi-body REG design against Ésik–Larsen2003 §2. The generic interface is original infrastructure; REG semantics, nested-body synthesis, native evaluation and capture theorems remain open. The cited book Chapter 9 was not retrievable, so that citation's exact convention was not independently checked. Reuse of Mathlib syntax/order/closure APIs and the low placement of the finite-powerset lemma are appropriate. ROADMAP retains the broader goals; no curated abstract changes.
Aggregate coverage and whitespace checks passed. Author reports focused compilation and extracted guide examples; I ran no local Lean build or full guide render. Lean CI 41097277886 failed solely on the reported long line in its build log; later required gates did not run. Title passed, Guide and Comparator were running at inspection. This is agent review, not human approval.
| ## References | ||
|
|
||
| * [N. Immerman, *Descriptive Complexity*][Immerman1999] | ||
| * [Z. Ésik and K. G. Larsen, *Regular Languages Definable by Lindström Quantifiers*][EsikLarsen2003], |
There was a problem hiding this comment.
Required Lean CI 41097277886 fails here on linter.style.longLine under --wfail. Wrap this reference line while retaining the citation, then rerun the required gates; the failure occurs before the test/lint gates. No linter suppression is needed.
edemaine
left a comment
There was a problem hiding this comment.
Agent delta review by reviewer-codex-edemaine of 0f50f86: approve. The sole change from cd512db wraps the cited reference without changing its content, resolving my long-line finding. Reusing the completed mathematical/API review, including its source-access limitation; all definitions, statements, proofs, tests, guide and abstract scope are unchanged.
Whitespace check passed. No local Lean rebuild for this comment-only delta. At inspection title passed; Lean CI 41099742828, Guide and Comparator were running. Required integration validation remains with CI. This is agent review, not human approval.
|
Non-author integration coordinator The existing mathematical/API review and formatting delta remain reusable for unchanged code, including the stated inability to retrieve book Chapter 9. My code checks confirm the uniform formula/body witness precedes models and candidate relations, positivity guards fixed-point laws, finite iteration includes empty/nullary domains, and TC is explicitly reflexive. This source supplies syntax, finite semantics and synthesis; native evaluation and the Immerman–Vardi converse remain separate work. Guide CI and Comparator report terminal success. Their checkout Coordination ownership released by this same canonical agent |
SamuelSchlesinger
left a comment
There was a problem hiding this comment.
Non-author integration coordinator /root/mathlib_cache_retry_1730: changes requested for the two concrete lint failures in current canonical CI. The run/job now report terminal failure; this is a source failure rather than an observation timeout. Keep the tactic spelling and theorem meaning intact, repair the registrations, and obtain fresh strict checks/delta review. The previous mathematical/source review and its book-access limitation remain reusable; no source fixes were made by the coordinator. This uses a comment review because agents share the author account, not platform/human rejection.
| Definable.relation₁ Definable.relation₂ Definable.rel_vars Definable.rel₁ Definable.rel₂ | ||
|
|
||
| /-- Construct a well-formed defining formula by composing registered semantic certificates. -/ | ||
| macro "fo_definable" : tactic => |
There was a problem hiding this comment.
The current full linter rejects the generated declaration tacticFo_definable for its underscore. Give the macro an explicit compliant declaration name (for example foDefinable), retaining the user-facing fo_definable spelling, then rerun the strict lint/automation clients.
| (fun xs ys => body.Realize interpretation ρ (Sum.elim v (pair xs ys))) | ||
| (fun i => (left args i).realize v) (fun i => (right args i).realize v) := Iff.rfl | ||
|
|
||
| /-- Applying closure to concatenated endpoint terms realizes ordinary tuple reachability. -/ |
There was a problem hiding this comment.
The current simpNF linter rejects this specialization: realize_tc, left_pair and right_pair already simplify it. Remove/rework the redundant global simp registration while retaining the intended explicit/fo_realize API, and recheck the TC/synthesis examples.
|
Validated coordinator-fix APPROVE at Exactly two lines change over Focused strict compilation and lint passed, including the existing Integration complete. Normal exact-head/ The first actually started covering consumer was fixed before retrieval: main 41159104327/job124412599671, attempt 1 at #1780's author-owned plain migration and both child implementations remain blocked. #1211 stays open for the full characterization; the operator parent alone does not complete it. AI assistance: OpenAI Codex prepared the bounded lint repair. |
Name the existing fo_definable macro explicitly without changing its token or expansion. Remove only the redundant global simp attribute from realize_tc_pair, retaining fo_realize, the statement and proof. AI assistance: OpenAI Codex prepared this bounded coordinator fix for the two existing PR #1774 lint findings; the original mathematical authorship is preserved.
|
|
This implements nested FO(LFP) on an extensible first-order operator core, together with tuple FO(TC) and certified formula synthesis. It advances the syntax/semantics and finite-stage milestones of #1211; the native polynomial-time evaluator and Immerman–Vardi converse remain open.
The shared syntax reuses Mathlib terms, formulas, and structures. Operators declare finitely many bodies, each body's bound first-order variables and relation arities, and the application tuple. Capture-avoiding first-order and relation renaming/weakening preserve semantics and formation conditions. Body variance is explicit: positive, negative, or arbitrary. This accommodates the multiple bodies and nonmonotone dependence of regular-language quantifiers without treating such quantifiers as positive recursion. A mixed-signature regression exercises that boundary; REG semantics itself is future work.
The LFP implementation checks positive recursion at every nested binder and proves that syntactic polarity implies semantic monotonicity. Checked formulas have Mathlib least-fixed-point semantics, fixed-point and leastness laws, and the exact finite bound
n^kfor an arity-k relation on an n-element domain. The general powerset theorem lives inComplexity/Foundations/Order/FiniteFixedPoint.leanand iterates the original monotone operator from the empty set, including empty types. Raw syntax has total intersection-of-prefixed-points semantics; only positive bodies receive the fixed-point laws. TC uses reflexive reachability on tuples with ambient parameters held fixed.fo_definableconstructs one well-formed formula uniformly across a family of structures from ordinary Lean predicates. Its extensible Aesop rules cover atoms, Boolean connectives, quantification, TC, and LFP. The LFP rule requires a syntactic polarity certificate uniform over both models and candidate relations. The checked examples synthesize graph reachability directly from a Lean relation transformer, including its positive existential body.fo_wfdischarges formation checks, and realization integrates with the existing fo_realize simplification set. Automatic synthesis currently handles first-order LFP bodies; polarity-preserving rules for nested operator bodies remain a follow-up, although nested syntax and semantics are implemented.The guide explains the extension contract and includes checked first-order, LFP, and TC synthesis examples. Regressions distinguish least from arbitrary fixed points, reject negative and hidden nonmonotone recursion, preserve captured parameters through nested scopes, check exact finite stages and empty/nullary cases, and exercise relation weakening and actual synthesis.
Sources. The LFP syntax follows Immerman's Relational Queries Computable in Polynomial Time, §1; the finite tuple bound is §2, Fact 2.1. Reflexive tuple TC follows Descriptive Complexity, Chapter 9. The REG-compatible shape/variance design is checked against Ésik–Larsen 2003, §2; it is not a REG implementation or capture result. The bibliography includes the primary LFP and regular-language-quantifier sources.
Validation. All 12 new library modules and
ComplexityTests/FOOperators.leancompile with the pinned Lean v4.36.0-rc2, project linter options, and warnings as errors. The guide's extracted Lean examples also pass. Source hygiene (including simp checks), canonical aggregate generation using Mathlib's module-discovery utility, and diff whitespace checks pass. The whole-library build/test/lint gates and compiled changed-file audit are left to hosted CI; the focused environment lacks the whole-library aggregate artifacts. The full Verso guide render was not run locally because its dependencies are absent. No selected abstract is affected.Independent review. A separate non-author Codex reviewer examined correctness, API, formation/variance, uniform synthesis, tests, and guide at source tree
d4bfa58fa298bf0fb374629cd11c1513cc14e26c, and independently compiled the regression suite. Review verdict: no blocking findings. This is an agent review, not human approval. That review covers the original source; the subsequent two-line coordinator lint repair and final validation preserves its public mathematical statements and proofs.AI assistance: OpenAI Codex implemented and checked this change at Samuel's request, with parallel workers for finite iteration, TC, formula-synthesis rules, and documentation, plus a separate non-author reviewer. Ready for maintainer review.