Zulip Chat Archive

Stream: new members

Topic: Mathematics in Lean 3.3. help with problem


lame_lexem (May 05 2024 at 17:08):

Hi. I am completing chapter 3.3 and i am stuck at this question.

solution

Ralf Stephan (May 05 2024 at 17:16):

The state that you have after the intro h' is the same as when you had said by_contra h', so you need to show a contradiction now. No idea if this is the right way, but hey, I'm a newb.

lame_lexem (May 05 2024 at 17:34):

Oh ok. :sweat_smile: I solved it the same way the previous ones were solved by obtaining the contra proof, and applying something from the mathlib.

solution

But I am still a bit unsure about [h _ h'] syntax used in the linarith solution.
Is there a pice of docs i can read about it?

Ted Hwa (May 05 2024 at 18:06):

But I am still a bit unsure about [h _ h'] syntax used in the linarith solution.

When you write linarith [h _ h'] you are asking linarith to use the fact h _ h' in addition to all the other facts in the context. In this case, the _ is inferred as x so it would be equivalent to write [h x h'] (h x h' is the fact you used in the previous solution). When you write the _ , you are asking Lean to infer the missing parameter from the other parameters. Since h' is of type x > 0, and h is looking for a hypothesis of type ε > 0, the _ is inferred as x.

The _ is useful when you have a complicated expression. Imagine h' was (some complicated expression) > 0. Then you could write _ and Lean would infer the complicated expression, rather than forcing you to type it in.


Last updated: May 02 2025 at 03:31 UTC