rlean-search
Type-aware search over Lean 4 theorem, lemma, and axiom declarations.
Parses .lean sources (not .olean), understands Lake package layout, writes
XML indexes under the schema namespace
http://github.com/createyourpersonalaccount/rlean-search
and answers patterns such as:
| Pattern | Meaning |
|---|---|
_ + _ = 0 |
holes match any subexpression |
?a - ?a = 0 |
named holes must unify to the same term |
|- tsum _ = _ * tsum _ |
match only the main conclusion |
Build
Index
The default cache is a gzipped XML file (index.xml.gz) written with the
fastest gzip compression level for quick index dumps.
Lake-aware discovery reads lakefile.toml / lakefile.lean, srcDir, and
lean_lib roots, then walks .lean files (skipping .lake, build, etc.).
One-shot search (uses cache when present)
Daemon mode (Tokio, multi-client)
Keeps the full type index in memory for low-latency queries:
Clients speak JSONL or XML; the response format matches the request:
# JSONL
|
# XML
|
Commands: search, stats, reload, ping.
XML schema
See schema/rlean-search.xsd. Index documents look like:
...
∀ (n m : Nat), n + m = m + n
...
...
Tests
Fixtures under tests/fixtures/ are derived from Lean 4 / Mathlib 4 type shapes
(from the accompanying lean4-v4.32.2 / mathlib4-v4.32.2 sources):
Coverage notes
The type parser targets a useful fragment of Lean surface types: binders,
arrows/Pi, applications, common infix operators (+, *, =, ≤, ∧, ↔, …),
quantifiers, sorts, and search holes. Extremely advanced syntax may be stored as
raw nodes so declarations remain searchable by surface text and structure
where parsed.