1 / 29

On the Expressive Power of Temporal Concurrent Constraint Programming Languages

On the Expressive Power of Temporal Concurrent Constraint Programming Languages. Mogens Nielsen, BRICS Catuscia Palamidessi, INRIA Frank Valencia, BRICS. Plan of the talk. Introduction to timed ccp (tcc) Various tcc dialects: iteration / recursion , parameters yes / no,

christhomas
Download Presentation

On the Expressive Power of Temporal Concurrent Constraint Programming Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. On the Expressive Power of Temporal Concurrent Constraint Programming Languages Mogens Nielsen, BRICS Catuscia Palamidessi, INRIA Frank Valencia, BRICS IFIP 2002

  2. Plan of the talk • Introduction to timed ccp (tcc) • Various tcc dialects: • iteration / recursion, • parameters yes / no, • Non local vars yes / no • static / dynamic scope • Equivalence results • Recursion, static scope, no pars <-> Replication • Recursion, dynamic scope, no pars <-> Recursion, pars • Separation results • The first class is strictly less expressive than the second class IFIP 2002

  3. Timed ccp • Ccp [Panangaden, Rinard, Saraswat 1991] • processes communicate via a common store of constraints y > x ask(y>0) tell(x=1) IFIP 2002

  4. Timed ccp • tcc [Saraswat, Jagadeesan, Gupta, 1994] • variant of deterministic ccp to program reactive systems • time is divided in discrete intervals (time units) • in each time unit a process receives a stimulus (initial store) and it computes till it reaches a resting point. The final store is the response. stimulus response time unit IFIP 2002

  5. Timed ccp • Syntax of tcc Finite processes P::=skip| tell(c)|when c do P|P||Q | (local x) P| next P |unless c next P • c represents a constraint • when is tcc forask • local xis tcc for the existential • nextrefers to the next time interval IFIP 2002

  6. Timed ccp • Operational semantics of tcc Configuration: ( P, c ) Transitionrules (tell(c), d) (skip, c and d) process store ( P, c ) ( P’, d ) ( P||Q, c ) ( P’ || Q, d ) d |- c ( Q, c ) ( Q’, d ) (when c do P, d) (P, d) ( P||Q, c ) ( P || Q’, d ) IFIP 2002

  7. Timed ccp Transition rules (cont.ed) ( P, c and Ex d) ( P’, c’ and Ex d) ( (local x,c) P, d ) ( (local x,c’), d and Ex c’ ) d |- c Future function F(next P) = P F(unless c next P) = P F(when c do P) = skip F(P || Q) = F(P) || F(Q) F((local x) P) = (local x) F(P) (unless c next P, d) (skip, d) ( P, c ) * ( Q, d ) ( P, c ) (F(Q), d ) IFIP 2002

  8. Timed ccp Operators for infinite behavior • Iteration ! P • Recursion A(x) == P syntactic restrictions ensure that a process stops after a finite number of steps in each time unit • Locality rule for static scope the standard ccp rule (shown before) induces dynamic scope (! P, c) (P || next ! P, c ) (P[y/x], c) (Q, d ) (A(y), c) (Q, d ) y fresh ((local x) P, c ) (P[y/x], d ) IFIP 2002

  9. Timed ccp Dynamic scope vs Static scope Example: LetAbe defined as A == tell(x=1) || P Consider the process(local x) • Classic rule:The x in A’s def is captured by the scope of (local x) ((local x) A,true) ((local x) tell(x=1) || P, true) ((local x, x=1) P, true) • New rule: The first step eliminates(local x) ((local x) A,true) ( A , true) (tell(x=1) || P, true) ( P, x=1 ) IFIP 2002

  10. Timed ccp Example A == tell(light = off) || unless (toggle_switch) next A || when (toggle_switch) do next B B == tell(light = on) || unless(toggle_switch) next B || when(toggle_switch) do next A off t off on t on p off on t on IFIP 2002

  11. Timed ccp Observables and equivalences • Stimulus-response (or input-output) relation io(P) = { (c1.c2.c3…,d1.d2.d3…) | (P,c1) (P1,d1) (P1,c2) (P2,d2) (P2,c3) (P3,d3) … } • Equivalence: P eq Q iff io(P) = io(Q) c1 d1 c2 d2 c3 d3 c4 d4 c5 d5 IFIP 2002

  12. Variants of tcc Based on finite tcc IFIP 2002

  13. The tcc hierarchy Undecidable inclusion recp recd encoding Decidable rep reci recs rec0 IFIP 2002

  14. Undecidability of recp • The equivalence of processes in recp is undecidable. In fact, it is possible to reduce the Post Correspondence Problem (PCP) to the problem of non-equivalence between recp processes. • Post Correspondence Problem: Given two sets of words V = {v0, v1, v2, … } and W = {w0, w1, w2, … } on a generic alphabet containing at least two symbols, the PCP consists in finding a sequence of indexes i0,i1,i2,… such that vi0.vi1.vi2. …= wi0.wi1.wi2.… • Given V, W, we define two processes A and B such that the PCP (V, W) has a solution iff it is not the case that A eq B IFIP 2002

  15. Undecidability of recp wait c do P == when c do P || unless c next wait c do P repeat Q == Q || next repeat Q Wi(x) == P k< |wi| nextk tell(x =wi[k]) Vi(x) == P k< |vi| nextk tell(x =vi[k]) Ai(b1,b2, ind,x) == (local a1,a2,ichosen) wait b1=1 do (Wi(x) || next|wi| (tell(b1=0) || tell(a1=1) ) || wait b2=1 do (Vi(x) || next|vi| (tell(b2=0) || tell(a2=1) ) || P j in I when index=j do (tell(ichosen=1) || Aj(a1,a2,index,x) ) || Abort(ichosen) Abort(ichosen) == unless ichosen=1 next repeat tell(false) || when false do repeat tell(false) IFIP 2002

  16. Undecidability of recp b1=0 b2=0 index = 3 index = 2 index= 1 v3 v1 v0 w0 w3 w1 • The symbols of vi’s and wj’s are checked at every time interval, and if they do not correspond then we get an inconsistency (abort) • The sequence 0, 3, 1 is a solution for the PCP for (V,W). IFIP 2002

  17. Undecidabilityofrecp Bi(b1,b2, ind, x, ok) == (local a1,a2,ichosen) wait b1=1 do (Wi(x) || next|wi| (tell(b1=0) || tell(a1=1) ) || wait b2=1 do (Vi(x) || next|vi| (tell(b2=0) || tell(a2=1) ) || P j in I when index=j do (tell(ichosen=1)) || Bj(a1,a2,index,x) ) || Abort(ichosen) || wait b1=0 and b2=0 do tell(ok=1) A(ind,x) == (local b1 b2) tell(b1=1) || tell(b2=1) || A0(b1,b2,ind,x) B(ind,x,ok) == (local b1 b2) tell(b1=1) || tell(b2=1) || B0(b1,b2,ind,x,ok) IFIP 2002

  18. Undecidability of recp • A(index,x) eq B(index,x,ok) iff the tell(ok=1) in Bi is never executed, namely iff it is never the case that b1 = 0 and b2 = 0 at the same time. But this holds iff the answer to the PCP for (V,W) is negative. • Since the PCP is undecidable, also the question whether P eq Q is undecidable. IFIP 2002

  19. Decidability of rep • The key idea is to encode the processes of rep in Buchi automata in such a way that the stimulus-response behavior can be retrieved from the language accepted by the automaton • Buchi automata are finite automata equipped with an acceptance condition that is appropriate for (w-) infinite sequences: A sequence is accepted by the automaton iff the automaton can read it from left to right while visiting a sequence of states in which some final state occurs infinitely often. aw is not in the language (ab)w and bw are in the language a a a b Language equivalence of Buchi Automata is decidable b b IFIP 2002

  20. Construction of the finite automata for P,Q • Relevant constraints of W = {P1,…,Pn}: all constraints that can be constructed from constraints in P1,…,Pn. Formally: RC(skip) = {true} RC(tell(c)) = {c} RC(when c do P) = RC(unless c next P) = {c} U RC(P) RC(P || Q) = RC(P) U RC(Q) RC(!P) = RC(next P) = RC(P) RC((local x) P) = { Ex c , Ax c) | c in Closure(RC(P)) } RC(W) = And_Closure( Closure(RC(P1 ) ) U … U Closure(RC(Pn )) ) • Lemma 1: RC(W) is finite • Lemma 2: For P in W, (P,c) (P’,c and d) iff (P,c(W)) (P’,c(W) and d) where c(W) = max { d in C(W) | c |- d } (it always exists because RC(W) is and-closed) c c(W) RC(W) IFIP 2002

  21. Construction of the finite automata for P, Q Let S be the set of relevant constraints for W = { P, Q } • Derivatives of P wrt S = { P’ | (P,c) * (P’,c’), c in S }/~, where ~ is the smallest congruence containing P ~ P || P • Lemma: There are finitely many derivatives of P wrt S • The automaton for P (the one for Q is analogous) • States: The derivatives of P wrt S • Arcs: (c,d) in RC(W) x RC(W) is and arc from P’ to P’’ iff (P’,c) (R,d) and P’’~ R • Theorem: P eq Q iff the automaton corresponding to P and Q are language-equivalent IFIP 2002

  22. Separation between rep and rec0 • This separation is rather obvious: in rec0 a process can be active through infinitely many time units, but eventually it will stop producing information, because recursion contains neither parameters, nor local variables, hence processes cannot communicate with the external world • For instance, (truew,(x=1)w) is not in io(P) for any P in rec0 . In general the max number of steps during which info on x can be produced is not greater than the max number of nested next operators in whose scope x occurs free (not existentially quantified) • In rep it is possible to expess such io behavior: ! tell(x=1) IFIP 2002

  23. Expressiveness Equivalences Undecidable inclusion recp recd encoding Decidable rep reci recs rec0 IFIP 2002

  24. Encoding rep in reci • [[ ! P ]] = RP(x) with procedure definition RP(x) == P || next RP(x) and x = fv(P) • [[ ]] is homomorphic in all other operators Example: [[ ! tell(x=1) ]] = R(x) with R(x) == tell(x=1) || next R(x) IFIP 2002

  25. Encoding recs in rep • [[ P]] = (local zA1 … zAn) ( [[P]]’ || Pi [[ Ai = Pi]]’ ) • [[ Ai == Pi ]]’ = ! when call(zAi) do [[P]]’ • [[ Ai]]’ = tell( call(zAi) ) • [[ (local x) P ]]’ = (local y) ( [[P]]’ [y/x] ) with y fresh • The other operators are translated homomorphically Example: A == tell(x=1) || A [[A]] = (local z) (tell(call(zA))) || ! when call(zA) do ( tell(x=1) || tell(call(zA)) ) IFIP 2002

  26. Encoding rep in recs • This encoding uses the representation of rep processes as Buchi Automata • Let P be in rep and let A be the Buchi automaton associated to it (considering the relevant constraints of P only): • Given a state Q of A, define AQ == P(Q, c) =>(Q,d) when c do ( (tell(d) || unless e next AR) ) where e = V { c’ | c’ =/= c, c’ |- c and (Q, c) =>(Q,d) } IFIP 2002

  27. Encoding recd in recp • [[ A == P ]] = A(x) == [[ P ]] where x = fv(P) • [[ A ]] = A(x) • All the other operators are homomorphic IFIP 2002

  28. Encoding recp in recd • [[ A(x) == P ]] = A == [[ P ]] • [[ A(y) ]] = (local x) (A || repeat tell(x=y)) • All the other operators are homomorphic IFIP 2002

  29. Conclusion and future work • Various expressiveness results (positive and negative) for various tcc dialects • The fact that we are in a timed framework does not seem to play a crucial role. Do the results hold also in (deterministic) ccp? • The equivalence between recd and recp holds also in det ccp • We don’t know about the separation results (although we feel they still hold) • The other results involve rep and we should first define ! P in a non-timed context ( ! P = P || ! P is not interesting in deterministic ccp) • Does static vs dynamic scope make a difference also in other concurrent languages, for instance ccs? And how about replication vs recursion? IFIP 2002

More Related