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: attribute [grind] #6545

Merged
merged 4 commits into from
Jan 6, 2025
Merged

feat: attribute [grind] #6545

merged 4 commits into from
Jan 6, 2025

Conversation

leodemoura
Copy link
Member

This PR introduces the parametric attribute [grind] for annotating theorems and definitions. It also replaces [grind_eq] with [grind =]. For definitions, [grind] is equivalent to [grind =].

The new attribute supports the following variants:

  • [grind =]: Uses the left-hand side of the theorem's conclusion as the pattern for E-matching.
  • [grind =_]: Uses the right-hand side of the theorem's conclusion as the pattern for E-matching.
  • [grind _=_]: Creates two patterns. One for the left-hand side and one for the right-hand side.
  • [grind →]: Searches for (multi-)patterns in the theorem's antecedents, stopping once a usable multi-pattern is found.
  • [grind ←]: Searches for (multi-)patterns in the theorem's conclusion, stopping once a usable multi-pattern is found.
  • [grind]: Searches for (multi-)patterns in both the theorem's conclusion and antecedents. It starts with the conclusion and stops once a usable multi-pattern is found.

The grind_pattern command remains available for cases where these attributes do not yield the desired result.

@leodemoura leodemoura added the changelog-language Language features, tactics, and metaprograms label Jan 6, 2025
@leodemoura leodemoura enabled auto-merge January 6, 2025 02:51
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 6, 2025 02:58 Inactive
@leodemoura leodemoura added this pull request to the merge queue Jan 6, 2025
@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 6, 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 76f883b9995f684663e3106b08defec46f7a7f4c --onto dc5c8097b5ca053dd49b5de246add54c3e999734. (2025-01-06 03:09:02)

Merged via the queue into master with commit 2ed77f3 Jan 6, 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