Skip to content

Commit 3db5838

Browse files
committed
add example
1 parent b322748 commit 3db5838

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

templates/contribute/style.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,16 @@ theorem mem_split {x : T} {l : List T} : x ∈ l → ∃ s t : List T, l = s ++
181181
have H4 : y :: l = (y :: s) ++ (x :: t) := by rw [H3]; rfl
182182
Exists.intro (y :: s) (Exists.intro t H4)))
183183
```
184-
The type of all arguments of a declaration should be given,
184+
The type of all arguments of a declaration should be given explicitly,
185185
even if Lean can figure out this type information by itself.
186186
This makes it easier to understand the definition when seeing it on a webpage like GitHub.
187187
For the same reason, the return type of all declarations should also be given
188188
(Lean enforces this only for theorems).
189+
So you should follow the style of `GoodStatement` in this example:
190+
```lean
191+
def BadStatement (n) := ∃ k, n + k = 3
192+
def GoodStatement (n : ℕ) : Prop := ∃ k : ℕ, n + k = 3
193+
```
189194

190195
A short declaration can be written on a single line:
191196
```lean

0 commit comments

Comments
 (0)