diff --git a/src/FAlgebra.agda b/src/FAlgebra.agda index a5b3a83..ff8c519 100644 --- a/src/FAlgebra.agda +++ b/src/FAlgebra.agda @@ -5,6 +5,9 @@ module FAlgebra where open import GeneralizedPolynomial using (Polynomial; ⟦_⟧; ⟦_⟧₀; ⟦_⟧₁; K_; ∅; _,_) open import Relation.Binary.PropositionalEquality +open import Data.Product using (_,_) +open import Data.Sum using (inj₁; inj₂) +open import Data.Nat using (suc) open Polynomial open GeneralizedPolynomial.LeastFixpoint @@ -12,11 +15,16 @@ open GeneralizedPolynomial.LeastFixpoint Algebra : Polynomial 1 → Set → Set Algebra F A = ⟦ F ⟧₁ A → A --- lemma : (F : Polynomial) → ⟦ F ⟧₁ ⟦ μ F ⟧ₒ ≡ ⟦ F ⟧₁ (∅, μ F) - cata : {F : Polynomial 1} {A : Set} → Algebra F A → ⟦ μ F ⟧₀ → A -cata {F} ϕ μ⟨ x ⟩ = ϕ (mapCata F F ϕ x) +cata {F} ϕₒ μ⟨ x ⟩ = ϕₒ (mapCata F F ϕₒ x) where mapCata : {X : Set} → (F G : Polynomial 1) → Algebra G X → ⟦ F ⟧ (∅ , (μ G)) → ⟦ F ⟧₁ X - mapCata {X} F G ϕ x = {!!} + mapCata {X} (I 0) G ϕ μ⟨ x ⟩ = ϕ (mapCata G G ϕ x) + mapCata {X} (L ⊕ᵣ R) G ϕ (inj₁ xₗ) = inj₁ (mapCata L G ϕ xₗ) + mapCata {X} (L ⊕ᵣ R) G ϕ (inj₂ xᵣ) = inj₂ (mapCata R G ϕ xᵣ) + mapCata {X} (L ⊗ᵣ R) G ϕ (xₗ , xᵣ) = mapCata L G ϕ xₗ , mapCata R G ϕ xᵣ + mapCata {X} (μ F) G ϕ μ⟨ x ⟩ = μ⟨ ? ⟩ + mapCata {X} (ν F) G ϕ x = {!!} + mapCata {X} (wk_ {0} P) G ϕ x = x + mapCata {X} (wk_ {1} P) G ϕ x = mapCata P G ϕ x diff --git a/src/GeneralizedPolynomial.agda b/src/GeneralizedPolynomial.agda index c9b27a8..810b822 100644 --- a/src/GeneralizedPolynomial.agda +++ b/src/GeneralizedPolynomial.agda @@ -5,11 +5,11 @@ module GeneralizedPolynomial where open import Data.Sum using (_⊎_) open import Data.Product using (_×_; ∃-syntax; _,_) open import Relation.Binary.PropositionalEquality - using (refl; ≢-sym) + using (refl; ≢-sym; _≡_) open import Data.Nat using (ℕ; suc; _<_; _≤_; _⊔_; s≤s; z≤n; _≟_; _≤?_; _