Skip to content

Instantly share code, notes, and snippets.

@kuribas
Last active May 4, 2023 08:11
Show Gist options
  • Save kuribas/2b78285169d8d93850fc704c835c4537 to your computer and use it in GitHub Desktop.
Save kuribas/2b78285169d8d93850fc704c835c4537 to your computer and use it in GitHub Desktop.
import Data.List
infixr 1 =~
infixr 1 >~
infixr 1 =~<
(=~) : (a:k) -> {b:k} -> (a = b) -> (a = b)
(=~) _ prf = prf
qed : {a:k} -> (a = a)
qed = Refl
(=~<) : (a:k) -> {b:k} -> (a = b) -> (a = b)
(=~<) _ prf = prf
(>~) : {a:k} -> {b:k} -> {c:k} -> (a = b) -> (b = c) -> (a = c)
(>~) x y = trans x y
length_append : (l:List a) -> (r:List a) -> length (l ++ r) = (length l + length r)
length_append [] r =
length ([] ++ r)
=~
0 + length r
=~
qed
length_append (x :: xs) r =
length (x :: xs ++ r)
=~
S (length (xs ++ r))
=~< cong S (length_append xs r) >~
S (length xs + length r)
=~
qed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment