Skip to content

rw and simp do not invoke tactics specified in auto-params #3475

Open

Description

@leodemoura

Here is mwe provide by Jireh Loreaux.

theorem foo (m : Nat) (h : m.succ = 1 := by assumption) : m.succ = 1 := h

theorem foo' (m : Nat) (h : m.succ = 1) : m.succ = 1 := h

example (m : Nat) (h : m.succ = 1) : m.succ = 1 := by
  rw [foo'] -- succeeds, leaving the goal `⊢ m.succ = n`
  exact h

example (m : Nat) (h : m.succ = 1) : m.succ = 1 := by
  rw [foo _] -- succeeds, the autoParam fills the proof obligation

example (m : Nat) (h : m.succ = 1) : m.succ = 1 := by
  rw [foo]
  /-
  tactic 'assumption' failed

  m✝: Nat
  h: Nat.succ m✝ = 1
  m: Nat
  ⊢ Nat.succ m = 1
  -/

example (m : Nat) (h : m.succ = 1) : m.succ = 1 := by
  simp [foo _] -- succeeds, the autoParam fills the proof obligation

example (m : Nat) (h : m.succ = 1) : 1 + m.succ = 2 := by
  simp [foo] -- simp made no progress

The main obstacle is that to execute tactics we need to be in TacticM, but simp and rw implemented using MetaM. We had to address a similar issue for implementing custom discharge tactics for simp: https://github.com/leanprover/lean4/blob/master/src/Lean/Elab/Tactic/Simp.lean#L37

Activity

  1. added
    bug
    on Feb 23, 2024
  2. added
    P-medium
    on Sep 13, 2024
  3. j-loreaux commented on Dec 9, 2024

    @j-loreaux

    I know this is only marked P-medium, but I'm curious to know if there is any work-in-progress on this issue.

    An alternative (at least in my use case) would be to allow simp to collect sidegoals (only for explicit arguments, not type classes) that are then returned to the user. Of course, this would be useless for a generic simp call, but I think it could be useful in the context of simp only +allowSidegoals [some, specific, lemmas]. If useful, I could create a separate RFC for that idea.

    Barring this, I'll need to write my own tactic (which is possible, but not preferable if I can avoid it).

  4. YaelDillies commented on Feb 10, 2025

    @YaelDillies
    Contributor

    I think this issue is really important to fix. I've written an entire discrete analysis library based on the premise that it would make lemmas about eg convolution easier to use because they would have no integrability or measurability condition, meaning that rw would not create side goals and simp would work without providing it the integrability/measurability proofs.

  5. marked apply and auto-param bugs #10681 as a duplicate of this issue on Oct 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P-mediumbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions