Started showing that K is preelgot

This commit is contained in:
Leon Vatthauer 2023-11-05 14:09:54 +01:00
parent 28cee7138e
commit 317702c0f6
Signed by: leonv
SSH key fingerprint: SHA256:G4+ddwoZmhLPRB1agvXzZMXIzkVJ36dUYZXf5NxT+u8

View file

@ -0,0 +1,39 @@
<!--
```agda
open import Level
open import Category.Instance.AmbientCategory
open import Categories.Object.Terminal
open import Categories.Functor.Algebra
open import Categories.Object.Initial
open import Categories.Object.NaturalNumbers.Properties.F-Algebras
```
-->
```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
```