agda-spa/Language/Traces.agda

25 lines
1.3 KiB
Agda
Raw Normal View History

module Language.Traces where
open import Language.Base public
open import Language.Semantics public
open import Language.Graphs public
open import Data.Product using (_,_)
open import Data.List.Membership.Propositional as MemProp using ()
module _ {g : Graph} where
open Graph g using (Index; edges)
data Trace : Index Index Env Env Set where
Trace-single : {ρ₁ ρ₂ : Env} {idx : Index}
ρ₁ , (g [ idx ]) ⇒ᵇˢ ρ₂ Trace idx idx ρ₁ ρ₂
Trace-edge : {ρ₁ ρ₂ ρ₃ : Env} {idx₁ idx₂ idx₃ : Index}
ρ₁ , (g [ idx₁ ]) ⇒ᵇˢ ρ₂ (idx₁ , idx₂) MemProp.∈ edges
Trace idx₂ idx₃ ρ₂ ρ₃ Trace idx₁ idx₃ ρ₁ ρ₃
_++⟨_⟩_ : {idx₁ idx₂ idx₃ idx₄ : Index} {ρ₁ ρ₂ ρ₃ : Env}
Trace idx₁ idx₂ ρ₁ ρ₂ (idx₂ , idx₃) MemProp.∈ edges
Trace idx₃ idx₄ ρ₂ ρ₃ Trace idx₁ idx₄ ρ₁ ρ₃
_++⟨_⟩_ (Trace-single ρ₁⇒ρ₂) idx₂→idx₃ tr = Trace-edge ρ₁⇒ρ₂ idx₂→idx₃ tr
_++⟨_⟩_ (Trace-edge ρ₁⇒ρ₂ idx₁→idx' tr') idx₂→idx₃ tr = Trace-edge ρ₁⇒ρ₂ idx₁→idx' (tr' ++⟨ idx₂→idx₃ tr)