Skip to content

Commit f784625

Browse files
authored
Merge pull request #8 from clayrat/patch-2
Induction: mention vscode-idris, fix typos, use `where` for local lemma
2 parents 2a5448d + 9241d3e commit f784625

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/Induction.lidr

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ file, or a .o file from a .c file. There are at least two ways to do it:
2323

2424
Open `Basics.lidr`. Evaluate `idris-load-file`.
2525

26-
There exists similar support for [Vim][idris-vim] and [Sublime
27-
Text][idris-sublime] as well.
26+
There exists similar support for [Vim][idris-vim], [Sublime
27+
Text][idris-sublime] and [Visual Studio Code][idris-vscode] as well.
2828

2929
[idris-mode]: https://github.com/idris-hackers/idris-mode
3030
[idris-vim]: https://github.com/idris-hackers/idris-vim
3131
[idris-sublime]: https://github.com/idris-hackers/idris-sublime
32+
[idris-vscode]: https://github.com/zjhmale/vscode-idris
3233

3334
- From the command line:
3435

@@ -40,7 +41,7 @@ file, or a .o file from a .c file. There are at least two ways to do it:
4041

4142
== Proof by Induction
4243

43-
We proved in the last chapter that `0` is a netural element for `+` on the left
44+
We proved in the last chapter that `0` is a neutral element for `+` on the left
4445
using an easy argument based on simplification. The fact that it is also a
4546
neutral element on the _right_...
4647

@@ -120,7 +121,7 @@ $\square$
120121

121122
=== Exercise: 2 stars, optional (evenb_S)
122123

123-
One inconveninent aspect of our definition of `evenb n` is that it may need to
124+
One inconvenient aspect of our definition of `evenb n` is that it may need to
124125
perform a recursive call on `n - 2`. This makes proofs about `evenb n` harder
125126
when done by induction on `n`, since we may need an induction hypothesis about
126127
`n - 2`. The following lemma gives a better characterization of `evenb (S n)`:
@@ -181,17 +182,16 @@ _ does not have an equality type ((n1 : Nat) ->
181182
```
182183

183184
To get `plus_comm` to apply at the point where we want it to, we can introduce a
184-
local lemma stating that `n + m = m + n` (for the particular `m` and `n` that we
185-
are talking about here), prove this lemma using `plus_comm`, and then use it to
186-
do the desired rewrite.
187-
188-
> plus_rearrange_lemma : (n, m : Nat) -> n + m = m + n
189-
> plus_rearrange_lemma = plus_comm
185+
local lemma using the `where` keyword stating that `n + m = m + n` (for the
186+
particular `m` and `n` that we are talking about here), prove this lemma using
187+
`plus_comm`, and then use it to do the desired rewrite.
190188

191189
> plus_rearrange : (n, m, p, q : Nat) ->
192190
> (n + m) + (p + q) = (m + n) + (p + q)
193191
> plus_rearrange n m p q = rewrite plus_rearrange_lemma n m in Refl
194-
192+
> where
193+
> plus_rearrange_lemma : (n, m : Nat) -> n + m = m + n
194+
> plus_rearrange_lemma = plus_comm
195195

196196
== More Exercises
197197

0 commit comments

Comments
 (0)