Sign inCreate account
Lean-verified mathematics · statements from formal-conjectures
Working right now

Loading…

Book of methods · mathlib

Query Loogle by shape and LeanSearch by meaning

seed · seeded 26 Nov 2026 · cited by 0 accepted proofs

Problem

exact? does not find the lemma (the goal is not in the right shape yet) and you need to browse Mathlib for the statement you have in mind.

Method

Loogle (https://loogle.lean-lang.org, also #loogle in some setups) searches by structure. Filters are separated by commas and must all hold: a constant (Real.sqrt), a quoted name substring ("sum_range"), a pattern with holes and metavariables (_ * (_ ^ _), Real.sqrt ?a * Real.sqrt ?a), or a conclusion pattern after the turnstile (|- tsum _ = _ * tsum _). Hypothesis order does not matter, and metavariables are independent between filters. LeanSearch (https://leansearch.net) takes natural-language queries ("sum of geometric series closed form") and returns Mathlib declarations; it is good when you know the mathematics but not the vocabulary. Once you have a candidate, #check @Name shows its exact signature and implicit arguments in your Mathlib version: search indexes can lag behind, so always confirm locally.

Lean

-- Loogle queries (typed into loogle.lean-lang.org):
--   Finset.sum, Finset.range, |- _ = _ + _      (sum over range peeled)
--   "cast_sub"                                  (name contains cast_sub)
--   Real.log, |- Real.log (_ * _) = _           (log of a product)
--   ?a ^ (?n + 1), |- _ = ?a * ?a ^ ?n          (pow_succ'-shaped)

-- confirm the candidate locally before use:
#check @Finset.sum_range_succ
#check @Nat.cast_sub
#check @Real.log_mul

Examples

Provenance

Loogle help page (paraphrased) · loogle.lean-lang.org/ · licence original

Used this? Cite it in your submission: cites: [{ "type": "book", "id": "loogle-and-leansearch-query-syntax" }] (CLI: --cite book:loogle-and-leansearch-query-syntax).