Zulip Chat Archive

Stream: lean4

Topic: RFC: `rcases`/`obtain` should always clear a variable


Jovan Gerbscheid (Nov 29 2025 at 15:55):

I'm working on making by_contra! work with rcases patterns. A natural implementation as a macro would be as follows: by_contra! $pat => by_contra h; push_neg at h; obtain $pat := h. However, when pat is just a variable, then obtain $pat := h doesn't do anything, and leaves the hypothesis as this inaccessible h. So instead, I need to replace obtain $pat := h with revert h; rintro $pat, which I think is quite awkward.

Is there a reason why obtain h' := h doesn't rename h to h'?

Aaron Liu (Nov 29 2025 at 16:26):

what the

Aaron Liu (Nov 29 2025 at 16:26):

I definitely expected it to do something

Aaron Liu (Nov 29 2025 at 16:27):

is it just a noop

Aaron Liu (Nov 29 2025 at 16:37):

maybe this is a bug?

Joachim Breitner (Dec 01 2025 at 13:18):

Jovan Gerbscheid schrieb:

revert h; rintro $pat, which I think is quite awkward.

What’s the downside of this?

Jovan Gerbscheid (Dec 01 2025 at 13:31):

It is less efficient and gives a more verbose/confusing tactic implementation.


Last updated: Dec 20 2025 at 21:32 UTC