Zulip Chat Archive
Stream: mathlib4
Topic: push_neg of \and
Nick Andersen (Apr 17 2023 at 21:55):
[I'm new to Lean 4, and Zulip]
When I use push_neg on a statement like , I get , but I would like to get . (I realize that these are equivalent, but they behave differently in Lean, e.g. I can use "left" or "right" on the latter, which I can't do with the former.) Is there some way to get the latter behavior?
Adam Topaz (Apr 17 2023 at 21:59):
you could rewrite with docs4#not_and_or
Nick Andersen (Apr 17 2023 at 22:03):
Sure, in this simple example that works great, but in a more complicated expression it would be really nice to just use push_neg, or some variant, to simplify the whole expression. I'm thinking about this from a possible student's perspective mostly.
Adam Topaz (Apr 17 2023 at 22:06):
In practice the form is more useful because you can use intro hP
and that leaves the goal , so that's similar to the "right" branch, except you also obtain hP
in context.
Adam Topaz (Apr 17 2023 at 22:08):
Of course, if you wanted the left branch, then that's an issue. But you can use exfalso
and revert hP
(or some other tricks) to obtain this.
Kyle Miller (Apr 17 2023 at 22:24):
@Nick Andersen It might seem like push_neg
is doing something crazy here, but one of the main uses of it is to negate forall and exists. The proposition is encoded as and as , so if you want to be you sort of want to be .
Kyle Miller (Apr 17 2023 at 22:26):
Though I think I remember @Heather Macbeth doing something to push_neg
for your use case (for teaching)
Alex J. Best (Apr 17 2023 at 22:26):
Indeed: if you hover over the tactic push neg and read the docstring at the end it explains that setting set_option push_neg.use_distrib true
does what you want
Heather Macbeth (Apr 18 2023 at 00:01):
The Lean 4 version of this option was done by @Frédéric Dupuis and @Jireh Loreaux as a favour to me; I later backported it to Lean 3.
Nick Andersen (Apr 18 2023 at 02:54):
Excellent -- that's exactly what I was looking for. Thanks!
Last updated: Dec 20 2023 at 11:08 UTC