Zulip Chat Archive

Stream: new members

Topic: rw does not work, but exact does


Bolton Bailey (Sep 03 2024 at 05:36):

I recently encountered this problem while updating my mathlib dependency. How do I rewrite this h term?

import Mathlib

example (x :  ) (h: ¬ x = 0) : 1  x := by
  -- exact Nat.one_le_iff_ne_zero.mpr h -- Works
  -- rw [← Ne.def] at h invalid field notation
  rw [ Nat.one_le_iff_ne_zero] at h -- Did not find ≠ 0

Rida Hamadani (Sep 03 2024 at 05:49):

have you tried rewriting ne_eq at h first?

Bolton Bailey (Sep 03 2024 at 05:50):

That solves it, thank you!

Bolton Bailey (Sep 03 2024 at 05:51):

Is Ne.def just deprecated then? Shouldn't there be a deprecation notice if so?

Rida Hamadani (Sep 03 2024 at 05:59):

@loogle "Ne.def"

loogle (Sep 03 2024 at 05:59):

:shrug: nothing found

Rida Hamadani (Sep 03 2024 at 06:00):

I think you can rewrite Ne instead

Ruben Van de Velde (Sep 03 2024 at 08:58):

Ne.def also works, probably

Richard Copley (Sep 03 2024 at 15:27):

Ruben Van de Velde said:

Ne.def also works, probably

It used to! But not any longer. It was removed from Mathlib.Logic and callers changed to Ne.eq_def in "chore: move to v4.8.0-rc1 (#12548)". Ne.eq_def is maybe autogenerated (an "unfolding lemma"?), I guess, because I can't seem to find its definition.

Ruben Van de Velde (Sep 03 2024 at 15:29):

Oh, I suppressed that memory. Thanks for the correction


Last updated: May 02 2025 at 03:31 UTC