summaryrefslogtreecommitdiff
path: root/src/Cfe/Language/Indexed/Homogeneous.agda
blob: a1e284a4e80e73def0da9cceef3c13401b2c2315 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
{-# OPTIONS --without-K --safe #-}

open import Relation.Binary as B using (Setoid)

module Cfe.Language.Indexed.Homogeneous
  {c ℓ} (over : Setoid c ℓ)
  where

open import Cfe.Language over
open import Level
open import Data.List
open import Data.Product
open import Relation.Binary.Indexed.Heterogeneous

open _≈_

open Setoid over using () renaming (Carrier to C)

record IndexedLanguage i iℓ a aℓ : Set (ℓ ⊔ suc (c ⊔ i ⊔ iℓ ⊔ a ⊔ aℓ)) where
  field
    Carrierᵢ : Set i
    _≈ᵢ_ : B.Rel Carrierᵢ iℓ
    isEquivalenceᵢ : B.IsEquivalence _≈ᵢ_
    F : Carrierᵢ → Language a aℓ
    cong : F B.Preserves _≈ᵢ_ ⟶ _≈_

  open B.IsEquivalence isEquivalenceᵢ using () renaming (refl to reflᵢ; sym to symᵢ; trans to transᵢ) public

  Tagged : List C → Set (i ⊔ a)
  Tagged l = ∃[ i ] l ∈ F i

  _≈ᵗ_ : IRel Tagged (iℓ ⊔ aℓ)
  _≈ᵗ_ (i , l∈Fi) (j , m∈Fj) = Σ (i ≈ᵢ j) λ i≈j → ≈ᴸ (F j) (f (cong i≈j) l∈Fi) m∈Fj