Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Lemma 5.1 (Syntactic compilation): GM⋄G^\diamond_MGM⋄​ is a well-formed scheme over Σ0\Sigma_0Σ0​ of order at most four

Proved
TreeEquivalenceHORS.Equivalence.lemma_5_1

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

compilershigher-order-recursion-schemesp2o-batch-stoc27ap2o-gran-per-chapterp2o-plan-paperp2o-v1

For every two-counter program MMM and side ⋄∈{L,R}\diamond\in\{L,R\}⋄∈{L,R}, the compiled scheme GM⋄G^\diamond_MGM⋄​ of Figure 3 is a finite, closed, well-typed deterministic HORS over Σ0={z:0,a:1,b:3}\Sigma_0=\{z:0,a:1,b:3\}Σ0​={z:0,a:1,b:3}, and

ord⁡(GM⋄)≤4.\operatorname{ord}(G^\diamond_M)\le4.ord(GM⋄​)≤4.

This is the static half of the intermediate compilation theorem.

Differences from the source:

  • encoding: finite, closed, well-typed deterministic HORS → Valid (one rule per nonterminal, start of type o, every body of type o with only declared references); finiteness and determinism hold for every HORS value; reason: finite lists encode the declarations and rule bodies; Valid enforces exactly one well-typed body per declared nonterminal
  • encoding: Σ₀ = {z:0, a:1, b:3}, Σ₂ = {e:0, d:2} → sigma0 = [0, 1, 3] (terminals 0 = z, 1 = a, 2 = b) and sigma2 = [0, 2] (0 = e, 1 = d); reason: a ranked alphabet is its list of arities, terminals named by position
Preamble
import Mathlib
import Definitions.Def_TreeEquivalenceHORS_Equivalence_Compiler
Formal statement
namespace TreeEquivalenceHORS.Equivalence

/-- **Lemma 5.1 (Syntactic compilation)** (printed p. 16 / PDF p. 18). For every source program `M`
and side `⋄`, the compiled scheme `G^⋄_M` is a well-formed (finite, closed, well-typed,
deterministic) scheme over `Σ₀` of order at most four. -/
theorem lemma_5_1 (M : Machine) (side : Side) :
    (compile side M).Valid ∧ (compile side M).alphabet = sigma0 ∧ (compile side M).order ≤ 4 := 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 5.1, printed p. 16 / PDF p. 18
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