Skip to content

Commit 3bfbe16

Browse files
committed
fix(push_neg): preserve binder names (#31212)
This PR fixes the `push_neg` tactic so that it preserves binder names when pushing through `Exists`. It was previously picking up the `x` name from `∃ x, s x`, so spelling it as `Exists s` fixes the problem.
1 parent 2d5480e commit 3bfbe16

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

Mathlib/Tactic/Push.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ attribute [push ←] ne_eq
3030

3131
@[push] theorem not_iff : ¬ (p ↔ q) ↔ (p ∧ ¬ q) ∨ (¬ p ∧ q) :=
3232
_root_.not_iff.trans <| iff_iff_and_or_not_and_not.trans <| by rw [not_not, or_comm]
33-
@[push] theorem not_exists : (¬ ∃ x, s x) ↔ (∀ x, binderNameHint x s <| ¬ s x) :=
33+
@[push] theorem not_exists : (¬ Exists s) ↔ (∀ x, binderNameHint x s <| ¬ s x) :=
3434
_root_.not_exists
3535

3636
-- TODO: lemmas involving `∃` should be tagged using `binderNameHint`,

MathlibTest/push_neg.lean

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,8 @@ example {p q : Nat} : ¬ g.Adj p q := by
224224
exact test_sorry
225225

226226
end no_proj
227+
228+
-- test that binder names are preserved by `push_neg`
229+
/-- info: ∀ (a b : ℕ), ∃ c d, a + b ≠ c + d -/
230+
#guard_msgs in
231+
#push_neg ¬ ∃ a b : Nat, ∀ c d : Nat, a + b = c + d

0 commit comments

Comments
 (0)