Danila Fedorin
c574ca9c56
That is, if we have a (semantic) trace, we can find a corresponding path through the CFG. Signed-off-by: Danila Fedorin <danila.fedorin@gmail.com>
37 lines
1.6 KiB
Agda
37 lines
1.6 KiB
Agda
module Language.Traces where
|
|
|
|
open import Language.Base
|
|
open import Language.Semantics using (Env; _,_⇒ᵇˢ_)
|
|
open import Language.Graphs
|
|
|
|
open import Data.Product using (_,_)
|
|
open import Data.List.Membership.Propositional using (_∈_)
|
|
|
|
module _ {g : Graph} where
|
|
open Graph g using (Index; edges; inputs; outputs)
|
|
|
|
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₂) ∈ edges →
|
|
Trace idx₂ idx₃ ρ₂ ρ₃ → Trace idx₁ idx₃ ρ₁ ρ₃
|
|
|
|
infixr 5 _++⟨_⟩_
|
|
_++⟨_⟩_ : ∀ {idx₁ idx₂ idx₃ idx₄ : Index} {ρ₁ ρ₂ ρ₃ : Env} →
|
|
Trace idx₁ idx₂ ρ₁ ρ₂ → (idx₂ , idx₃) ∈ 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)
|
|
|
|
record EndToEndTrace (ρ₁ ρ₂ : Env) : Set where
|
|
constructor MkEndToEndTrace
|
|
field
|
|
idx₁ : Index
|
|
idx₁∈inputs : idx₁ ∈ inputs
|
|
|
|
idx₂ : Index
|
|
idx₂∈outputs : idx₂ ∈ outputs
|
|
|
|
trace : Trace idx₁ idx₂ ρ₁ ρ₂
|