Zulip Chat Archive

Stream: lean4

Topic: autoParam cause `rw` not to unify


Jireh Loreaux (Feb 20 2024 at 16:51):

The following is a consequence of autoParam, and it can be a bit inconvenient. Is this a bug, or intentional for some reason? This affects both rw and simp.

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

Jireh Loreaux (Feb 21 2024 at 21:32):

bumping this thread because it seems it got lost in the weeds yesterday.

Jannis Limperg (Feb 21 2024 at 21:59):

Leo recently fixed some issues with autoParams in simp, so if you haven't tried this with a very recent nightly yet, that could be worth a shot.

Kyle Miller (Feb 21 2024 at 22:19):

I just tried it on a master branch from today, and it has the same errors

Jireh Loreaux (Feb 21 2024 at 22:19):

I updated the example because Leo pointed out that the right hand side has a metavariable

Jireh Loreaux (Feb 21 2024 at 22:19):

@Kyle Miller did you try it with the updated example above?

Matthew Ballard (Feb 21 2024 at 22:26):

I second Kyle’s findings.


Last updated: May 02 2025 at 03:31 UTC