Citing a math theorem with errors I apologize if this has already been asked; I can't find this exact question.

Suppose author X writes a paper, and in this paper, they prove a result that is a very small part of their paper. However, the result has a mistake. Based on personal judgement, it appears the mistake is an innocent mistake that does not disrupt the intellectual flow of the paper. i.e. it is very reasonable to believe the author X had the ability themselves to get the proof right. In fact, it may have been simply a typo. Nonetheless, it is unarguably incorrect.

Author Y comes along and builds other results off of the (corrected) ideas by author X. Author Y wants to (for good reason) cite author X, as their results would not have been obtained without author X.

What is the correct way to do this in a paper? The way I see it, there are 2 possible actions for author Y:

1) Pretend like author X didn't make a mistake at all and give them full authority on their theorem.
2) Say something like ... "the results are based off the ideas by author X" but don't give as much of a "these are author X's results" flavor. Author Y then after mentioning author X, proves the theorem themselves.

Action 2) seems to be the most reasonable in the sense that it is intellectual honest and doesn't shame author X for no reason. However, is it considered plagiarism to be somewhat vague about what author X did?

Thank you.

EDIT: I realize another option is to allow author X to correct their mistake and then do action 1. But with how slowly paper publishing occurs, this seems unjustly detrimental to author Y so I don't consider it a real option.
Given the situation as you describe it, in particular that there is evidence that the author could have corrected the presumably-small mistake themselves, I'd recommend that you quote the true assertion, and/while noting, literally, that there is an easily correctible error or typo in the proof as written.

Catching typos is important, but is not "research", of course. And, yes, once typos or silly mis-statements are pointed out, many authors can repair them without hesitation. So I myself generally consider "paper X" to be "paper X with all trivial typos and obvious blunders corrected". (Still, yes, sometimes the boundary of this is not clear...)

In particular, yes, I give credit to authors for obtaining a result who've slightly messed up the argument, both for observing what is true, and for at least approximating the proof.