added link to Nextjournal

This commit is contained in:
wadler 2020-01-10 10:58:41 -03:00
parent 26ead770bf
commit fc5f645ecb
2 changed files with 29 additions and 1 deletions

View file

@ -59,8 +59,12 @@ Pull requests are encouraged.
* Prabhakar Ragde, University of Waterloo,
[2019](https://cs.uwaterloo.ca/~plragde/842/)
- A paper describing the book appeared in [SBMF][sbmf].
- A notebook version of the textbook
is available at [NextJournal][nextjournal].
It lets you edit and execute the book via a web interface.
[wen]: https://github.com/wenkokke
[phil]: https://homepages.inf.ed.ac.uk/wadler/
[GitHub]: https://github.com/plfa/plfa.github.io/
[sbmf]: https://homepages.inf.ed.ac.uk/wadler/topics/agda.html#sbmf
[nextjournal]: https://nextjournal.com/plfa/ToC

View file

@ -354,6 +354,30 @@ reverse of the second appended to the reverse of the first:
reverse (xs ++ ys) ≡ reverse ys ++ reverse xs
```
reverse-++-distrib : ∀ xs ys → reverse (xs ++ ys) ≡ reverse ys ++ reverse xs
reverse-++-distrib [] ys =
begin
reverse ([] ++ ys)
≡⟨⟩
reverse ys
≡⟨ sym (++-identityʳ (reverse ys)) ⟩
reverse ys ++ reverse []
reverse-++-distrib (x ∷ xs) ys =
begin
reverse ((x ∷ xs) ++ ys)
≡⟨⟩
reverse (xs ++ ys) ++ [ x ]
≡⟨ cong (_++ [ x ]) (reverse-++-distrib xs ys) ⟩
(reverse ys ++ reverse xs) ++ [ x ]
≡⟨ ++-assoc (reverse ys) (reverse xs) [ x ] ⟩
reverse ys ++ (reverse xs ++ [ x ])
```
#### Exercise `reverse-involutive` (recommended)
A function is an _involution_ if when applied twice it acts