Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [grind_eq] attribute for the grind tactic #6539

Merged
merged 3 commits into from
Jan 5, 2025
Merged

Conversation

leodemoura
Copy link
Member

This PR introduces the [grind_eq] attribute, designed to annotate equational theorems and functions for heuristic instantiations in the grind tactic.
When applied to an equational theorem, the [grind_eq] attribute instructs the grind tactic to automatically use the annotated theorem to instantiate patterns during proof search. If applied to a function, it marks all equational theorems associated with that function.

@[grind_eq]
theorem foo_idempotent : foo (foo x) = foo x := ...

@[grind_eq] def f (a : Nat) :=
  match a with
  | 0 => 10
  | x+1 => g (f x)

In the example above, the grind tactic will add instances of the theorem foo_idempotent to the local context whenever it encounters the pattern foo (foo x). Similarly, functions annotated with [grind_eq] will propagate this annotation to their associated equational theorems.

@leodemoura leodemoura added the changelog-language Language features, tactics, and metaprograms label Jan 5, 2025
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 5, 2025 20:43 Inactive
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Jan 5, 2025
@leanprover-community-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Batteries/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. Try git rebase fd091d1dfe03b821ac2888921dfe7d13b6096b4a --onto dc5c8097b5ca053dd49b5de246add54c3e999734. (2025-01-05 20:54:51)

@leodemoura leodemoura added this pull request to the merge queue Jan 5, 2025
Merged via the queue into master with commit 675244d Jan 5, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-language Language features, tactics, and metaprograms toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants