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 simple strategy #6503

Merged
merged 4 commits into from
Jan 2, 2025
Merged

feat: grind simple strategy #6503

merged 4 commits into from
Jan 2, 2025

Conversation

leodemoura
Copy link
Member

This PR adds a simple strategy to the (WIP) grind tactic. It just keeps internalizing new theorem instances found by E-matching. The simple strategy can solve examples such as:

grind_pattern Array.size_set => Array.set a i v h
grind_pattern Array.get_set_eq  => a.set i v h
grind_pattern Array.get_set_ne => (a.set i v hi)[j]

example (as bs : Array α) (v : α)
        (i : Nat)
        (h₁ : i < as.size)
        (h₂ : bs = as.set i v)
        : as.size = bs.size := by
  grind

example (as bs cs : Array α) (v : α)
        (i : Nat)
        (h₁ : i < as.size)
        (h₂ : bs = as.set i v)
        (h₃ : cs = bs)
        (h₄ : i ≠ j)
        (h₅ : j < cs.size)
        (h₆ : j < as.size)
        : cs[j] = as[j] := by
  grind


opaque R : Nat → Nat → Prop
theorem Rtrans (a b c : Nat) : R a b → R b c → R a c := sorry

grind_pattern Rtrans => R a b, R b c

example : R a b → R b c → R c d → R d e → R a d := by
  grind

@leodemoura leodemoura added the changelog-language Language features, tactics, and metaprograms label Jan 2, 2025
@leodemoura leodemoura enabled auto-merge January 2, 2025 05:21
@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc January 2, 2025 05:29 Inactive
@leodemoura leodemoura added this pull request to the merge queue Jan 2, 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 2, 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 a08379ce2ee540a8733aec0e7b747a0a2608bccf --onto 2c87905d77b707c3283c1de759fd63269ac386a1. (2025-01-02 05:39:40)

Merged via the queue into master with commit 8d9d814 Jan 2, 2025
18 checks passed
mathlib-bors bot pushed a commit to leanprover-community/mathlib4 that referenced this pull request Jan 5, 2025
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