diff options
author | Helmut Grohne <grohne@cs.uni-bonn.de> | 2015-06-09 16:09:37 +0200 |
---|---|---|
committer | Helmut Grohne <grohne@cs.uni-bonn.de> | 2015-06-09 16:09:37 +0200 |
commit | dbad09a8a5843e91f862657c3011ec7f63ea819b (patch) | |
tree | 4e94ce24ca4b9dcaad1378576d1352caf8209de7 /Examples.agda | |
parent | 94f6fbed8b04e95446c38d6ea89dcc9c3a64304b (diff) | |
download | bidiragda-dbad09a8a5843e91f862657c3011ec7f63ea819b.tar.gz |
drop the Function.Equality requirement from GetTypes
We never used the equality property. Thus a simple function is
sufficient here. We always fulfilled the property using ≡-to-Π anyway.
Diffstat (limited to 'Examples.agda')
-rw-r--r-- | Examples.agda | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/Examples.agda b/Examples.agda index ca65835..f30faa5 100644 --- a/Examples.agda +++ b/Examples.agda @@ -6,9 +6,8 @@ import Algebra.Structures open import Data.List using (List ; length) renaming ([] to []L ; _∷_ to _∷L_) open import Data.Vec using (Vec ; [] ; _∷_ ; reverse ; _++_ ; tail ; take ; drop) open import Function using (id) -open import Relation.Binary.PropositionalEquality using (_≡_ ; refl ; cong) renaming (setoid to EqSetoid) +open import Relation.Binary.PropositionalEquality using (_≡_ ; refl ; cong) -open import Generic using (≡-to-Π) open import Structures using (Shaped) import GetTypes import FreeTheorems @@ -17,10 +16,10 @@ open GetTypes.PartialVecVec using (Get) open FreeTheorems.PartialVecVec using (assume-get) reverse' : Get -reverse' = assume-get (≡-to-Π id) (≡-to-Π id) reverse +reverse' = assume-get id id reverse double' : Get -double' = assume-get (≡-to-Π id) (≡-to-Π g) f +double' = assume-get id g f where g : ℕ → ℕ g zero = zero g (suc n) = suc (suc (g n)) @@ -29,19 +28,19 @@ double' = assume-get (≡-to-Π id) (≡-to-Π g) f f (x ∷ v) = x ∷ x ∷ f v double'' : Get -double'' = assume-get (≡-to-Π id) (≡-to-Π _) (λ v → v ++ v) +double'' = assume-get id _ (λ v → v ++ v) tail' : Get -tail' = assume-get (≡-to-Π suc) (≡-to-Π id) tail +tail' = assume-get suc id tail take' : ℕ → Get -take' n = assume-get (≡-to-Π (_+_ n)) (≡-to-Π _) (take n) +take' n = assume-get (_+_ n) _ (take n) drop' : ℕ → Get -drop' n = assume-get (≡-to-Π (_+_ n)) (≡-to-Π _) (drop n) +drop' n = assume-get (_+_ n) _ (drop n) sieve' : Get -sieve' = assume-get (≡-to-Π id) (≡-to-Π _) f +sieve' = assume-get id _ f where f : {A : Set} {n : ℕ} → Vec A n → Vec A ⌈ n /2⌉ f [] = [] f (x ∷ []) = x ∷ [] @@ -58,7 +57,7 @@ intersperse s (x ∷ []) = x ∷ [] intersperse s (x ∷ y ∷ v) = x ∷ s ∷ intersperse s (y ∷ v) intersperse' : Get -intersperse' = assume-get (≡-to-Π suc) (≡-to-Π intersperse-len) f +intersperse' = assume-get suc intersperse-len f where f : {A : Set} {n : ℕ} → Vec A (suc n) → Vec A (intersperse-len n) f (s ∷ v) = intersperse s v |