add missing function, todo items

This commit is contained in:
2024-12-03 16:41:33 -08:00
parent f573736b7f
commit ee50677d4b
2 changed files with 16 additions and 0 deletions

View File

@@ -94,6 +94,17 @@ reverse (x :: xs) = reverse xs ++ (x :: Nil)
-- concatenation is associative
++-associative : A. (xs ys zs : List A) -> xs ++ (ys ++ zs) (xs ++ ys) ++ zs
++-associative Nil ys zs = Refl
++-associative (x :: xs) ys zs =
begin
(x :: xs) ++ (ys ++ zs)
≡⟨⟩
x :: (xs ++ (ys ++ zs))
≡⟨ cong (_::_ x) (++-associative xs ys zs)
x :: ((xs ++ ys) ++ zs)
≡⟨⟩
(x :: xs ++ ys) ++ zs
-- reverse distributes over ++, but switches order
reverse-++-distrib : A. (xs ys : List A) -> reverse (xs ++ ys) reverse ys ++ reverse xs