Abstract
Object-oriented (OO) languages such as Java are the dominating programming languages nowadays, among other reasons due to their ability to encapsulate data and operations working on them, as well as due to their support of inheritance. However, in contrast to constraint-logic languages, they are not particularly suited for solving search problems. During development of enterprise software, which occasionally requires some search, one option is to produce components in different languages and let them communicate. However, this can be clumsy.
As a remedy, we have developed the constraint-logic OO language Muli, which augments Java with logic variables and encapsulated search. Its implementation is based on a symbolic Java virtual machine that supports constraint solving and backtracking. In the present paper, we focus on the non-deterministic operational semantics of an imperative core language.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsNotes
- 1.
In other problems the return value could be a symbolic expressions if the accumulated constraints do not reduce the return value’s domain to a concrete value.
- 2.
Nevertheless, Muli’s symbolic JVM supports these features exactly according to the JVM specification [12] (but does not add interesting details w.r.t. non-determinism).
- 3.
In fact they are functions, since we ignore object-orientation in this presentation.
- 4.
A very simple constraint solver could just take equality constraints into account. In this case, \(\gamma \models x == v\), if \(\gamma = b_1 \wedge \ldots \wedge b_k\) and for some \(j\in \{1,\ldots ,k\}~~b_k = (x == v)\).
- 5.
In the implementation, the applicability of these rules will depend on the constraint propagation abilities of the employed constraint solver. We discuss the implications in Sect. 5.
- 6.
References
Albert, E., Hanus, M., Huch, F., Oliver, J., Vidal, G.: An operational semantics for declarative multi-paradigm languages. Electron. Notes Theor. Comput. Sci. 70(6), 65–86 (2002)
Bogdanas, D., Rosu, G.: K-Java: a complete semantics of Java. In: POPL 2015, pp. 1–12 (2015)
Cimadamore, M., Viroli, M.: A Prolog-oriented extension of Java programming based on generics and annotations. In: Amaral, V., et al. (eds.) Proceedings PPPJ, ACM ICPS, vol. 272, pp. 197–202. ACM (2007)
Cimadamore, M., Viroli, M.: Integrating Java and Prolog through generic methods and type inference. In: Wainwright, R.L., Haddad, H. (eds.) Proceedings of the 2008 SAC, pp. 198–205. ACM (2008). https://doi.org/10.1145/1363686
Frühwirth, T., Abdennadher, S.: Essentials of Constraint Programming. Springer, Heidelberg (2003). https://doi.org/10.1007/978-3-662-05138-2
Gosling, J., Joy, B., Steele, G., Bracha, G., Buckley, A.: The Java® Language Specification - Java SE 8 Edition (2015). https://docs.oracle.com/javase/specs/jls/se8/jls8.pdf
Hainry, E., Péchoux, R.: Objects in polynomial time. In: Feng, X., Park, S. (eds.) APLAS 2015. LNCS, vol. 9458, pp. 387–404. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-26529-2_21
Hooker, J.N.: Operations research methods in constraint programming (Chap. 15). In: Rossi, F., van Beek, P., Walsh, T. (eds.) Handbook of CP. Elsevier, Amsterdam (2006)
Igarashi, A., Pierce, B.C., Wadler, P.: Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst. 23(3), 396–450 (2001)
Kondoh, G., Onodera, T.: Finding bugs in Java native interface programs. In: ISSTA 2008, p. 109 (2008)
Kuchcinski, K.: Constraints-driven scheduling and resource assignment. ACM Trans. Des. Autom. Electron. Syst. 8(3), 355–383 (2003)
Lindholm, T., Yellin, F., Bracha, G., Buckley, A.: The Java® Virtual Machine Specification - Java SE 8 Edition (2015). https://docs.oracle.com/javase/specs/jvms/se8/jvms8.pdf
Louden, K.C.: Programming Languages: Principles and Practice. Wadsworth Publ. Co., Belmont (1993)
Majchrzak, T.A., Kuchen, H.: Logic Java: combining object-oriented and logic programming. In: Kuchen, H. (ed.) WFLP 2011. LNCS, vol. 6816, pp. 122–137. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-22531-4_8
Moss, C.: Prolog++ - The Power of Object-Oriented and Logic Programming. International Series in Logic Programming. Addison-Wesley, Boston (1994)
Ostermayer, L.: Seamless cooperation of Java and Prolog for rule-based software development. In: Proceedings of the RuleML 2015, Berlin (2015)
Scott, R.: A Guide to Artificial Intelligence with Visual Prolog. Outskirts Press (2010)
Shapiro, E., Takeuchi, A.: Object oriented programming in concurrent Prolog. New Gener. Comput. 1(1), 25–48 (1983)
Stärk, R., Schmid, J., Börger, E.: Java and the Java Virtual Machine - Definition, Verification, Validation. Springer, Heidelberg (2001). https://doi.org/10.1007/978-3-642-59495-3
Triska, M.: The finite domain constraint solver of SWI-Prolog. In: Schrijvers, T., Thiemann, P. (eds.) FLOPS 2012. LNCS, vol. 7294, pp. 307–316. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-29822-6_24
Van Roy, P., Brand, P., Duchier, D., Haridi, S., Schulte, C., Henz, M.: Logic programming in the context of multiparadigm programming: the Oz experience. Theory Pract. Log. Program. 3(6), 717–763 (2003)
Warren, D.H.D.: An abstract Prolog instruction set. Technical report, SRI International, Menlo Park (1983)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendix: Full Example Evaluation
Appendix: Full Example Evaluation
In addition to \(\rho _0\), \(\sigma _0\), and \(\gamma _1\) defined in section Sect. 4, the following auxiliary definitions will be needed as intermediate results: \(\rho _1 = \rho _0[x/\alpha _1, y/\alpha _2]\), \(\rho _2 = \rho _0[b/\alpha _3, y/\alpha _4]\), \(\rho _3 = \rho _2[i/\alpha _5,r/\alpha _6]\), \(\rho _4 = \rho _3[i/\alpha _7, r/\alpha _8]\), \(\sigma _1 = \sigma _0[\alpha _1/1, \alpha _2/\alpha _2]\), \(\sigma _2 = \sigma _1[\alpha _3/2, \alpha _4/\alpha _2]\), \(\sigma _3 = \sigma _2[\alpha _7/0, \alpha _8/1]\), \(\sigma _4 = \sigma _3[\alpha _0/1]\), \(\sigma _5 = \sigma _4[\alpha _0/\!\perp ]\), \(\sigma _6 = \sigma _5[\alpha _0/0]\), \(\gamma _2 = \gamma _1 \wedge \alpha _2 \le 0\), and \(\gamma _3 = \gamma _2 \wedge \alpha _2 == 0 \). To simplify the understanding of the full computation provided in Sect. 4, we have decomposed it into a couple of lemmas. We present the computation in a top-down fashion. If you prefer a bottom-up fashion, just read the lemmas in reverse order. The names of the applied rules are specified in each step.
Rights and permissions
Copyright information
© 2018 Springer Nature Switzerland AG
About this paper
Cite this paper
Dageförde, J.C., Kuchen, H. (2018). An Operational Semantics for Constraint-Logic Imperative Programming. In: Seipel, D., Hanus, M., Abreu, S. (eds) Declarative Programming and Knowledge Management. WFLP WLP INAP 2017 2017 2017. Lecture Notes in Computer Science(), vol 10997. Springer, Cham. https://doi.org/10.1007/978-3-030-00801-7_5
Download citation
DOI: https://doi.org/10.1007/978-3-030-00801-7_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-00800-0
Online ISBN: 978-3-030-00801-7
eBook Packages: Computer ScienceComputer Science (R0)