A Behavioral Congruence for Concurrent Constraint Programming with Nondeterministic Choice Luis Pino*, Filippo Bonchi** and Frank Valencia* (Presented by: Jorge A. Pe rez) *E quipe Come te, LIX, Laboratoire de l E cole Polytechnique associe a l INRIA. **E quipe Plume, LIP, Ecole Normale Suprieure de Lyon - ENS de Lyon September 19, 2014 ICTAC 14, Bucharest, Romania Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 1 / 33
Motivation Concurrent constraint programming (ccp) Well-established formalism from concurrency theory. Combines algebraic and operational view of process calculi with a declarative one based upon logic. Models systems whose agents (processes or programs) interact by concurrently posting (telling) and querying (asking for) partial information in a shared medium (the store). Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 2 / 33
Motivation ask 0<temperature<100 then Q tell temperature < 70 temperature=? tell temperature > 42 ask temperature = 50 then P Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 3 / 33
Motivation ask 0<temperature<100 then Q tell temperature < 70 42 <temperature ask temperature = 50 then P Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 3 / 33
Motivation ask 0<temperature<100 then Q 42 <temperature<70 ask temperature = 50 then P Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 3 / 33
Motivation Q 42 <temperature<70 Remains Blocked ask temperature = 50 then P Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 3 / 33
Motivation Behavioral equivalences A central notion in any computational model of processes. Determine what processes are deemed indistinguishable. Congruence To enable algebraic and compositional reasoning, equivalences are expected to be congruences. If two processes are equivalent, one should be able to replace one with the other in any context and preserve the equivalence. Example: a context C = R. If is a congruence then P Q should imply P R Q R. Bisimilarity (and the bisimulation proof method) Reasoning on processes and their equalities therefore means dealing with infinite structures. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 4 / 33
Motivation Bisimilarity for ccp. First attempts to define bisimilarity for ccp are too fine grained. Latest notion of bisimilarity defined in [ABP + 11] is not completely satisfactory since it is a congruence only for a fragment of ccp Hint: Nondeterminism is difficult to handle. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 5 / 33
Motivation This paper: Introduce an equivalence for ccp that is also a congruence for the full language. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 6 / 33
Motivation This paper: Introduce an equivalence for ccp that is also a congruence for the full language. Hints: We shall use bisimilarity. The new notion will not require quantifying over infinitely many contexts. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 6 / 33
Outline 1 Syntax and Semantics of ccp 2 Bisimilarity for ccp 3 Full bisimilarity for ccp 4 Conclusions and Future Work Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 7 / 33
Outline Syntax and Semantics of ccp 1 Syntax and Semantics of ccp 2 Bisimilarity for ccp 3 Full bisimilarity for ccp 4 Conclusions and Future Work Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 8 / 33
Syntax and Semantics of ccp Syntax Let C = (Con, Con 0,,, true, false) be a constraint system. We write c, d, e... to denote (basic) constraints. Intuition: c d means that d contains more information than c. The ccp processes are given by the following syntax: P, Q,... ::= tell(c) ask (c i ) P i P Q x P p( z) where I is a finite set of indexes and c, c i Con 0. We use Proc to denote the set of all processes. i I Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 9 / 33
Syntax and Semantics of ccp Syntax Let C = (Con, Con 0,,, true, false) be a constraint system. We write c, d, e... to denote (basic) constraints. Intuition: c d means that d contains more information than c. The ccp processes are given by the following syntax: P, Q,... ::= tell(c) ask (c i ) P i P Q x P p( z) where I is a finite set of indexes and c, c i Con 0. We use Proc to denote the set of all processes. Summation-free ccp i I ccp\+ denotes the fragment of ccp without nondeterministic choice. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 9 / 33
Syntax and Semantics of ccp Operational Semantics A configuration is a pair P, d representing a state of a system: P is a process, i.e., a term of the syntax d is a constraint representing the global store Conf is the set of all configurations. γ, γ,... are elements of Conf. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 10 / 33
Labeled Semantics Syntax and Semantics of ccp In a transition of the form P, d α P, d the label α Con 0 represents a minimal information (from the environment) that needs to be added to the store d to reduce from P, d to P, d, i.e., P, d α P, d Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 11 / 33
Labeled Semantics Syntax and Semantics of ccp LR1 tell(c), d true stop, d c LR2 α P, d P, d α P Q, d P Q, d LR3 j I and α min{a Con 0 c j d a} i I ask (c α i) P i, d P j, d α Table: Labeled semantics for ccp (several rules are omitted). Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 12 / 33
Basic Examples Syntax and Semantics of ccp Tell: Ask: tell(x > 10), x > 5 true stop, x > 10 (ask (x > 10) Q) + (ask (y > 42) R), true x>10 Q, x > 10 Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 13 / 33
Outline Bisimilarity for ccp 1 Syntax and Semantics of ccp 2 Bisimilarity for ccp 3 Full bisimilarity for ccp 4 Conclusions and Future Work Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 14 / 33
Barbs Bisimilarity for ccp Barbs are basic observations (predicates) on the states of a system. Let γ = P, d then: Strong Barb γ c iff c Con 0 and c d Weak Barb γ c iff there exist γ s.t. γ γ c Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 15 / 33
Bisimilarity for ccp Example Let γ = ask (x > 10) tell(x > 42), x > 10. Strong barb: γ x>5 (x > 5) (x > 10) Weak barb: γ x>42 γ tell(x > 42), x > 10 stop, (x > 42) x>42 Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 16 / 33
Weak bisimilarity Bisimilarity for ccp A weak bisimulation is a symmetric relation R on configurations such that whenever (γ 1, γ 2 ) R with γ 1 = P, c and γ 2 = Q, d : (i) if γ 1 e then γ 2 e, α (ii) if γ 1 γ 1 then γ 2 s.t. Q, d α γ 2 and (γ 1, γ 2 ) R. We say that γ 1 and γ 2 are weakly bisimilar, written γ 1 exists a weak bisimulation R such that (γ 1, γ 2 ) R. We write P Q iff P, true Q, true. γ 2, if there Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 17 / 33
Example Bisimilarity for ccp Let γ 1 = stop, true and γ 2 = ask (c) tell(d), true. We can show that γ 1 γ 2 when d c. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 18 / 33
Example Bisimilarity for ccp Let γ 1 = stop, true and γ 2 = ask (c) tell(d), true. We can show that γ 1 γ 2 when d c. ask (c) tell(d), true stop, true c tell(d), c stop, c Notice that stop, c is bisimilar to ask (c) tell(d), c Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 18 / 33
Bisimilarity for ccp Weak bisimilarity and ccp\+ Weak bisimilarity is a congruence in the summation-free ccp: Theorem Let P and Q be ccp\+ processes and assume that P Q. Then for every process context C[ ] in ccp\+ we have C[P] C[Q]. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 19 / 33
Bisimilarity for ccp Weak bisimilarity and summation However, it is not a congruence when summation is present... Theorem There exist processes P, Q, R in (full) ccp such that: (a) P Q but (b) P R Q R. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 20 / 33
Proof sketch Bisimilarity for ccp The processes: P = ((ask (true) tell(c)) + (ask (true) tell(d))) tell(e) Q = (ask (true) tell(c e)) + (ask (true) tell(d e)) P, e tell(c), e tell(d), e stop, c e stop, d e Q, true tell(c e), true tell(d e), true stop, c e stop, d e Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 21 / 33
Proof sketch (II) Bisimilarity for ccp The context... R = (ask (e) tell(α)) + (ask (e) tell(β)) Now take... P R, e P tell(α), e Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 22 / 33
Proof sketch (II) Bisimilarity for ccp The context... Now take... R = (ask (e) tell(α)) + (ask (e) tell(β)) P R, e P tell(α), e However if Q R, true does not make a transition then we can take Q R, true e Q tell(β), true Therefore... Q tell(β), true Q, tell(β) β while P tell(α), e β Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 22 / 33
Outline Full bisimilarity for ccp 1 Syntax and Semantics of ccp 2 Bisimilarity for ccp 3 Full bisimilarity for ccp 4 Conclusions and Future Work Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 23 / 33
Full bisimilarity for ccp The solution: Weak full bisimilarity A weak full bisimulation is a symmetric relation R on configurations s.t. whenever (γ 1, γ 2 ) R with γ 1 = P, c and γ 2 = Q, d implies that: (i) there is γ 2 = Q, d such that Q, d γ 2 where c d and (γ 1, γ 2 ) R, α (ii) if γ 1 γ 1 then there exists γ 2 = Q, d s.t. Q, d α γ 2 where c d and (γ 1, γ 2 ) R. We say that γ 1 and γ 2 are weak fully bisimilar (γ 1 f γ 2 ) if there exists a weak full bisimulation R s.t. (γ 1, γ 2 ) R. We write P f Q iff P, true f Q, true. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 24 / 33
Full bisimilarity for ccp Back to the counterexample Let P and Q as in the previous example. We need a γ 2 = Q, d s.t. Q, d γ 2, e d and (γ 1, γ 2 ) R. We have two options Q = stop and d = c e or d = d e. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 25 / 33
Full bisimilarity for ccp Back to the counterexample Let P and Q as in the previous example. We need a γ 2 = Q, d s.t. Q, d γ 2, e d and (γ 1, γ 2 ) R. We have two options Q = stop and d = c e or d = d e. However, if we take ( P, e, stop, c e ) R we have that P, e d while stop, c e d. A similar argument works for stop, d e. Therefore, no weak full bisimulation may contain ( P, e, Q, true ). Hence P, e f Q, true. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 25 / 33
Full bisimilarity for ccp Weak full bisimilarity is a congruence Theorem Let P and Q be ccp processes and assume that P f Q. Then for every process context C[ ] we have that C[P] f C[Q]. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 26 / 33
Full bisimilarity for ccp Behavioral Congruence Definition We say that P is behaviorally congruent to Q, denoted P =Q, iff for every process context C[ ] we have C[P] C[Q]. We use P, e = Q, d to denote (P tell(e)) =(Q tell(d)). Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 27 / 33
Full bisimilarity for ccp Behavioral Congruence Weak full bisimilarity coincides with the behavioral congruence! Theorem P, e f Q, d iff P, e = Q, d. As promised, without requiring quantification over infinitely many contexts Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 28 / 33
Contributions Full bisimilarity for ccp Language Equivalences Congruence w.r.t. C[ ] C[ ]\+ ccp\+ = = f = = sb = o N/A =, f,, sb, o ccp = = f = sb o =, f =, f,, sb Table: Summary of the contributions. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 29 / 33
Outline Conclusions and Future Work 1 Syntax and Semantics of ccp 2 Bisimilarity for ccp 3 Full bisimilarity for ccp 4 Conclusions and Future Work Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 30 / 33
Conclusions and Future Work Conclusions and Future Work We showed that the weak bisimilarity ( ) proposed in [ABP + 11] is not a congruence for ccp. We proposed weak full bisimilarity ( f ) and we proved that it is a congruence for the full ccp. Moreover, f does not require any quantification over a (potentially) infinite number of contexts in its definition. Finally we demonstrated that f is not too restrictive by showing that it is the largest congruence included in. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 31 / 33
Conclusions and Future Work Conclusions and Future Work Adapt the algorithms from [ABPV12, PBV13] to verify f. We obtained a notion of weak bisimilarity that is a congruence even if we do not consider a label for observing the tell actions. We shall explore this in other asynchronous calculi. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 32 / 33
Conclusions and Future Work End of the Presentation Thanks for your attention Questions? Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 33 / 33
Constraint System Appendix Constraint System (cs) A cs is a complete algebraic lattice C = (Con, Con 0,,, true, false) where Con, the set of constraints, is a partially ordered set w.r.t., Con 0 is the subset of compact elements of Con, is the lub operation defined on all subsets, and true, false are the least and greatest elements of Con, respectively. The ordering is the reverse of an entailment relation: c d means d entails c, i.e., d contains more information than c. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 1 / 13
Appendix Example Let Var be a set of variables and ω be the set of natural numbers. A variable assignment is a function µ : Var ω. We use A to denote the set of all assignments, P(A) to denote the powerset of A, the empty set and the intersection of sets. Let us define the following constraint system: The set of constraints is P(A). We define c d iff c d. The constraint false is, while true is A. Given two constraints c and d, c d is the intersection c d. We will often use a formula like x < n to denote the corresponding constraint, i.e., the set of all assignments that map x to a number smaller than n. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 2 / 13
Operational Semantics Appendix R1 tell(c), d stop, d c R2 P, d P, d P Q, d P Q, d R3 j I and c j d i I ask (c i) P i, d P j, d Table: Reduction semantics for ccp (symmetric rule for R2 is omitted). Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 3 / 13
Operational Semantics Appendix R4 P, e xd P, e x d e xp, d e x P, d x e R5 P[ z/ x], d γ p( z), d γ where p( x) def = P is a process definition in D Table: Reduction semantics for ccp (symmetric rule for R2 is omitted). D is the set of process definitions. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 4 / 13
Labeled Semantics (II) Appendix LR4 α P[z/x], e[z/x] d P, e d α e α xp, d e [x/z] x P [x/z], x (e [x/z]) d α with x fv(e ), z fv(p) fv(e d α) LR5 P[ z/ x], d α γ α p( z), d γ where p( x) def = P is a process definition in D Table: Labeled semantics for ccp(the symmetric rules for LR2 and LR3 are omitted). Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 5 / 13
Appendix Properties of ccp\+ Confluence Let γ Conf ccp\+. If γ γ 1 and γ γ 2 then there exists γ such that γ 1 γ and γ 2 γ. Equivalence-preserving reductions Let γ Conf ccp\+ and let Deriv(γ) = {γ γ γ }. For all γ Deriv(γ) we have γ sb γ. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 6 / 13
Appendix Characterizing Weak Bisimilarity: First attempt Given the LTS (Conf, Con 0, ), one would like to exploit it for efficiently characterizing sb and sb. One first naive attempt would be to consider the standard notion of weak bisimilarity over, but this would distinguish configurations which are in sb (and sb ), as illustrated by the following two examples: Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 7 / 13
Strong Bisimilarity Appendix A saturated barbed bisimulation is a symmetric relation R on configurations s.t. whenever (γ 1, γ 2 ) R with γ 1 = P, c and γ 2 = Q, d implies that: (i) if γ 1 e then γ 2 e, (ii) if γ 1 γ 1 then there exists γ 2 s.t. γ 2 γ 2 and (γ 1, γ 2 ) R, (iii) for every a Con 0, ( P, c a, Q, d a ) R. We say that γ 1 and γ 2 are saturated barbed bisimilar (γ 1 sb γ 2 ) if there is a saturated barbed bisimulation R s.t. (γ 1, γ 2 ) R. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 8 / 13
Example Appendix Let d c, and take P = ask (d) stop and Q = ask (c) stop Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 9 / 13
Example Appendix Let d c, and take P = ask (d) stop and Q = ask (c) stop Now, since P, true sb Q, true, P, d while Q, d Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 9 / 13
Example Appendix Let d c, and take P = ask (d) stop and Q = ask (c) stop Now, since P, true sb Q, true, P, d while Q, d Then consider P + Q, true and observe that P + Q, true sb P, true Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 9 / 13
Appendix Weak Bisimilarity: Program Equivalence A weak saturated barbed bisimulation is a symmetric relation R on configurations s.t. whenever (γ 1, γ 2 ) R with γ 1 = P, c and γ 2 = Q, d implies that: (i) if γ 1 e then γ 2 e, (ii) if γ 1 γ 1 then there exists γ 2 s.t. γ 2 γ 2 and (γ 1, γ 2 ) R, (iii) for every a Con 0, ( P, c a, Q, d a ) R. We say that γ 1 and γ 2 are weak saturated barbed bisimilar (γ 1 sb γ 2 ) if there is a weak saturated barbed bisimulation R s.t. (γ 1, γ 2 ) R. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 10 / 13
Appendix Weak Bisimilarity: Program Equivalence A weak saturated barbed bisimulation is a symmetric relation R on configurations s.t. whenever (γ 1, γ 2 ) R with γ 1 = P, c and γ 2 = Q, d implies that: (i) if γ 1 e then γ 2 e, (ii) if γ 1 γ 1 then there exists γ 2 s.t. γ 2 γ 2 and (γ 1, γ 2 ) R, (iii) for every a Con 0, ( P, c a, Q, d a ) R. We say that γ 1 and γ 2 are weak saturated barbed bisimilar (γ 1 sb γ 2 ) if there is a weak saturated barbed bisimulation R s.t. (γ 1, γ 2 ) R. Remark The standard notion of observational ccp program equivalence was shown to coincide with sb in the case of ccp\+. [ABP + 11]. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 10 / 13
Example Appendix Let γ 1 = tell(true), true and γ 2 = ask (c) tell(d), true. We can show that γ 1 sb γ 2 when d c. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 11 / 13
Example Appendix Let γ 1 = tell(true), true and γ 2 = ask (c) tell(d), true. We can show that γ 1 sb γ 2 when d c. Since and γ 2 γ 1 stop, true c tell(d), c stop, c Then the symmetric closure of the following relation is a weak saturated barbed bisimulation: R = {(γ 2, γ 1 ), (γ 2, stop, true ), ( tell(d), c, stop, c ), ( stop, c, stop, c )} Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 11 / 13
Examples Appendix Strong Bisimilarity Example Let P = ask (x < 7) tell(true) Q = ask (x < 5) tell(true) We saw that P + Q, true sb P, true. However, P + Q, true x<5 x<5 tell(true), x < 5, while P, true. Weak Bisimilarity Example Let γ 1 = tell(true), true γ 2 = ask (c) tell(d), true c c We showed that γ 1 sb γ 2. However, γ 2, while γ 1 Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 12 / 13
Bibliography Appendix Andrés Aristizábal, Filippo Bonchi, Catuscia Palamidessi, Luis Pino, and Frank D. Valencia. Deriving labels and bisimilarity for concurrent constraint programming. In Martin Hofmann, editor, 14th International Conference on Foundations of Software Science and Computational Structures (FOSSACS 2011), volume 6604 of Lecture Notes in Computer Science, pages 138 152. Springer, 2011. Andrés Aristizábal, Filippo Bonchi, Luis Pino, and Frank D. Valencia. Partition refinement for bisimilarity in CCP. In Sascha Ossowski and Paola Lecca, editors, 27th Annual ACM Symposium on Applied Computing (SAC 2012), pages 88 93. ACM, 2012. Luis Fernando Pino, Filippo Bonchi, and Frank D. Valencia. Efficient computation of program equivalence for confluent concurrent constraint programming. In Ricardo Peña and Tom Schrijvers, editors, 15th International Symposium on Principles and Practice of Declarative Programming (PPDP 2013), pages 263 274. ACM, 2013. Luis Pino (Ecole Polytechnique) A Behavioral Congruence for ccp September 19, 2014 13 / 13