Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 4.1 (Witness invariant): WM(v)≠0  ⟺  v∈LMW_M(v)\ne0\iff v\in L_MWM​(v)=0⟺v∈LM​ for every candidate v∈CMv\in C_Mv∈CM​

Proved
TreeEquivalenceHORS.Equivalence.lemma_4_1

by mikedeng1 · Nov 8, 2026 · Mathlib 0df444a (Lean v4.33.1)

counter-machinesp2o-batch-stoc27ap2o-gran-per-chapterp2o-plan-paperp2o-v1witness

Let MMM be a two-counter program and v∈CMv\in C_Mv∈CM​ a finite candidate prefix, with guard weight WM(v)W_M(v)WM​(v) (Equation (13)). Then

WM(v)≠0  ⟺  v∈LM,W_M(v)\ne0\iff v\in L_M,WM​(v)=0⟺v∈LM​,

that is, the weight is nonzero exactly when every guessed guard along vvv is correct. Illegal candidates, including those whose virtual counters have become negative, have weight zero.

This is the first-error argument that lets the compiled trees detect illegal guesses arithmetically.

Differences from the source:

  • encoding: candidate words over {1, 2}; virtual configurations in ℕ × ℤ² → List Choice with Choice.one = 1, Choice.two = 2, read left to right; configurations ℕ × ℤ × ℤ; δ (undefined outside I_M) returns its argument there; reason: the value of δ outside I_M is never used on candidates, which extend only active prefixes
Preamble
import Mathlib
import Definitions.Def_TreeEquivalenceHORS_Equivalence_Machines
Formal statement
namespace TreeEquivalenceHORS.Equivalence

/-- **Lemma 4.1 (Witness invariant)** (printed p. 13 / PDF p. 15). For every candidate prefix
`v ∈ C_M`, the guard weight is nonzero exactly on legal prefixes: `W_M(v) ≠ 0 ⟺ v ∈ L_M`. -/
theorem lemma_4_1 (M : Machine) (v : List Choice) (hv : M.IsCand v) :
    M.weight v ≠ 0 ↔ M.IsLegal v := by sorry

end TreeEquivalenceHORS.Equivalence
Source
Mingkun Xiao, Yixuan Sun, Tree Equivalence of Higher-Order Recursion Schemes Is Undecidable, STOC 2027 submission #421 (October 2026), source.pdf SHA-256 e875d09ced029e3f5cb114abba049e4a2b1bdaa9b064c98b0d71f2ec7451c7af, Lemma 4.1, printed p. 13 / PDF p. 15
Human review
  • Endorsed by Shuze Chen · Nov 8, 2026

    Confirmed by the moderator at approval.

  • Endorsed by mikedeng1 · Nov 8, 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