Created
August 9, 2014 15:07
-
-
Save notogawa/a54b21c5b81257a9b796 to your computer and use it in GitHub Desktop.
foldr-zip
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module FoldZipFusion {a b c d} {A : Set a} {B : Set b} {C : Set c} {D : Set d} (_⊕_ : A → B → B) (_⊗_ : C → D → A)where | |
open import Function | |
open import Data.List | |
open import Relation.Binary.PropositionalEquality | |
_⊛_ : {z : B} → C → (List D → B) → List D → B | |
_⊛_ {z} x k [] = z | |
_⊛_ {z} x k (y ∷ ys) = (x ⊗ y) ⊕ k ys | |
foldr-zip-fusion : ∀ (z : B) (cs : List C) (ds : List D) → ((_∘_ (foldr _⊕_ z)) ∘ zipWith _⊗_) cs ds ≡ (foldr (_⊛_ {z}) (const z)) cs ds | |
foldr-zip-fusion z [] [] = refl | |
foldr-zip-fusion z [] (x ∷ ds) = refl | |
foldr-zip-fusion z (x ∷ cs) [] = refl | |
foldr-zip-fusion z (x ∷ cs) (x₁ ∷ ds) | |
rewrite foldr-zip-fusion z cs ds | |
= refl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment