fixed error in Lists

This commit is contained in:
wadler 2020-01-10 11:02:28 -03:00
parent 77a87549f6
commit 1fd075440f

View file

@ -354,29 +354,6 @@ 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