Zulip Chat Archive
Stream: new members
Topic: refl skip add_zero
Sailor (Aug 20 2021 at 21:28):
On the level 2 of addition world for exemple refl skip add_zero two times and do refl itself can someone explain me why ? qdqdqdz.PNG
Kevin Buzzard (Aug 20 2021 at 21:48):
Because although I don't explain this issue in the game, add_zero is true by definition so you can use refl
to prove it
Sailor (Aug 20 2021 at 21:58):
Thanks ;)
Sailor (Aug 20 2021 at 21:58):
And how do i know what is true by definition ?
Eric Wieser (Aug 20 2021 at 22:01):
Well, you can try exact rfl
and see when it works ;)
Kyle Miller (Aug 20 2021 at 22:03):
For the NNG, you're not meant to worry about the definitions since there are enough theorems to handle everything, but you can pull back the curtain by looking at the source code: https://github.com/ImperialCollegeLondon/natural_number_game/blob/master/src/mynat/add.lean#L10
Kyle Miller (Aug 20 2021 at 22:05):
That amounts to the following definition for addition:
m + 0 = m
m + succ(n) = succ(m + n)
(matching the NNG parenthesis convention)
Sailor (Aug 20 2021 at 22:06):
Ok thanks another question how can i tell lean to use a theorem on a succ d for exemple ?
Kyle Miller (Aug 20 2021 at 22:06):
In other words, what refl
does is automatically apply add_zero
and add_succ
wherever it is able to, and then it checks they're the same.
Sailor (Aug 20 2021 at 22:06):
like in this situation
image.png
Sailor (Aug 20 2021 at 22:07):
because when i want to assoc it assoc the left hand side
Sailor (Aug 20 2021 at 22:08):
and i want to specify add_assoc a succ d
Kyle Miller (Aug 20 2021 at 22:08):
put parentheses around succ d
Kyle Miller (Aug 20 2021 at 22:08):
so rw add_assoc a (succ d)
Sailor (Aug 20 2021 at 22:08):
Is this in the doc ?
Sailor (Aug 20 2021 at 22:08):
instead of bothering you
Kyle Miller (Aug 20 2021 at 22:09):
the "real" parenthesis convention is that (f a b c)
means
Sailor (Aug 20 2021 at 22:11):
Oh ok i'm a little confused that this is not rigorously defined in the beginning as im just "guessing" from my programming experience
Kyle Miller (Aug 20 2021 at 22:11):
Also, when there is an operator, like succ a + b + succ d
, this means (in normal math notation)
Sailor (Aug 20 2021 at 22:13):
I see right
Kyle Miller (Aug 20 2021 at 22:13):
I think the NNG walks a fine line between giving you just enough to be able to complete the tasks and giving you an information overload. It's fine coming here for clarification :smile:
Sailor (Aug 20 2021 at 22:16):
(deleted)
Kyle Miller (Aug 20 2021 at 22:18):
(re deleted comment, I completely understand, that tends to be my modus operandi, too.)
Sailor (Aug 20 2021 at 22:19):
But if your fine with it its ok ahah
Last updated: Dec 20 2023 at 11:08 UTC