Zulip Chat Archive

Stream: new members

Topic: advanced addition world level 7


Nam (Apr 11 2020 at 18:42):

what is wrong with this solution that it keeps saying , is expected?

  split,
  exact add_right_cancel _ _ _,
  induction t on d hd,
  repeat {rw add_zero},
  exact id,
  intro h,
  rw succ_eq_add_one,
  repeat {rw ← add_assoc},
  rw t_ih,
  refl,
  rw h,
  refl,

Kevin Buzzard (Apr 11 2020 at 18:42):

Please post a MWE

Kevin Buzzard (Apr 11 2020 at 18:43):

Oh I just saw the title. Hang on.

Nam (Apr 11 2020 at 18:43):

sorry, the context is http://wwwf.imperial.ac.uk/~buzzard/xena/natural_number_game/

Kevin Buzzard (Apr 11 2020 at 18:45):

induction t on d hd this line is bad.

Kevin Buzzard (Apr 11 2020 at 18:46):

induction t with d hd,

Kevin Buzzard (Apr 11 2020 at 18:46):

(and then you won't get a t_ih)

Kevin Buzzard (Apr 11 2020 at 18:46):

If you just change it to induction t, it works

Kevin Buzzard (Apr 11 2020 at 18:48):

In VS Code you clearly see the error on on.

Nam (Apr 11 2020 at 18:49):

that's useful! thanks.

Kevin Buzzard (Apr 11 2020 at 18:49):

But NNG is most easily played via the website.

Nam (Apr 11 2020 at 18:50):

it is kinda upsetting too that we need an IDE to spot the error.

Kevin Buzzard (Apr 11 2020 at 18:50):

The interface is very primitive really. It was written by mathematicians ;-)

Kevin Buzzard (Apr 11 2020 at 18:51):

But it's just about good enough to make it playable.

PV (Apr 11 2020 at 18:53):

what's the "on" actually doing in that case? I've made that typo a few times.

Kevin Buzzard (Apr 11 2020 at 18:59):

In VS Code it just says "I don't know what you're talking about with the on"

Kevin Buzzard (Apr 11 2020 at 19:01):

The induction tactic succeeds, Lean finds "on" and doesn't know what to do because it was expecting , or with, so it gives an error saying it was expecting ,, and then just proceeds as normal with the induction having succeeded.

Kevin Buzzard (Apr 11 2020 at 19:02):

The error I get with the original code is

27:14: error:
invalid 'begin-end' expression, ',' expected

and indeed it is the 14th character on the 27th line which is the problem, which is the o in on

Nam (Apr 11 2020 at 20:40):

what does exact succ_ne_zero(a + b) H, mean? does succ_ne_zero(a + b) return a lambda, and then it applies to H?

Kevin Buzzard (Apr 11 2020 at 20:41):

Probably succ_ne_zero (a + b) is a proof that succ(a + b) \ne 0, and in Lean X \ne Y is defined to mean (X = Y) -> False, so maybe H is a proof of succ(a + b) = 0

Kevin Buzzard (Apr 11 2020 at 20:41):

and the goal was false?

Nam (Apr 11 2020 at 20:42):

yes. my question was about the syntactic meaning of that clause.

Kevin Buzzard (Apr 11 2020 at 20:42):

The answer to your question is yes.

Kevin Buzzard (Apr 11 2020 at 20:43):

succ_ne_zero (a + b) : (succ (a + b) = 0) -> false

Kevin Buzzard (Apr 11 2020 at 20:43):

(I just fixed several missing succ errors)

Nam (Apr 11 2020 at 20:44):

ah, i think i've got it now. thanks Kevin.


Last updated: Dec 20 2023 at 11:08 UTC