Zulip Chat Archive

Stream: Berkeley Lean Seminar

Topic: Can I have multiple hypotheses of the same name?


Kentarô YAMAMOTO (Jun 09 2020 at 20:30):

It's sometimes tedious to give all hypotheses a decent name (and I don't always like the default names that Lean comes up with.) So it's tempting to reuse names, as in have h := h.1. I expect Lean to use the latest definition whenever a variable occur more than once in the context, and my observation so far is consistent with my expectation. But is that what it really does?

Kevin Buzzard (Jun 09 2020 at 20:39):

Yes, it uses the one it finds first, which is the one you defined last.

Kevin Buzzard (Jun 09 2020 at 20:40):

Note though that if you're really done with the old h you can replace h := h.1. You don't really want your local context becoming too big.

Patrick Lutz (Jun 09 2020 at 20:42):

clear will also remove unwanted hypotheses

Patrick Lutz (Jun 09 2020 at 20:42):

tactic#clear


Last updated: Dec 20 2023 at 11:08 UTC