Loogle Search

作者 parcadeid07ff4b06b62無授權條款3.9K 個星標收錄於 2026年10月8日更新於 2026年10月8日儲存庫8 個月前更新

Search Mathlib for lemmas by type signature pattern

AI 產生的概覽

使用 Loogle 工具依型別簽章模式在 Mathlib 中搜尋引理。

功能
此技能說明如何使用 Loogle(針對 Lean Mathlib 函式庫的搜尋工具),依型別簽章模式而非引理名稱進行查詢。它記錄了查詢語法,例如萬用字元、型別變數與以逗號分隔的名稱限制,並提供範例搜尋與 JSON 輸出。它也說明如何執行本機 Loogle 伺服器以加快查詢,以及在 Lean 證明中套用找到的引理。
適用情境
當你知道所需型別或引理的形狀但不知道名稱時,當你想了解某個型別有哪些可用引理時,或在 Lean 中進行型別導向的證明搜尋時使用。
執行需求
需要 Loogle 工具以及建置完成的 Loogle 索引(約 343MB);文件提到用 lake 建置 Loogle,並可選擇執行本機伺服器。此技能不附帶指令碼,僅提供說明。

Loogle Search - Mathlib Type Signature Search

Search Mathlib for lemmas by type signature pattern.

When to Use

  • Finding a lemma when you know the type shape but not the name
  • Discovering what's available for a type (e.g., all Nontrivial ↔ _ lemmas)
  • Type-directed proof search

Commands

bash
# Search by pattern (uses server if running, else direct)loogle-search "Nontrivial _ ↔ _"loogle-search "(?a → ?b) → List ?a → List ?b"loogle-search "IsCyclic, center"
# JSON outputloogle-search "List.map" --json
# Start server for fast queries (keeps index in memory)loogle-server &

Query Syntax

PatternMeaning
_Any single type
?a, ?bType variables (same variable = same type)
Foo, BarMust mention both Foo and Bar
Foo.barExact name match

Examples

bash
# Find lemmas relating Nontrivial and cardinalityloogle-search "Nontrivial _ ↔ _ < Fintype.card _"
# Find map-like functionsloogle-search "(?a → ?b) → List ?a → List ?b"# → List.map, List.pmap, ...
# Find everything about cyclic groups and centerloogle-search "IsCyclic, center"# → commutative_of_cyclic_center_quotient, ...
# Find Fintype.card lemmasloogle-search "Fintype.card"

Performance

  • With server running: ~100-200ms per query
  • Cold start (no server): ~10s per query (loads 343MB index)

Setup

Loogle must be built first:

bash
cd ~/tools/loogle && lake buildlake build LoogleMathlibCache  # or use --write-index

Integration with Proofs

When stuck in a Lean proof:

  1. Identify what type shape you need
  2. Query Loogle to find the lemma name
  3. Apply the lemma in your proof
lean
-- Goal: Nontrivial G from 1 < Fintype.card G-- Query: loogle-search "Nontrivial _ ↔ 1 < Fintype.card _"-- Found: Fintype.one_lt_card_iff_nontrivialexact Fintype.one_lt_card_iff_nontrivial.mpr h

來源與署名

來源:parcadei/continuous-claude-v3位於.claude/skills/loogle-search提交d07ff4b

授權條款: 無授權條款

內容歸原作者所有。SourceWeft 從公開儲存庫中收錄這些內容。

檢舉或申請下架