Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@puffnfresh
Created June 21, 2018 22:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save puffnfresh/ffef774756394c017fdbd5e2c8ec26d6 to your computer and use it in GitHub Desktop.
Save puffnfresh/ffef774756394c017fdbd5e2c8ec26d6 to your computer and use it in GitHub Desktop.
Reverse function
open import Data.List
open import Data.List.Properties
open import Relation.Binary.PropositionalEquality
record ReverseFunction : Set₁ where
field
f : ∀ {A} → List A → List A
rev : ∀ {A} (xs ys : List A) → f (xs ++ ys) ≡ f ys ++ f xs
sing : ∀ {A} (x : A) → f (x ∷ []) ≡ x ∷ []
reverseF : ReverseFunction
reverseF = record
{ f = reverse
; rev = reverse-++-commute
; sing = λ x → refl
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment