diff --git a/src/Monad/Instance/K/PreElgot.lagda.md b/src/Monad/Instance/K/PreElgot.lagda.md new file mode 100644 index 0000000..837066e --- /dev/null +++ b/src/Monad/Instance/K/PreElgot.lagda.md @@ -0,0 +1,39 @@ + + + + +```agda +module Monad.Instance.K.PreElgot {o ℓ e} (ambient : Ambient o ℓ e) where + open Ambient ambient + open import Monad.Instance.K ambient + open import Monad.Instance.K.Strong ambient + open import Monad.Instance.K.Commutative ambient + open import Monad.Instance.K.EquationalLifting ambient + + open Terminal terminal using (⊤; !) + open Initial using () renaming (! to ¡) +``` + + +First let's define bounded iteration via primitive recursion. +Given a pointed object A (i.e. there exists a morphism !! : ⊤ ⇒ A), (f : X ⇒ A + X)#⟩ : X × ℕ ⇒ A + +```agda + p-rec : ∀ {X Y : Obj} → X ⇒ Y → Y × X × N ⇒ Y → X × N ⇒ Y + p-rec {X} {Y} f g = π₁ ∘ universal {X = Y × X × N} ⟨ f , ⟨ idC , z ∘ ! ⟩ ⟩ ⟨ g , ⟨ π₁ ∘ π₂ , π₂ ∘ π₂ ⟩ ⟩ + -- TODO induction, see proposition 2.3 https://ncatlab.org/nlab/show/natural+numbers+object + + [_,_]#⟩ : ∀ {X A : Obj} → (⊤ ⇒ A) → X ⇒ A + X → X × N ⇒ A + [_,_]#⟩ {X} {A} !! f = p-rec (!! ∘ !) (([ π₂ , π₁ ] ∘ distributeˡ⁻¹) ∘ (idC ⁂ f ∘ π₁)) + -- TODO might be wrong, check it by testing kleene fixpoint + +```