Silence.agda 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. open import Proc
  2. module Silence (param : Param) where
  3. open import Basics
  4. import Interp
  5. import Hear
  6. open Process param
  7. open Interp param
  8. open Hear param
  9. NoSpeak : {a : U} -> Proc a -> Set
  10. NoSpeak {a} p = (w : LT a)(q : Proc a) -> ¬ (p -! w !-> q)
  11. silent-nospeak : {a : U}{p : Proc a} -> Silent p -> NoSpeak p
  12. silent-nospeak silent-o w q ()
  13. silent-nospeak silent-> w q ()
  14. silent-nospeak (silent-|| s1 s2) w ._ (tx-!| h _) = silent-nospeak s1 _ _ h
  15. silent-nospeak (silent-|| s1 s2) w ._ (tx-|! _ h) = silent-nospeak s2 _ _ h
  16. silent-nospeak (silent-def s) w q (tx-def h) = silent-nospeak s _ _ h
  17. silent-nospeak (silent-/| s) ._ ._ (tx-/| h) = silent-nospeak s _ _ h
  18. nospeak-silent : {a : U}{p : Proc a} -> Guard p -> NoSpeak p -> Silent p
  19. nospeak-silent og s = silent-o
  20. nospeak-silent (>g f) s = silent->
  21. nospeak-silent (w !g p) s = kill (s _ _ tx-!)
  22. nospeak-silent (w ! p +g f) s = kill (s _ _ tx-+)
  23. nospeak-silent (g1 ||g g2) s =
  24. silent-|| (nospeak-silent g1 (inv1 g2 s))
  25. (nospeak-silent g2 (inv2 g1 s))
  26. where
  27. module Inv {a : U}{p1 p2 : Proc a} where
  28. inv1 : Guard p2 -> NoSpeak (p1 || p2) -> NoSpeak p1
  29. inv1 g2 h w p t = h _ _ (tx-!| t (sound g2))
  30. inv2 : Guard p1 -> NoSpeak (p1 || p2) -> NoSpeak p2
  31. inv2 g1 h w p t = h _ _ (tx-|! (sound g1) t)
  32. open Inv
  33. nospeak-silent (φ /|g g) s = silent-/| (nospeak-silent g (inv s))
  34. where
  35. inv : forall {p} -> NoSpeak (φ /| p) -> NoSpeak p
  36. inv h w p t = h _ _ (tx-/| t)
  37. nospeak-silent (defg x g) s = silent-def (nospeak-silent g (inv s))
  38. where
  39. inv : NoSpeak (def x) -> NoSpeak (env _ x)
  40. inv h w p t = h _ _ (tx-def t)