2024-04-20 21:36:58 -07:00
|
|
|
module Language.Traces where
|
|
|
|
|
2024-04-27 14:56:19 -07:00
|
|
|
open import Language.Base
|
|
|
|
open import Language.Semantics using (Env; _,_⇒ᵇˢ_)
|
|
|
|
open import Language.Graphs
|
2024-04-20 21:36:58 -07:00
|
|
|
|
|
|
|
open import Data.Product using (_,_)
|
2024-04-27 14:56:19 -07:00
|
|
|
open import Data.List.Membership.Propositional using (_∈_)
|
2024-04-20 21:36:58 -07:00
|
|
|
|
|
|
|
module _ {g : Graph} where
|
2024-04-27 14:56:19 -07:00
|
|
|
open Graph g using (Index; edges; inputs; outputs)
|
2024-04-20 21:36:58 -07:00
|
|
|
|
|
|
|
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} →
|
2024-04-27 14:56:19 -07:00
|
|
|
ρ₁ , (g [ idx₁ ]) ⇒ᵇˢ ρ₂ → (idx₁ , idx₂) ∈ edges →
|
2024-04-20 21:36:58 -07:00
|
|
|
Trace idx₂ idx₃ ρ₂ ρ₃ → Trace idx₁ idx₃ ρ₁ ρ₃
|
|
|
|
|
|
|
|
_++⟨_⟩_ : ∀ {idx₁ idx₂ idx₃ idx₄ : Index} {ρ₁ ρ₂ ρ₃ : Env} →
|
2024-04-27 14:56:19 -07:00
|
|
|
Trace idx₁ idx₂ ρ₁ ρ₂ → (idx₂ , idx₃) ∈ edges →
|
2024-04-20 21:36:58 -07:00
|
|
|
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)
|
2024-04-27 14:56:19 -07:00
|
|
|
|
|
|
|
record EndToEndTrace (ρ₁ ρ₂ : Env) : Set where
|
|
|
|
field
|
|
|
|
idx₁ : Index
|
|
|
|
idx₁∈inputs : idx₁ ∈ inputs
|
|
|
|
|
|
|
|
idx₂ : Index
|
|
|
|
idx₂∈outputs : idx₂ ∈ outputs
|
|
|
|
|
|
|
|
trace : Trace idx₁ idx₂ ρ₁ ρ₂
|