A hand-written tokenizer + recursive-descent parser that reads
the Lean source emitted by `toLeanSource` and reconstructs the
original meta-mirror value. Foundation/MetaParse.lean: 300
lines, faithful to the renderer's exact format.
Components:
· Token type (parens, ident chains, string literals, num literals).
· `tokenize : List Char → List Token` (partial; structural
decrease is implicit via helpers).
· `parseName?`, `parseClassifier?`, `parseMetaCTerm?`,
`parseArtifact?` — recursive-descent, return Option (T × tail).
· `MetaCTerm.fromLeanSource?` / `MetaClassifier.fromLeanSource?`
/ `MetaArtifact.fromLeanSource?` — top-level wrappers
demanding full input consumption.
Foundation/Meta.lean: derive `DecidableEq` on `MetaCTerm` (its
field types — Lean.Name, String, MetaClassifier — all have
DecidableEq). Switch FaceFormula.eq0/eq1 encoding from
`Name.appendAfter "_eq_0"` (string suffix) to a 2-component
`Name.mkStr (.mkSimple "eq0") i.name` form so reflection
round-trips by rfl with no string-suffix munging.
Foundation/MetaParse.lean: parsers are `partial def` because
the recursive calls land on output tails of helper readers,
which Lean can't see as structurally smaller without auxiliary
"consumes input" lemmas. Kernel-reducible round-trip is
deferred — `native_decide`-based tests in Infoductor/Test.lean
witness round-trip operationally for every meta-mirror arm.
Tests: 11 native_decide examples covering empty/ident/sym/app/
lam/comp/transp on MetaCTerm, always/meet on MetaClassifier,
empty/cterm on MetaArtifact (artifact uses rendering-equivalence
since Lean.Syntax in `.declAt` lacks DecidableEq).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| Infoductor | ||
| .gitignore | ||
| Infoductor.lean | ||
| lake-manifest.json | ||
| lakefile.toml | ||
| lean-toolchain | ||
| LICENSE | ||
| NOTICE | ||
| README.md | ||
Infoductor
Generic Lean 4 library + tooling for algebraic organization of code
repositories. Provides the mechanism for declaring methodologies
that organize a Lean codebase — registries, attributes, the universal
restructure operation, the Edit monad / Context comonad pair —
without committing to which methodology a downstream project uses.
Pairs naturally with the Pantograph project (the conductor of an electric train sits atop the pantograph hardware). "Info-ductor" — it conducts information (structure, classifications, methodology) through your codebase.
Status
Phase A: Foundation lib landed (2026-05-01). Tactics, Pantograph plugin, and headless Runner sub-libs are planned but not yet present.
Sub-libraries
| Library | Status | Role |
|---|---|---|
Infoductor.Foundation |
✅ landed | Pure algebra: meta-mirror types, Edit monad, Context comonad, restructure, @[macroAlias] / @[methodology] / @[metaPath] attributes + registries. No domain commitments. |
Infoductor.Tactics |
planned | Reference dispatcher tactics (cubical_search-shaped) built on Foundation primitives. |
Infoductor.Pantograph |
planned | Plugin routing Pantograph commands into Foundation registries. |
Infoductor.Runner |
planned | Headless deployment surface for Edit.runHeadless etc. Lands when concrete deployment need arises. |
Foundation API
Meta-mirror types (Infoductor.Foundation.Meta)
MetaCType— the meta-types of source artifacts (theorem, definition, instance, structure, …).MetaClassifier— a lattice of "where in the codebase" predicates (always,never,atDecl n,inFile p,underAttribute a,dependencyOf n,inNamespace n, plusmeet/join).MetaArtifact— what gets placed at a meta-position (source/declAt/refTo/empty).MetaPosition—(declName, filePath, range?)addressing.
Edit / Context (Infoductor.Foundation.Edit)
Edit α— monad of source mutations.result : αpaired withops : List EditOp.Context α— comonad of "what's around here": focal artifact, position, siblings.extract/extendoperations.contextualEdit— distributive law lifting context-aware decisions into edits.
Restructure (Infoductor.Foundation.Restructure)
restructure (i ctx φ witness fallback)— the universal source- mutation operation. Same five-field shape as cubicalcomp, promoted to source-code level.- Frozen aliases:
transport_artifact,relocate_invariant,rename_throughout,define_question_shape,compose_proof_fragments,materialize. - Headless interpreter:
EditOp.apply,Edit.runHeadless. - Structural soundness:
Edit.brokenRefs,Edit.selfConsistent,Edit.guarded.
Registries
@[macroAlias](Infoductor.Foundation.MacroAlias) — register adefas a frozenrestructurealias.@[methodology Classifier](Infoductor.Foundation.Methodology) — register a theorem as a proof methodology indexed by classifier name.@[metaPath Source Target](Infoductor.Foundation.MetaPath) — declare a structural Path between two classifiers; powersderiveByTransport.tryEntryAsClosedprimitive — try a methodology entry as a goal closer; restores tactic state on failure.
Inspecting registries
#eval inside a Lean session:
#eval Infoductor.printAliases
#eval Infoductor.printMethodologies
#eval Infoductor.printMetaPaths
Building
lake build
Forgejo
http://maxgit.wg:3000/max/infoductor
License
See LICENSE.