@Kha I was writing the following example
```
...
induction as
| nil => cases h -- `h` is an empty type
| cons b bs ih => cases h
| head a bs => exact ⟨[], ⟨bs, rfl⟩⟩
| tail a b bs h1 => ...
```
The current `syntax` assumes the `| cons b bs ih => ...` alternative
is part of the first `cases h`. Forcing the `|` to occur in a column
>= of the corresponding `cases` is not a nice solution since it would
preven us from writing the second `cases` as I wrote it above.
That is we would have to write
```
induction as
| nil => cases h -- `h` is an empty type
| cons b bs ih =>
cases h
| head a bs => exact ⟨[], ⟨bs, rfl⟩⟩
| tail a b bs h1 => ...
```
or
```
induction as
| nil => cases h -- `h` is an empty type
| cons b bs ih => cases h
| head a bs => exact ⟨[], ⟨bs, rfl⟩⟩
| tail a b bs h1 => ...
```
I think the best solution is to use `with` when we have explicit
alternatives with `|`. The new syntax is similar to `match ... with | ...`
That is, we would write
```
...
induction as with
| nil => cases h
| cons b bs ih => cases h with
| head a bs => exact ⟨[], ⟨bs, rfl⟩⟩
| tail a b bs h1 => ...
```
@Kha I implemented the syntax for structure/class that we discussed this morning.
It is much cleaner. See new tests at `struct2.lean`.
I updated the documentation to use it.
closes#191
@Kha Note that it expands into a "let rec".
There are many other places where an optional `where`-clause is
useful. We can add them later. It is relatively easy to add support in
other places using the new helper functions
`expandWhereDeclsOpt` and `expandMatchAltsWhereDecls`
@Kha I implemented the optional `,` at structure instances.
You have suggested it a few weeks/months ago. F# also implements this
feature. I got back to it while write documentation for Lean.
It looks quite nice when we are packing many functions into a structure.
BTW, F# also has optional separators for list literals :)
This is a much simpler change for us since `[...]` is defined using
the `syntax/macro_rules` commands, but I didn't find optional ','
would very useful since our list literals are usually in a single
line.