Formalize Fagin’s theorem in Complexitylib

Prove Fagin’s theorem in the Complexitylib formalization, establishing that existential second-order definability over finite structures captures NP within that development.

Background

The paper compares its Lean library with other mechanized complexity developments. It states that Complexitylib includes first- and second-order syntax over finite structures, but that Fagin’s theorem—the characterization of NP by existential second-order logic—remains open on that project’s roadmap.

This is an unresolved formalization problem rather than a new mathematical conjecture: the theorem is classical, but its mechanized proof in Complexitylib had not been completed according to the comparison presented in the paper.

References

Complexitylib, back over multi-tape machines, has the widest inventory: 29~classes at the revision we cite, with completeness for NP and coNP on three concrete problems, and, beside them, first- and second-order syntax over finite structures with one-dimensional first-order reductions, Fagin's theorem being open on its road map and no class defined through them.

— Descriptive Complexity in Lean: Completeness by First-Order Reductions  (2609.18261 - Senellart et al., 16 Sep 2026) in Section 6, “Related Work” (subsection label sec:related)