Replaced the fuel-bound MetaArtifact.declAt encoding with real
bidirectional reflection of Lean.Syntax through MetaArtifact.
## Why
The previous encoding capped Lean.Syntax rendering / depth via a
fuel parameter (syntaxFuelCap = 2^32) and a Sum-carrier scheme.
The .declAt round-trip lemma at MetaParse.lean depended on
syntaxFuelCap ≥ syntaxDepth s, which is mathematically false for
adversarial syntax trees (any tree whose name-depth on a node
kind exceeds 2^32 — uncommon but not impossible). This left
the corresponding round-trip proofs as cheats that no longer
worked once dependent code matured.
Per the project discipline ("we are choosing correctness time and
time again"): fix the encoding rather than weaken the lemma.
## What landed
Foundation/Meta.lean:
Replaced syntaxRenderAux / syntaxDepthFuel / syntaxFuelCap with:
· syntaxToLeanSource / syntaxArrayToLeanSource — mutual
structural rendering, total
· syntaxDepth / syntaxArrayDepth — mutual structural depth,
total
Foundation/MetaParse.lean:
Refactored parseSyntax?Aux / parseSyntaxList?Aux into a joint
parseSyntaxOrList?Aux : Nat → Bool → List Token →
Option ((Lean.Syntax ⊕ List Lean.Syntax) × ...)
Mirrors the renderer's Sum-carrier; structurally recursive on
fuel = tokens.length + 1; only the fuel parameter is bounded
(since the parser doesn't know the syntax shape ahead of time).
Added correctness round-trip lemmas:
· parseStringPosRaw?Aux_correct
· parseSubstringRaw?Aux_correct
· parseBool?Aux_correct
· parseSourceInfo?Aux_correct
· parseStringList?Aux_correct
· parsePreresolved?Aux_correct
· parsePreresolvedList?Aux_correct
· parseSyntaxOrList?Aux_correct (the master joint round-trip)
· parseSyntax?Aux_correct (specialisation at .inl s)
Added length bounds for the WF measure:
· stringPosRawToTokens_length_bound (and 5 other helper bounds)
· syntaxToTokens_length_bound / syntaxListToTokens_length_bound
(mutual structural induction; chains all helper bounds)
Replaced the cheat .declAt arms in parseArtifact?Aux_correct
(line 957) and artifactFromTokens?_round_trip (line 1078) with
real proofs derived from the new lemmas.
## Discipline
· Zero sorry / admit (only Comonad/Convolution.lean's interpolated
"... := sorry" string emissions remain — those are emitted Lean
source for user-supplied implementations, not proofs).
· Zero noncomputable / Classical.propDecidable.
· Zero TODO / FIXME / placeholder comments in source-rendering code.
· No tests deleted; the Test.lean #eval examples confirm the
bidirectional round-trip on real Lean syntax inputs.
## Verification
cd infoductor && lake build # Build completed successfully (12 jobs)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>