Zulip Chat Archive

Stream: mathlib4

Topic: induction cases on the same line


Jeremy Tan (Mar 16 2025 at 23:46):

In #22533 I have some instances of induction where one or more of the initial cases are presented on the same line as the induction.

induction n with | zero => simp [geomSum] | succ n ih =>

It is legal syntax, but is this style an acceptable variant?

(@Yury G. Kudryashov, https://github.com/leanprover-community/mathlib4/pull/22533#discussion_r1997766857)

Yury G. Kudryashov (Mar 16 2025 at 23:47):

Note: Jeremy uses this syntax to replace something like

induction' n with n ih; · simp

Kyle Miller (Mar 16 2025 at 23:57):

I'm not sure I like having multiple cases on the same line like this, but that's style that's up for debate.

More importantly, I think in the future

induction x with | label a b c =>
tac1
tac2

will be an error if there's no indentation. This would be to support empty tactic blocks, without giving strange behavior. I don't know for certain yet.

Two future-proof options: (1) indent, or (2) use induction x with | label a b c => ?_ if you don't want to indent the following lines.

Damiano Testa (Mar 17 2025 at 08:24):

I might have been the one introducing the weird induction' ...; · simp syntax when I was cleaning up mathlib for adopting the multiGoal linter.

Damiano Testa (Mar 17 2025 at 08:24):

My personal preference would be to indent, though.


Last updated: May 02 2025 at 03:31 UTC