Skip to content

feat: add progress tracking commands and auto-blueprinting - #11

Open
Deep0Thinking wants to merge 12 commits into
hanwenzhu:mainfrom
Deep0Thinking:main
Open

feat: add progress tracking commands and auto-blueprinting#11
Deep0Thinking wants to merge 12 commits into
hanwenzhu:mainfrom
Deep0Thinking:main

Conversation

@Deep0Thinking

Copy link
Copy Markdown

Add interactive and CLI commands for tracking formalization progress, plus an auto-blueprinting mode.

Demo

LeanArchitect_new_commands_PR_demo.mov

Progress tracking

4 new commands, each with a corresponding CLI subcommand:

Command Purpose
#blueprint_progress Aggregated formalization stats with optional per-module breakdown
#blueprint_incomplete Incomplete nodes sorted by dependency completion
#blueprint_status <node_name> A node's status and its blocking dependencies
#blueprint_impact <node_name> Reverse dependencies and what formalizing a node would unblock

All support a local modifier to restrict scope to the current file/given modules.

Auto-blueprinting

set_option blueprint.all true includes all declarations with docstrings in the blueprint without requiring @[blueprint] tags. The docstring becomes the statement text, the LaTeX environment is inferred from the declaration kind, and explicit @[blueprint ...] takes precedence. Scope is current file only.

Co-authored-by: Claude (Opus 4.6) claude@anthropic.com


Open in Gitpod

Add `#blueprint_progress` command and `stats` CLI subcommand to display
formalization progress stats.
…breakdown` options

- `#blueprint_progress` now aggregates across all imports with per-module breakdown
- Add `local` and `nobreakdown` options (`#blueprint_progress [local] [nobreakdown]`)
- CLI `stats` accepts space-separated modules with `--local`/`-l` and `--nobreakdown`/`-n` flags
- Fix percentage rounding to be consistent between aggregate and per-module
…naming

- Add `#blueprint_impact` to show reverse dependencies and which nodes
  would be unblocked by formalizing a given node
- Rename `#blueprint_next` to `#blueprint_incomplete`
- Rename CLI `stats` to `progress` to match `#blueprint_progress`
- Show `n/m (pct%)` format with aligned columns across all commands
- Show dep fraction and status in Blocking and Would-unblock sections
- Omit module column in interactive output (names are clickable)
- Unify node structures into shared `NodeEntry` with `DepFracWidths`
…docstrings

- `set_option blueprint.all true` includes all docstring'd declarations in the blueprint without requiring explicit `@[blueprint]` tags
- Statement text comes from docstring, latexEnv from declaration kind, dependencies and status are auto-inferred as usual
- Explicit `@[blueprint ...]` overrides auto-mode for specific declarations
- Declarations without docstrings are excluded (docstring is the opt-in signal)
- Scope is current file only; imported modules are not auto-blueprinted
- Add `findBlueprintNode?` and `getLocalBlueprintNodes` wrappers to transparently handle auto-nodes alongside explicitly tagged nodes
- Add `MonadOptions` constraint to `collectUsed` and output functions
Deep0Thinking and others added 3 commits April 8, 2026 11:40
…are `@[blueprint]`

`set_option blueprint.all true` previously only affected interactive commands;
`lake build :blueprint` (which runs the extractor in a separate process) ignored
it, so auto-blueprinted declarations never reached the generated blueprint.

- `getBlueprintContents` now also materializes auto-nodes for the module being
  extracted when `blueprint.all` is set in the passed options (set it via the
  lakefile's `leanOptions` so the extractor receives it).
- A bare `@[blueprint]` (no `statement := ...`) now uses the declaration's
  docstring as its statement, matching auto-mode instead of rendering empty.
- README: document the lakefile `leanOptions` route and the docstring fallback.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…edges

Auto-nodes (from `blueprint.all`) are materialized at extraction time and never
register a `latexLabel → Lean name` mapping the way the `@[blueprint]` attribute
does. So in `NodeWithPos.toLatex`, `getLeanNamesOfLatexLabel` returned `[]` and
`allNodes` was empty, causing: empty `\lean{}`, a vacuously-true `\mathlibok`,
and no `\uses{}` edges (the dependency graph had no edges).

- `NodeWithPos.toLatex`: fall back to the node's own name when no label mapping
  is registered.
- `mkAutoNode`: never auto-blueprint declarations from library modules
  (`Init`/`Lean`/`Std`/`Batteries`/`Mathlib`), so inferred `\uses{}` edges point
  only at project nodes that actually exist in the blueprint, not at e.g. `Eq`.
- Factor the library-module check into `isLibraryDecl`; reuse it for `isMathlibOk`.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add a subsection explaining why auto-mode renders `lemma`/`proposition`/etc.
as `\begin{theorem}` (Lean discards the surface keyword across the Mathlib
macro expansion to `theorem`), with two recipes for controlling the env:
per-declaration `@[blueprint (latexEnv := ...)]` and a project-side
`macro_rules` block (in a drop-in `MyProject/Blueprint.lean`) that attaches
the attribute automatically. The macro form captures the optional
`docComment` separately so the rewritten attribute lands in the resulting
`theorem`'s own modifiers, sidestepping the `declModifiers`-slot conflict
that breaks the more obvious shape.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant