Skip to content

Fix search to resolve abbreviations by expanding their body#977

Merged
strub merged 1 commit intomainfrom
search-abbrev
Apr 13, 2026
Merged

Fix search to resolve abbreviations by expanding their body#977
strub merged 1 commit intomainfrom
search-abbrev

Conversation

@strub
Copy link
Copy Markdown
Member

@strub strub commented Apr 13, 2026

Summary

  • Fix search command to correctly handle bare abbreviation names (e.g. search mu1)
  • Previously, the abbreviation body was wrapped in a lambda over its arguments, producing an unmatchable pattern — the search always returned no results
  • Now, abbreviation arguments are registered as pattern variables and the body is used directly as the search pattern

Test plan

  • search mu1 returns results (67 lemmas from Distr)
  • search (mu1 _ _) returns the same results (applied form, already worked)
  • search mu still works (plain operator, unchanged path)
  • Zero-argument abbreviations still use the fast ByPath lookup
  • Repeated-variable abbreviations (bar x = foo x x) correctly match/exclude

Previously, searching for a bare abbreviation name (e.g. `search mu1`)
would wrap the abbreviation body in a lambda over its arguments, producing
a pattern like `fun d x => mu d (pred1 x)`. No axiom contains such a
lambda as a subformula, so the search always returned no results.

Instead, register the abbreviation arguments as pattern variables and use
the body directly as the search pattern. This correctly matches axioms
containing the expanded form of the abbreviation.
@strub strub added the bug label Apr 13, 2026
@strub strub self-assigned this Apr 13, 2026
@strub strub requested a review from Gustavo2622 April 13, 2026 11:57
@strub strub enabled auto-merge April 13, 2026 12:01
@strub strub added this pull request to the merge queue Apr 13, 2026
Merged via the queue into main with commit a66989b Apr 13, 2026
16 checks passed
@strub strub deleted the search-abbrev branch April 13, 2026 12:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants