Zulip Chat Archive

Stream: mathlib4

Topic: simp! does not unfold abbrevs


Yakov Pechersky (Nov 11 2022 at 00:16):

In lean3, this works:

variables {α : Type*} [has_mul α] [inhabited α]

abbreviation Left (a : α) : α := a * default
abbreviation Right (a : α) : α := default * a

theorem mul_comm (a b : α) : a * b = b * a := sorry

example (a : α) : Left a = Right a := by simp! [mul_comm]

In mathlib4, one has to be more explicit:

variable {α : Type _} [Mul α] [Inhabited α]

abbrev Left (a : α) : α := a * default
abbrev Right (a : α): α := default * a

theorem mul_comm (a b : α) : a * b = b * a := sorry

example (a : α) : Left a = Right a := by
  simp! [mul_comm] -- doesn't solve
  sorry

example (a : α) : Left a = Right a := by
  simp! [Left, Right, mul_comm] -- even this doesn't solve
  sorry

example (a : α) : Left a = Right a := by simp [Left, Right, mul_comm] -- this does solve

Mario Carneiro (Nov 11 2022 at 04:17):

reported as lean4#1815


Last updated: Dec 20 2023 at 11:08 UTC