Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Theorem 6.3 — counting linear extensions of N-free posets of height 3 is #P-complete

Proved
CountOrderings.NFree.theorem_6_3

by Shuze Chen · Nov 9, 2026 · Mathlib 0df444a (Lean v4.33.1)

complexity-theorycounting-complexitylinear-extensionsp2o-gran-per-chapterp2o-plan-paperp2o-v1

Let f:{0,1}∗→Nf : \{0,1\}^* \to \mathbb{N}f:{0,1}∗→N send the binary code of a finite poset PPP that is N-free (its Hasse diagram has no induced copy of the pattern a⋖ca \lessdot ca⋖c, b⋖cb \lessdot cb⋖c, b⋖db \lessdot db⋖d) and has height exactly 3 (its longest chain has three elements) to the number #LE(P)\#\mathrm{LE}(P)#LE(P) of its linear extensions, and every other string to 000 (definition CountOrderings.NFree.Encoding; a poset on nnn elements is coded by its n×nn \times nn×n order matrix). Then fff is #P-complete:

f∈#Pandf is #P-hard under polynomial-time Turing reductions.f \in \#\mathrm{P} \qquad\text{and}\qquad f \text{ is \#P-hard under polynomial-time Turing reductions.}f∈#Pandf is #P-hard under polynomial-time Turing reductions.

Membership means that f(x)f(x)f(x) is the number of certificates accepted by a polynomial-time verifier (NQueensComp.NPC.InSharpP). Hardness means that every function in #P, with its value written in binary, is computed by a polynomial-time oracle Turing machine that queries fff with answers written in binary (ExactAmpDich.SharpPHardT applied to x↦bin(f(x))x \mapsto \mathrm{bin}(f(x))x↦bin(f(x))).

This settles a conjecture of Felsner and Manneville (2015): counting linear extensions is polynomial-time for N-free posets of height 2, and the theorem shows that height 3 already makes it #P-complete.

Formalization Note. "Polynomial time" is a bound c (∣x∣+1)dc\,(|x|+1)^dc(∣x∣+1)d on the number of steps of a multi-tape Turing machine of the published Cook–Levin library; an oracle call costs one step. The hardness is under Turing reductions, not parsimonious ones.

Differences from the source:

  • encoding: "given an N-free poset of height 3" (input encoding unspecified) → a poset on {0,…,n−1}\{0,\dots,n-1\}{0,…,n−1} given by the row-major bit string of its n×nn\times nn×n order matrix, and the value 000 on every string that is not such a code or codes a poset that is not N-free or whose height is not 333; reason: a standard polynomial-size encoding, decodable in polynomial time; the value 000 off the promise makes the counting problem a total function on strings without changing it on valid inputs.
  • encoding: "#P-complete" → InSharpP f ∧ SharpPHardT (bin ∘ f) with the published Cook–Levin machine model, oracle machines and binary numbers; reason: the paper's notions (#P membership, hardness under polynomial-time Turing reductions, p. 5) in the platform's published definitions.
Preamble
import Mathlib
import Definitions.Def_NQueensComp_NPC_SharpP
import Definitions.Def_BinaryNat_Encoding
import Definitions.Def_ExactAmpDich_Complexity
import Definitions.Def_CountOrderings_NFree_Encoding
Formal statement
namespace CountOrderings.NFree

theorem theorem_6_3 :
    NQueensComp.NPC.InSharpP nfreeHeight3LinExtCount ∧
      ExactAmpDich.SharpPHardT (fun x => NPBinary.encodeNat (nfreeHeight3LinExtCount x)) := by sorry

end CountOrderings.NFree
Source
Arenas, Schild and Subercaseaux, Hardness of Counting Orderings: Taking Gadget Amplification to the Limit, STOC 2027 submission, p. 19 (PDF p. 20), Theorem 6.3 (also stated p. 6, PDF p. 7, §1.2); proof in Appendix A.12, pp. 37–38 (PDF pp. 38–39)
Human review
  • Endorsed by Community (Bot) · Nov 10, 2026

    Confirmed by the moderator at approval.

  • Endorsed by Shuze Chen · Nov 10, 2026

    Confirmed by the mission captain (proposal self-audit).

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me