Zulip Chat Archive
Stream: new members
Topic: why does this fail?
JK (Aug 06 2025 at 10:03):
I would love to know what syntax I am getting wrong here:
example (a b : ℚ) (hb : b ≠ 0) : a / b = 1 ↔ a = b :=
div_eq_one_iff_eq a hb
JK (Aug 06 2025 at 10:04):
(Sorry, wrong thread. There doesn't seem to be any way to delete a message?)
JK (Aug 06 2025 at 10:04):
I would love to know what syntax I am getting wrong here:
example (a b : ℚ) (hb : b ≠ 0) : a / b = 1 ↔ a = b :=
div_eq_one_iff_eq a hb
Anthony Fernandes (Aug 06 2025 at 10:12):
Looking at the type of div_eq_one_iff_eq with #check div_eq_one_iff_eq, you can see that a and b are implicit parameters (they are in curly brackets). So you don't need to specify a and this works
import Mathlib
example (a b : ℚ) (hb : b ≠ 0) : a / b = 1 ↔ a = b :=
div_eq_one_iff_eq hb
JK (Aug 06 2025 at 10:13):
Thank you. But I don't see why providing the extra parameter a makes it fail...?
Robin Arnez (Aug 06 2025 at 10:13):
You can "delete" messages by editing them to (deleted)
Anthony Fernandes (Aug 06 2025 at 10:15):
It's just invalid syntax, if you need to specify extra parameters (for example if lean is not able to find them by itself), you can use thm_name (extra_param_name := value) .... So here it would be
import Mathlib
example (a b : ℚ) (hb : b ≠ 0) : a / b = 1 ↔ a = b :=
div_eq_one_iff_eq (a := a) hb
JK (Aug 06 2025 at 10:24):
OK. FWIW, the syntax with the additional parameter was what apply? suggested.
Ruben Van de Velde (Aug 06 2025 at 13:15):
import Mathlib
example (a b : ℚ) (hb : b ≠ 0) : a / b = 1 ↔ a = b :=
by apply?
Output:
Try this: exact div_eq_one_iff_eq hb
Notification Bot (Aug 06 2025 at 13:15):
3 messages were moved here from #new members > How do tactics "reach into" quantifiers. by Ruben Van de Velde.
Ruben Van de Velde (Aug 06 2025 at 13:18):
Anyway, this isn't so much incorrect syntax, but passing an argument that doesn't match the function you're passing it to
Last updated: Dec 20 2025 at 21:32 UTC