Hear.agda 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. open import Proc
  2. module Hear (param : Param) where
  3. open import Basics
  4. private open module P = Process param
  5. open Tran
  6. hear : {a : U}{p : Proc a} -> Guard p -> LT a -> Proc a
  7. hear {p = p} g bot = p
  8. hear og (lift v) = o
  9. hear (w !g p) (lift v) = w ! p
  10. hear (>g f) (lift v) = f v
  11. hear (_ ! _ +g f) (lift v) = f v
  12. hear (g1 ||g g2) (lift v) = hear g1 (lift v) || hear g2 (lift v)
  13. hear (φ /|g g) (lift v) = φ /| hear g (downV φ v)
  14. hear (defg x g) (lift v) = hear g (lift v)
  15. sound : {a : U}{p : Proc a}(g : Guard p){w : LT a} ->
  16. p -[ w ]-> hear g w
  17. sound g {bot} = qtau
  18. sound og {lift v} = rx-o
  19. sound (>g _) {lift v} = rx->
  20. sound (w !g p) {lift v} = rx-!
  21. sound (w ! p +g f) {lift v} = rx-+
  22. sound (g1 ||g g2) {lift v} = rx-|| (sound g1) (sound g2)
  23. sound (φ /|g g) {lift v} = rx-/| (sound g)
  24. sound (defg x g) {lift v} = rx-def (sound g)
  25. uniq : {a : U}{p : Proc a}{w : LT a}{px py : Proc a} ->
  26. p -[ w ]-> px -> p -[ w ]-> py -> px == py
  27. uniq qtau qtau = refl
  28. uniq rx-o rx-o = refl
  29. uniq rx-> rx-> = refl
  30. uniq rx-! rx-! = refl
  31. uniq rx-+ rx-+ = refl
  32. uniq (rx-|| l1 r1) (rx-|| l2 r2) with uniq l1 l2 | uniq r1 r2
  33. ... | refl | refl = refl
  34. uniq (rx-/| r1) (rx-/| r2) with uniq r1 r2
  35. ... | refl = refl
  36. uniq (rx-def r1) (rx-def r2) with uniq r1 r2
  37. ... | refl = refl
  38. complete : {a : U}{p : Proc a}(g : Guard p){w : LT a}{p' : Proc a} ->
  39. p -[ w ]-> p' -> p' == hear g w
  40. complete g r = uniq r (sound g)