leanprover / leanprover/lean4

`grind` fails where `subst; grind` succeeds

Open
#11,631 2 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature P-medium
Dominant language
Lean
Stars
9.2k
Forks
990
Avg merge
1d 17h
Merged PRs (30d)
175

Description

Prerequisites
Description

Here is the example:

example (n t d B' t' : Int)
    (h1 : 4 * n = t ^ 2 - d * (2 * B' + 1) ^ 2)
    (h2 : t = 2 * t' + 1) :
    4 ∣ 1 - d := by
  grind -- fails

My current belief is that it fails because one of the propagators fires before cc runs using h2. Note that subst h2; grind succeeds.
I think this last observation is inconsistent with the description of grind here https://lean-lang.org/doc/reference/latest/The--grind--tactic/; since the subst h2; grind proof is using a congruence closure step before running grind, so this behaviour is confusing to beginners.

Context

This came up here: #ItaLean 2025 > Projects: Improve Automation @ 💬

Steps to Reproduce
  1. Code as above.

Expected behavior: grind fails.

Actual behavior: grind succeeds, or subst h2; grind also fails.

Versions

Lean 4.27.0-nightly-2025-12-11 on live.lean-lang.org

Impact

Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by running the minimal Int example with grind and with subst h2; grind on the referenced Lean nightly, then read the grind tactic documentation and trace the differing behavior. Done means the discrepancy is reproduced and the intended behavior is established with a regression test or a clearly confirmed explanation.

Written by the indexing model from the issue text.

Assessment

Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.