Compare commits
3 Commits
07550bc214
...
bbfba34e05
Author | SHA1 | Date | |
---|---|---|---|
bbfba34e05 | |||
aec15573fc | |||
b4d395767d |
|
@ -84,6 +84,18 @@ loop g = record g
|
||||||
List.cartesianProduct (Graph.outputs g) (Graph.inputs g)
|
List.cartesianProduct (Graph.outputs g) (Graph.inputs g)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
optional : Graph → Graph
|
||||||
|
optional g = record
|
||||||
|
{ size = 2 Nat.+ Graph.size g
|
||||||
|
; nodes = [] ∷ [] ∷ Graph.nodes g
|
||||||
|
; edges = (2 ↑ʳᵉ Graph.edges g) List.++
|
||||||
|
List.map (zero ,_) (2 ↑ʳⁱ Graph.inputs g) List.++
|
||||||
|
List.map (_, suc zero) (2 ↑ʳⁱ Graph.outputs g) List.++
|
||||||
|
((zero , suc zero) ∷ [])
|
||||||
|
; inputs = zero ∷ []
|
||||||
|
; outputs = (suc zero) ∷ []
|
||||||
|
}
|
||||||
|
|
||||||
infixr 5 _skipto_
|
infixr 5 _skipto_
|
||||||
_skipto_ : Graph → Graph → Graph
|
_skipto_ : Graph → Graph → Graph
|
||||||
_skipto_ g₁ g₂ = record (g₁ ∙ g₂)
|
_skipto_ g₁ g₂ = record (g₁ ∙ g₂)
|
||||||
|
@ -110,4 +122,4 @@ buildCfg : Stmt → Graph
|
||||||
buildCfg ⟨ bs₁ ⟩ = singleton (bs₁ ∷ [])
|
buildCfg ⟨ bs₁ ⟩ = singleton (bs₁ ∷ [])
|
||||||
buildCfg (s₁ then s₂) = buildCfg s₁ ↦ buildCfg s₂
|
buildCfg (s₁ then s₂) = buildCfg s₁ ↦ buildCfg s₂
|
||||||
buildCfg (if _ then s₁ else s₂) = singleton [] ↦ (buildCfg s₁ ∙ buildCfg s₂) ↦ singleton []
|
buildCfg (if _ then s₁ else s₂) = singleton [] ↦ (buildCfg s₁ ∙ buildCfg s₂) ↦ singleton []
|
||||||
buildCfg (while _ repeat s) = (loop (singleton [] ↦ buildCfg s)) skipto (singleton [])
|
buildCfg (while _ repeat s) = optional (loop (buildCfg s))
|
||||||
|
|
|
@ -106,12 +106,51 @@ Trace-↦ʳ {g₁} {g₂} {idx₁} (Trace-edge ρ₁⇒ρ idx₁→idx tr')
|
||||||
(ListMemProp.∈-++⁺ˡ (x∈xs⇒fx∈fxs (Graph.size g₁ ↑ʳ_) idx₁→idx)))
|
(ListMemProp.∈-++⁺ˡ (x∈xs⇒fx∈fxs (Graph.size g₁ ↑ʳ_) idx₁→idx)))
|
||||||
(Trace-↦ʳ {g₁} {g₂} tr')
|
(Trace-↦ʳ {g₁} {g₂} tr')
|
||||||
|
|
||||||
Trace-loop : ∀ {g₁ : Graph} {idx₁ idx₂ : Graph.Index g₁} {ρ₁ ρ₂ : Env} →
|
Trace-loop : ∀ {g : Graph} {idx₁ idx₂ : Graph.Index g} {ρ₁ ρ₂ : Env} →
|
||||||
Trace {g₁} idx₁ idx₂ ρ₁ ρ₂ → Trace {loop g₁} idx₁ idx₂ ρ₁ ρ₂
|
Trace {g} idx₁ idx₂ ρ₁ ρ₂ → Trace {loop g} idx₁ idx₂ ρ₁ ρ₂
|
||||||
Trace-loop {idx₁ = idx₁} {idx₁} (Trace-single ρ₁⇒ρ₂) = Trace-single ρ₁⇒ρ₂
|
Trace-loop {idx₁ = idx₁} {idx₁} (Trace-single ρ₁⇒ρ₂) = Trace-single ρ₁⇒ρ₂
|
||||||
Trace-loop {g₁} {idx₁} (Trace-edge ρ₁⇒ρ idx₁→idx tr') =
|
Trace-loop {g} {idx₁} (Trace-edge ρ₁⇒ρ idx₁→idx tr') =
|
||||||
Trace-edge ρ₁⇒ρ (ListMemProp.∈-++⁺ˡ idx₁→idx) (Trace-loop tr')
|
Trace-edge ρ₁⇒ρ (ListMemProp.∈-++⁺ˡ idx₁→idx) (Trace-loop tr')
|
||||||
|
|
||||||
|
EndToEndTrace-loop : ∀ {g : Graph} {ρ₁ ρ₂ : Env} →
|
||||||
|
EndToEndTrace {g} ρ₁ ρ₂ → EndToEndTrace {loop g} ρ₁ ρ₂
|
||||||
|
EndToEndTrace-loop etr = record
|
||||||
|
{ idx₁ = EndToEndTrace.idx₁ etr
|
||||||
|
; idx₁∈inputs = EndToEndTrace.idx₁∈inputs etr
|
||||||
|
; idx₂ = EndToEndTrace.idx₂ etr
|
||||||
|
; idx₂∈outputs = EndToEndTrace.idx₂∈outputs etr
|
||||||
|
; trace = Trace-loop (EndToEndTrace.trace etr)
|
||||||
|
}
|
||||||
|
|
||||||
|
EndToEndTrace-loop² : ∀ {g : Graph} {ρ₁ ρ₂ ρ₃ : Env} →
|
||||||
|
EndToEndTrace {loop g} ρ₁ ρ₂ →
|
||||||
|
EndToEndTrace {loop g} ρ₂ ρ₃ →
|
||||||
|
EndToEndTrace {loop g} ρ₁ ρ₃
|
||||||
|
EndToEndTrace-loop² {g} etr₁ etr₂ = record
|
||||||
|
{ idx₁ = EndToEndTrace.idx₁ etr₁
|
||||||
|
; idx₁∈inputs = EndToEndTrace.idx₁∈inputs etr₁
|
||||||
|
; idx₂ = EndToEndTrace.idx₂ etr₂
|
||||||
|
; idx₂∈outputs = EndToEndTrace.idx₂∈outputs etr₂
|
||||||
|
; trace =
|
||||||
|
let
|
||||||
|
o∈tr₁ = EndToEndTrace.idx₂∈outputs etr₁
|
||||||
|
i∈tr₂ = EndToEndTrace.idx₁∈inputs etr₂
|
||||||
|
oi∈es = ListMemProp.∈-++⁺ʳ (Graph.edges g) (∈-cartesianProduct o∈tr₁ i∈tr₂)
|
||||||
|
in
|
||||||
|
EndToEndTrace.trace etr₁ ++⟨ oi∈es ⟩ EndToEndTrace.trace etr₂
|
||||||
|
}
|
||||||
|
|
||||||
|
Trace-optional : ∀ {g : Graph} {idx₁ idx₂ : Graph.Index g} {ρ₁ ρ₂ : Env} →
|
||||||
|
Trace {g} idx₁ idx₂ ρ₁ ρ₂ → Trace {optional g} (2 Fin.↑ʳ idx₁) (2 Fin.↑ʳ idx₂) ρ₁ ρ₂
|
||||||
|
Trace-optional = {!!}
|
||||||
|
|
||||||
|
EndToEndTrace-optional : ∀ {g : Graph} {ρ₁ ρ₂ : Env} →
|
||||||
|
EndToEndTrace {g} ρ₁ ρ₂ → EndToEndTrace {optional g} ρ₁ ρ₂
|
||||||
|
EndToEndTrace-optional = {!!}
|
||||||
|
|
||||||
|
EndToEndTrace-optional-ε : ∀ {g : Graph} {ρ : Env} → EndToEndTrace {optional g} ρ ρ
|
||||||
|
EndToEndTrace-optional-ε = {!!}
|
||||||
|
|
||||||
infixr 5 _++_
|
infixr 5 _++_
|
||||||
_++_ : ∀ {g₁ g₂ : Graph} {ρ₁ ρ₂ ρ₃ : Env} →
|
_++_ : ∀ {g₁ g₂ : Graph} {ρ₁ ρ₂ ρ₃ : Env} →
|
||||||
EndToEndTrace {g₁} ρ₁ ρ₂ → EndToEndTrace {g₂} ρ₂ ρ₃ →
|
EndToEndTrace {g₁} ρ₁ ρ₂ → EndToEndTrace {g₂} ρ₂ ρ₃ →
|
||||||
|
@ -161,3 +200,6 @@ buildCfg-sufficient (⇒ˢ-if-false ρ₁ ρ₂ _ s₁ s₂ _ ρ₁,s₂⇒ρ₂
|
||||||
Trace-singleton[] ρ₁ ++
|
Trace-singleton[] ρ₁ ++
|
||||||
(EndToEndTrace-∙ʳ {buildCfg s₁} (buildCfg-sufficient ρ₁,s₂⇒ρ₂)) ++
|
(EndToEndTrace-∙ʳ {buildCfg s₁} (buildCfg-sufficient ρ₁,s₂⇒ρ₂)) ++
|
||||||
Trace-singleton[] ρ₂
|
Trace-singleton[] ρ₂
|
||||||
|
buildCfg-sufficient (⇒ˢ-while-true ρ₁ ρ₂ ρ₃ _ _ s _ _ ρ₁,s⇒ρ₂ ρ₂,ws⇒ρ₃) = {!!}
|
||||||
|
buildCfg-sufficient (⇒ˢ-while-false ρ _ s _) =
|
||||||
|
EndToEndTrace-optional-ε {loop (buildCfg s)} {ρ}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user