Skip to content

Instantly share code, notes, and snippets.

@kennyrowe
Last active June 19, 2018 22:51
Show Gist options
  • Save kennyrowe/ac2c34ff8a5d4f3862b347425ce7d6b4 to your computer and use it in GitHub Desktop.
Save kennyrowe/ac2c34ff8a5d4f3862b347425ce7d6b4 to your computer and use it in GitHub Desktop.
Introduction to the Design of Computational Calculi
trait RhoProcess
case class stopped() extends RhoProcess
case class input(variable : RhoName , channel : RhoName , p : RhoProcess) extends RhoProcess
case class output(channel : RhoName , q : RhoProcess) extends RhoProcess
case class concurrent(p : RhoProcess , q : RhoProcess) extends RhoProcess
case class execute(code : RhoName) extends RhoProcess
trait RhoName
case class name(p : RhoProcess ) extends RhoName
//Free names
// look up sets in scala "+" union and diff and case calsses
def freeNames (P : RhoProcess) : Set[RhoName] =
{
P match {
case stopped() => Set.empty //FN (0) = ∅
case input(v,c,p) => Set(c) union (freeNames(p) diff Set(v)) //{x} ∪ (FN (P) \ {y})
case output(c,q) => Set(c) union (freeNames(q)) //{x}∪FN (P)
case concurrent(p,q) => freeNames(p) union freeNames(q) //FN (P) ∪FN (Q)
case execute(c) => Set(c) //{x}
}
}
//Bound Names
//Structual equivalance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment