Skip to content

Commit da3e30a

Browse files
committed
feat(Push): include constant being pushed in the error message
1 parent da2b32b commit da3e30a

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

Mathlib/Tactic/Push.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def elabDischarger (stx : TSyntax ``discharger) : TacticM Simp.Discharge :=
211211
def push (cfg : Config) (disch? : Option Simp.Discharge) (head : Head) (loc : Location)
212212
(failIfUnchanged : Bool := true) : TacticM Unit := do
213213
let cfg := { distrib := cfg.distrib || (← getBoolOption `push_neg.use_distrib) }
214-
transformAtLocation (pushCore head cfg disch? ·) "push" loc failIfUnchanged
214+
transformAtLocation (pushCore head cfg disch? ·) s!"push {head}" loc failIfUnchanged
215215

216216
/--
217217
`push c` rewrites the goal by pushing the constant `c` deeper into an expression.

MathlibTest/push_neg.lean

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,27 +145,26 @@ example (h : p ∧ q) : ¬¬(p ∧ q) := by
145145
exact h
146146

147147
-- new error message as of https://github.com/leanprover-community/mathlib4/issues/27562
148-
/-- error: `push` made no progress anywhere -/
148+
/-- error: `push Not` made no progress anywhere -/
149149
#guard_msgs in
150150
example {P : Prop} (h : P) : P := by push Not at *
151151

152152
-- new behaviour as of https://github.com/leanprover-community/mathlib4/issues/27562
153153
-- (Previously, because of a metavariable instantiation issue, the tactic succeeded as a no-op.)
154-
/-- error: `push` made no progress at `h` -/
154+
/-- error: `push Not` made no progress at `h` -/
155155
#guard_msgs in
156156
example {x y : ℕ} : True := by
157157
have h : x ≤ y := test_sorry
158158
push Not at h
159159

160160
-- new behaviour as of https://github.com/leanprover-community/mathlib4/issues/27562 (previously the tactic succeeded as a no-op)
161-
/-- error: Cannot run `push` at `inductive_proof`, it is an implementation detail -/
161+
/-- error: Cannot run `push Not` at `inductive_proof`, it is an implementation detail -/
162162
#guard_msgs in
163163
def inductive_proof : True := by
164164
push Not at inductive_proof
165165
trivial
166166

167-
-- XXX: can the error message mention the constant being pushed?
168-
/-- error: `push` made no progress on the goal -/
167+
/-- error: `push Not` made no progress on the goal -/
169168
#guard_msgs in
170169
example {P : Prop} (h : P) : P := by push Not
171170

0 commit comments

Comments
 (0)