Zulip Chat Archive
Stream: new members
Topic: rcases vs. obtain
Kenny Lau (Jun 29 2025 at 19:56):
What is rcases doing now that we have obtain?
Kenny Lau (Jun 29 2025 at 20:25):
aha, rcases clears the hypothesis as well! i just bumped into a case where this was useful.
Notification Bot (Jun 29 2025 at 20:25):
Kenny Lau has marked this topic as resolved.
Aaron Liu (Jun 29 2025 at 20:27):
obtain also clears the hypothesis???
Notification Bot (Jun 29 2025 at 20:28):
Kenny Lau has marked this topic as unresolved.
Kenny Lau (Jun 29 2025 at 20:28):
oh, that's right too, lol
Kyle Miller (Jun 29 2025 at 20:33):
Having both lets you write in boustrophedon order so your eyes don't get as tired reading Lean code.
obtain ⟨a,b,c⟩ := x
rcases a with ⟨d,e,f⟩
obtain ⟨g,h,i⟩ := d
rcases g with ⟨j,k,l⟩
Aaron Liu (Jun 29 2025 at 20:34):
but which one is ltr and which one is rtl
Kenny Lau (Jun 29 2025 at 20:37):
the other one!
Aaron Liu (Jun 29 2025 at 20:42):
rcases lets you omit the pattern and obtain lets you delay the value
Aaron Liu (Jun 29 2025 at 20:43):
but obtain lets you omit the pattern too...
Ruben Van de Velde (Jun 29 2025 at 20:45):
Jokes aside, they're functionally the same
Ruben Van de Velde (Jun 29 2025 at 20:46):
I'd be inclined towards deprecating rcases, though I'm not sure it's worth the churn in mathlib
Aaron Liu (Jun 29 2025 at 20:47):
oh but when you obtain without a pattern it goes into this and when you rcases without a pattern it splits the discriminant into cases
Ruben Van de Velde (Jun 29 2025 at 20:47):
Also I'd prefer if we could merge obtain into have/let, but not sure if there's appetite for that
Kevin Buzzard (Jun 29 2025 at 20:48):
Commelin pointed out to me that obtain is a word and rcases is a mathlibism, and I've never used rcases since.
Aaron Liu (Jun 29 2025 at 20:49):
what does rcases even stand for? "recursive cases"?
Last updated: Dec 20 2025 at 21:32 UTC