Skip to content
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
28 changes: 28 additions & 0 deletions templates/contribute/style.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,34 @@ theorem Ordinal.sub_eq_zero_iff_le {a b : Ordinal} : a - b = 0 ↔ a ≤ b :=
fun h => by rwa [← Ordinal.le_zero, sub_le, add_zero]⟩
```

### Definitions with long proofs

When defining objects that contain long definitions and proofs, it is preferred to use
`where` and `finally`:
Comment on lines +303 to +304
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we really want to encourage where ... finally unless the function is recursive, as this creates extra top-level declarations.


```lean
def restrictFst (a : E') : Sobolev (E × E') F s 2 →L[ℂ] Sobolev E F s' 2 :=
f.extendOfNorm e
where
f := ..
e := ..
finally
· ..
· ..
```

In the more common case that there only long proof terms, but the definition
itself is short, `where` and `finally` should be written as

```lean
def restrictFst (a : E') : 𝓢(E × E', F) →L[𝕜] 𝓢(E, F) :=
compCLMOfAntilipschitz (g := fun x ↦ (x, a)) (K := 1) 𝕜 ?_ ?_
where finally
· ..
· ..
```


### Instances

When providing terms of structures or instances of classes, the `where`
Expand Down
Loading