Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extra calc style #566

Open
wants to merge 1 commit into
base: lean4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions templates/contribute/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,25 @@ theorem reverse_reverse : ∀ (l : List α), reverse (reverse l) = l
_ = a :: l := rfl
```

However, because the expressions and proofs are relatively short, the following style
might be preferable in this situation.
The following style has the substantial advantage of having all lines be interchangeable, which is
particularly useful when editing the proof in eg VSCode:

```lean
import Init.Data.List.Basic

open List

theorem reverse_reverse : ∀ (l : List α), reverse (reverse l) = l
| [] => rfl
| (a :: l) => calc
reverse (reverse (a :: l))
_ = reverse (reverse l ++ [a]) := by rw [reverse_cons]
_ = reverse [a] ++ reverse (reverse l) := reverse_append _ _
_ = reverse [a] ++ l := by rw [reverse_reverse l]
_ = a :: l := rfl
```

If the expressions and proofs are relatively short, the following style is also an option:

```lean
import Init.Data.List.Basic
Expand Down