Zulip Chat Archive

Stream: new members

Topic: Broken chain of calcs


Darij Grinberg (Nov 15 2025 at 20:04):

This is me trying to prove something about points (triples of reals) as defined at the end of MiL section 7.1.

example : (1, 2, 3 : Point) + (2, 5, 9 : Point) = (3, 7, 12 : Point) := by
  ext
  calc ({ x := 1, y := 2, z := 3 } + { x := 2, y := 5, z := 9 }).x
  _ = 1 + 2 := rfl
  _ = 3 := by norm_num
  calc ({ x := 1, y := 2, z := 3 } + { x := 2, y := 5, z := 9 }).y
  _ = 2 + 5 := rfl
  _ = 7 := by norm_num
  calc ({ x := 1, y := 2, z := 3 } + { x := 2, y := 5, z := 9 }).z
  _ = 3 + 9 := rfl
  _ = 12 := by norm_num

The ext creates three goals. For some reason, the first calc correctly closes the first one, but the second (while registering as correct!) fails to close the second one, and the third is misunderstood as trying to solve the second goal. What's going wrong? I had similar issues in another proof. I can fix them by turning the calcs into haves, but I'd like to undersrtand what is goign wrong here.

Darij Grinberg (Nov 15 2025 at 20:06):

Interestingly, the problem goes away once I structure the argument using · , but then I have to remind Lean about the proper type for the {...}s (by tyepcasting them as Point).

Aaron Liu (Nov 15 2025 at 20:14):

At first glance I would guess a parsing problem, the first calc only ends when you unindent the lines but you haven't done the so it's interpreting the second calc as the next line of the first calc

Darij Grinberg (Nov 15 2025 at 20:33):

Interesting! So calc goes naturally with · then

Darij Grinberg (Nov 15 2025 at 20:33):

Reasonably so, I guess, given that it's a final tactic

Darij Grinberg (Nov 15 2025 at 20:33):

thank you!

Ruben Van de Velde (Nov 15 2025 at 20:46):

Does it help if you add an additional two spaces before each _ =?

Darij Grinberg (Nov 15 2025 at 20:49):

That works, too!

Kevin Buzzard (Nov 15 2025 at 23:33):

If the ext creates three goals then really your next move should be to add three \cdots to get back to one goal, three times.


Last updated: Dec 20 2025 at 21:32 UTC