module A202401.Kit4 where

open import A202401.Kit1 public


----------------------------------------------------------------------------------------------------

record ValKitParams : Set₁ where
  constructor kit
  field
    {Ty} : Set
  open TyKit Ty public
  field
    _⊩_ : Ctx  Ty  Set
    vren :  {A W W′}  W  W′  W  A  W′  A

module ValKit ( : ValKitParams) where
  open ValKitParams 
  valkit = 

  infix 3 _⊩§_
  data _⊩§_ (W : Ctx) : Ctx  Set where
       : W ⊩§ 
    _,_ :  {Δ A} (δ : W ⊩§ Δ) (v : W  A)  W ⊩§ Δ , A

  vren§ :  {Δ W W′}  W  W′  W ⊩§ Δ  W′ ⊩§ Δ
  vren§ ϱ        = 
  vren§ ϱ (δ , v) = vren§ ϱ δ , vren ϱ v

  infix 3 _⊨_
  _⊨_ : Ctx  Ty  Set
  Γ  A =  {W : Ctx}  W ⊩§ Γ  W  A

  ⟦_⟧∋ :  {Γ A}  Γ  A  Γ  A
   zero  ⟧∋ (γ , v) = v
   wk∋ i ⟧∋ (γ , v) =  i ⟧∋ γ


----------------------------------------------------------------------------------------------------

record ModelKitParams : Set₂ where
  constructor kit
  field
    {Ty} : Set
  open TyKit Ty public
  field
    {Model} : Set₁
    {World} : Model  Set
    {_≤_}   :  ( : Model)  World   World   Set -- TODO: implify?
    _⊩_    :  {}  World   Ty  Set
    vren    :  { A W W′}  _≤_  W W′  W  A  W′  A

module ModelKit ( : ModelKitParams) where
  open ModelKitParams 
  modelkit = 

  module _ { : Model} where
    infix 3 _⊩§_
    data _⊩§_ (W : World ) : Ctx  Set where
         : W ⊩§ 
      _,_ :  {Δ A} (δ : W ⊩§ Δ) (v : W  A)  W ⊩§ Δ , A

    vren§ :  {Δ W W′}  _≤_  W W′  W ⊩§ Δ  W′ ⊩§ Δ
    vren§ ϱ        = 
    vren§ ϱ (δ , v) = vren§ ϱ δ , vren ϱ v

  infix 3 _/_⊩_
  _/_⊩_ :  ( : Model) (W : World )  Ty  Set
   / W  A = _⊩_ {} W A

  infix 3 _/_⊩§_
  _/_⊩§_ :  ( : Model) (W : World )  Ctx  Set
   / W ⊩§ Δ = _⊩§_ {} W Δ

  infix 3 _⊨_
  _⊨_ : Ctx  Ty  Set₁
  Γ  A =  { : Model} {W : World }   / W ⊩§ Γ   / W  A

  ⟦_⟧∋ :  {Γ A}  Γ  A  Γ  A
   zero  ⟧∋ (γ , v) = v
   wk∋ i ⟧∋ (γ , v) =  i ⟧∋ γ


----------------------------------------------------------------------------------------------------

record SplitModelKitParams : Set₂ where
  constructor kit
  field
    {Ty} : Set
  open TyKit Ty public
  field
    {BaseModel}  : Set₁
    {SplitModel} : BaseModel  Set₁
    {World}      :  {}  SplitModel   Set
    {_≤_}        :  {} ( : SplitModel )  World   World   Set -- TODO: implify?
    _⊩_         :  {} ( : SplitModel )  World   Ty  Set -- TODO: implify
    vren         :  {} { : SplitModel } {A W W′}  _≤_  W W′  _⊩_  W A  _⊩_  W′ A

module SplitModelKit ( : SplitModelKitParams) where
  open SplitModelKitParams 
  splitmodelkit = 

  module _ {} { : SplitModel } where
    infix 3 _⊩§_
    data _⊩§_ (W : World ) : Ctx  Set where
         : W ⊩§ 
      _,_ :  {Δ A} (δ : W ⊩§ Δ) (v : _⊩_  W A)  W ⊩§ Δ , A

    vren§ :  {Δ W W′}  _≤_  W W′  W ⊩§ Δ  W′ ⊩§ Δ
    vren§ ϱ        = 
    vren§ ϱ (δ , v) = vren§ ϱ δ , vren ϱ v

  infix 3 _/_⊩_
  _/_⊩_ :  {} ( : SplitModel ) (W : World )  Ty  Set
   / W  A = _⊩_  W A

  infix 3 _/_⊩§_
  _/_⊩§_ :  {} ( : SplitModel ) (W : World )  Ctx  Set
   / W ⊩§ Δ = _⊩§_ { = } W Δ

  infix 3 _⊨_
  _⊨_ : Ctx  Ty  Set₁
  Γ  A =  {} { : SplitModel } {W : World }   / W ⊩§ Γ   / W  A

  ⟦_⟧∋ :  {Γ A}  Γ  A  Γ  A
   zero  ⟧∋ (γ , v) = v
   wk∋ i ⟧∋ (γ , v) =  i ⟧∋ γ


----------------------------------------------------------------------------------------------------