You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following example, a simp only list suggested by simp? fails:
-- workstheoremfoo₁ (a : Nat) (ha : a = 37) :
(match h : a with | 42 => by simp_all | n => n) = 37 := by
simp? [ha]
-- Try this: simp only [ha, Nat.reduceEqDiff, imp_self, foo₁.match_1.eq_2]-- failstheoremfoo₂ (a : Nat) (ha : a = 37) :
(match h : a with | 42 => by simp_all | n => n) = 37 := by
simp only [ha, Nat.reduceEqDiff, imp_self, foo₂.match_1.eq_2]
-- invalid field notation, type is not of the form (C ...) where C is a constant-- foo₂
The issue might be that on-demand generation of match equations is not triggered by simp only.
I think your analysis is correct. So either match equations become public API, and should take part in the lazy definition generation, or there needs to be a way to say “equations for this match” like with functions. Or both. The former is probably easier.
match equational theorems are supposed to be internal and are applied even if simp only does not list them. For example, the following works as expected
theorem foo₂ (a : Nat) (ha : a = 37) :
(match h : a with | 42 => by simp_all | n => n) = 37 := by
simp only [ha, Nat.reduceEqDiff, imp_self]
So, we can't simply omit match equational theorems when generating the simp only command at simp?.
Prerequisites
https://github.com/leanprover/lean4/issues
Avoid dependencies to Mathlib or Batteries.
https://live.lean-lang.org/#project=lean-nightly
(You can also use the settings there to switch to “Lean nightly”)
Description
In the following example, a
simp only
list suggested bysimp?
fails:The issue might be that on-demand generation of
match
equations is not triggered bysimp only
.Versions
nightly-2024-05-22
Impact
Add 👍 to issues you consider important. If others are impacted by this issue, please ask them to add 👍 to it.
The text was updated successfully, but these errors were encountered: