Abstract
We develop an automated specialization framework for rewrite theories that model concurrent systems. A rewrite theory \(\mathscr {R}=(\Sigma ,E\uplus B,R)\) consists of two main components: an order-sorted equational theory \(\mathscr {E}=(\Sigma ,E\uplus B)\) that defines the system states as terms of an algebraic data type and a term rewriting system R that models the concurrent evolution of the system as state transitions. Our main idea is to partially evaluate the underlying equational theory \(\mathscr {E}\) to the specific calls required by the rewrite rules of R in order to make the system computations more efficient. The specialization transformation relies on folding variant narrowing, which is the symbolic operational engine of Maude’s equational theories. We provide three instances of our specialization scheme that support distinct classes of theories that are relevant for many applications. The effectiveness of our method is finally demonstrated in some specialization examples.
This work has been partially supported by the EC H2020-EU grant agreement No. 952215 (TAILOR), grants RTI2018-094403-B-C32 and PID2021-122830OB-C42 funded by MCIN/AEI/10.13039/501100011033 and by “ERDF A way of making Europe”, by Generalitat Valenciana under grant PROMETEO/2019/098, and by the Department Strategic Plan (PSD) of the University of Udine—Interdepartmental Project on Artificial Intelligence (2021-25).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
For example, assuming a commutative binary operator \(*\), the term \(s(0)*0\) matches within the term \(X*s(Y)\) modulo the commutativity of symbol \(*\) with matching substitution \(\{X/0,Y/0\}\).
- 2.
A variant [22] of a term t in the theory \(\mathcal{E}\) is the canonical (i.e., irreducible) form of \(t \sigma \) in \(\mathcal{E}\) for a given substitution \(\sigma \); in symbols, it is represented as the pair \((t\sigma \!\!\downarrow _{\vec {E},B},\sigma )\).
- 3.
In [40], natural numbers are encoded by using two constants 0 and 1 and an ACU operator + so that a natural number is either the constant 0 or a finite sequence 1 + 1 ... + 1.
- 4.
Besides the topmost assumption for \(\mathscr {R}\), we also consider the classical executability restriction that the set R of rules is coherent with E modulo B (intuitively, this ensures that a rewrite step with R can always be postponed in favor of deterministically rewriting with E modulo B).
- 5.
In an order-sorted setting, multiple equations are actually used to cover any possible sort in \(\mathscr {R}\).
- 6.
For example, by using \(\epsilon \), the term \(s(0)*0\,=\!?\!=\,U*s(V)\) FV-narrows to tt (modulo commutativity of \(*\)), and the computed narrowing substitution does coincide with the unifier modulo commutativity of the two argument terms, i.e., \(\{U\mapsto 0,V\mapsto 0\}\).
- 7.
For simplicity, we assume that Q is normalized w.r.t. the equational theory \(\mathscr {E}\). If this were not the case, for each \(t\in Q\) that is not in canonical form such that \(t\!\downarrow _{\vec {E},B}=C(\overline{t_{i}})\), where C() is the (possibly empty) constructor context of \(t\!\downarrow _{\vec {E},B}\) and \(\overline{t_{i}}\) are the maximal calls in \(t\!\downarrow _{\vec {E},B}\), we would replace t in Q with the normalized terms \(\overline{t_{i}}\) and add a suitable “bridge” equation \(t =C(\overline{t_{i}})\) to the resulting specialization.
- 8.
The case when \(\mathscr {E}\) satisfies SC but not the FVP is not considered because there is no technique to compute the finite set of most general constructor variants in this case, which is a matter for future research.
References
Albert, E., Alpuente, M., Falaschi, M., Vidal, G.: Indy User’s Manual. Technical report DSIC-II/12/98, Department of Computer Systems and Computation, Universitat Politècnica de València (1998)
Albert, E., Alpuente, M., Harms, M., Vidal, G.: A partial evaluation framework for curry programs. In: Ganzinger, H., McAllester, D., Voronkov, A. (eds.) LPAR 1999. LNCS (LNAI), vol. 1705, pp. 376–395. Springer, Heidelberg (1999). https://doi.org/10.1007/3-540-48242-3_23
Alpuente, M., Ballis, D., Baggi, M., Falaschi, F.: A fold/unfold transformation framework for rewrite theories extended to CCT. In: Gallagher, J., Voigtländer, J. (eds.) ACM SIGPLAN Workshop on Partial Evaluation and Program Manipulation (PEPM 2010), pp. 43–52. ACM. https://doi.org/10.1145/1706356.1706367
Alpuente, M., Ballis, D., Frechina, F., Sapiña, J.: Assertion-based analysis via slicing with ABETS (system description). Theory Pract. Logic Program. 16(5–6), 515–532 (2016)
Alpuente, M., Ballis, D., Frechina, F., Sapiña, J.: Debugging Maude programs via runtime assertion checking and trace slicing. J. Log. Algebr. Methods Program. 85, 707–736 (2016)
Alpuente, M., Ballis, D., Romero, D.: A rewriting logic approach to the formal specification and verification of web applications. Sci. Comput. Program. 81, 79–107 (2014)
Alpuente, M., Cuenca-Ortega, A., Escobar, S., Meseguer, J.: A partial evaluation framework for order-sorted equational programs modulo axioms. J. Log. Algebr. Methods Program. 110, 1–36 (2020)
Alpuente, M., Cuenca-Ortega, A., Escobar, S., Meseguer, J.: Order-sorted homeomorphic embedding modulo combinations of associativity and/or commutativity axioms. Fund. Inform. 177(3–4), 297–329 (2020)
Alpuente, M., Cuenca-Ortega, A., Escobar, S., Sapiña, J.: Inspecting Maude variants with GLINTS. Theory Pract. Logic Program. 17(5–6), 689–707 (2017)
Alpuente, M., Escobar, S., Espert, J., Meseguer, J.: A modular order-sorted equational generalization algorithm. Inf. Comput. 235, 98–136 (2014)
Alpuente, M., Escobar, S., Iborra, J.: Termination of narrowing revisited. Theoret. Comput. Sci. 410(46), 4608–4625 (2009)
Alpuente, M., Falaschi, M., Julián, P., Vidal, G.: Specialization of lazy functional logic programs. In: Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation (PEPM 1997), pp. 151–162. Association for Computing Machinery (1997)
Alpuente, M., Falaschi, M., Moreno, G., Vidal, G.: Safe folding/unfolding with conditional narrowing. In: Hanus, M., Heering, J., Meinke, K. (eds.) ALP/HOA -1997. LNCS, vol. 1298, pp. 1–15. Springer, Heidelberg (1997). https://doi.org/10.1007/BFb0026999
Alpuente, M., Falaschi, M., Vidal, G.: A unifying view of functional and logic program specialization. ACM Comput. Surv. 30(3es), 9es (1998)
Alpuente, M., Falaschi, M., Vidal, G.: Partial evaluation of functional logic programs. ACM Trans. Program. Lang. Syst. 20(4), 768–844 (1998)
Alpuente, M., Lucas, S., Hanus, M., Vidal, G.: Specialization of functional logic programs based on needed narrowing. Theory Pract. Logic Program. 5(3), 273–303 (2005)
Bae, K., Escobar, S., Meseguer, J.: Abstract logical model checking of infinite-state systems using narrowing. In: Proceedings of the 24th International Conference on Rewriting Techniques and Applications (RTA 2013). Leibniz International Proceedings in Informatics (LIPIcs), vol. 21, pp. 81–96. Schloss Dagstuhl - Leibniz-Zentrum für Informatik (2013)
Baelde, D., Delaune, S., Gazeau, I., Kremer, S.: Symbolic verification of privacy-type properties for security protocols with XOR. In: Proceedings of the 30th International Symposium on Computer Security Foundations (CSF 2017), pp. 234–248. IEEE Computer Society Press (2017)
Bouchard, C., Gero, K.A., Lynch, C., Narendran, P.: On forward closure and the finite variant property. In: Fontaine, P., Ringeissen, C., Schmidt, R.A. (eds.) FroCoS 2013. LNCS (LNAI), vol. 8152, pp. 327–342. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-40885-4_23
Burstall, R.M., Darlington, J.: A transformation system for developing recursive programs. J. ACM 24(1), 44–67 (1977)
Clavel, M., et al.: Maude Manual (Version 3.0). Technical report, SRI International Computer Science Laboratory (2020). http://maude.cs.uiuc.edu
Comon-Lundh, H., Delaune, S.: The finite variant property: how to get rid of some algebraic properties. In: Giesl, J. (ed.) RTA 2005. LNCS, vol. 3467, pp. 294–307. Springer, Heidelberg (2005). https://doi.org/10.1007/978-3-540-32033-3_22
Danvy, O., Glück, R., Thiemann, P.: Partial Evaluation, International Seminar, Dagstuhl Castle, Germany. Springer, Heidelberg (1996). https://doi.org/10.1007/3-540-61580-6
Durán, F., et al.: Programming and symbolic computation in Maude. J. Log. Algebr. Methods Program. 110, 100497 (2020)
Durán, F., Eker, S., Escobar, S., Martí-Oliet, N., Meseguer, J., Talcott, C.: Associative unification and symbolic reasoning modulo associativity in Maude. In: Rusu, V. (ed.) WRLA 2018. LNCS, vol. 11152, pp. 98–114. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-99840-4_6
Durán, F., Lucas, S., Meseguer, J.: MTT: the Maude termination tool (system description). In: Armando, A., Baumgartner, P., Dowek, G. (eds.) IJCAR 2008. LNCS (LNAI), vol. 5195, pp. 313–319. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-71070-7_27
Durán, F., Meseguer, J., Rocha, C.: Ground confluence of order-sorted conditional specifications modulo axioms. J. Log. Algebr. Methods Program. 111, 100513 (2020)
Escobar, S., Meadows, C., Meseguer, J.: Maude-NPA: cryptographic protocol analysis modulo equational properties. In: Aldini, A., Barthe, G., Gorrieri, R. (eds.) FOSAD 2007-2009. LNCS, vol. 5705, pp. 1–50. Springer, Heidelberg (2009). https://doi.org/10.1007/978-3-642-03829-7_1
Escobar, S., Meseguer, J.: Symbolic model checking of infinite-state systems using narrowing. In: Baader, F. (ed.) RTA 2007. LNCS, vol. 4533, pp. 153–168. Springer, Heidelberg (2007). https://doi.org/10.1007/978-3-540-73449-9_13
Escobar, S., Meseguer, J., Sasse, R.: Variant narrowing and equational unification. Electron. Notes Theor. Comput. Sci. 238(3), 103–119 (2009)
Escobar, S., Sasse, R., Meseguer, J.: Folding variant narrowing and optimal variant termination. J. Logic Algebraic Program. 81(7–8), 898–928 (2012)
Gnaedig, I., Kirchner, H.: Computing constructor forms with non terminating rewrite programs. In: Proceedings of the 8th ACM SIGPLAN Conference on Principles and Practice of Declarative Programming (PPDP 2006), pp. 121–132. Association for Computing Machinery (2006)
Jones, N.D., Gomard, C.K., Sestoft, P.: Partial Evaluation and Automatic Program Generation. Prentice-Hall, Hoboken (1993)
Leuschel, M.: Improving homeomorphic embedding for online termination. In: Flener, P. (ed.) LOPSTR 1998. LNCS, vol. 1559, pp. 199–218. Springer, Heidelberg (1999). https://doi.org/10.1007/3-540-48958-4_11
Lloyd, J.W., Shepherdson, J.C.: Partial evaluation in logic programming. J. Logic Program. 11(3–4), 217–242 (1991)
Martens, B., Gallagher, J.: Ensuring global termination of partial deduction while allowing flexible polyvariance. In: Proceedings of the 12th International Conference on Logic Programming (ICLP 1995), pp. 597–611. The MIT Press (1995)
Meier, S., Schmidt, B., Cremers, C., Basin, D.: The TAMARIN prover for the symbolic analysis of security protocols. In: Sharygina, N., Veith, H. (eds.) CAV 2013. LNCS, vol. 8044, pp. 696–701. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39799-8_48
Meseguer, J.: Conditional rewriting logic as a unified model of concurrency. Theoret. Comput. Sci. 96(1), 73–155 (1992)
Meseguer, J.: Variant-based satisfiability in initial algebras. In: Artho, C., Ölveczky, P.C. (eds.) FTSCS 2015. CCIS, vol. 596, pp. 3–34. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-29510-7_1
Meseguer, J.: Variant-based satisfiability in initial algebras. Sci. Comput. Program. 154, 3–41 (2018)
Meseguer, J.: Generalized rewrite theories, coherence completion, and symbolic methods. J. Log. Algebr. Methods Program. 110, 100483 (2020)
Meseguer, J., Palomino, M., Martí-Oliet, N.: Equational abstractions. Theoret. Comput. Sci. 403(2–3), 239–264 (2008)
Meseguer, J., Thati, P.: Symbolic reachability analysis using narrowing and its application to verification of cryptographic protocols. Higher-Order Symb. Comput. 20(1–2), 123–160 (2007)
Middeldorp, A., Hamoen, E.: Counterexamples to completeness results for basic narrowing (extended abstract). In: Kirchner, H., Levi, G. (eds.) ALP 1992. LNCS, vol. 632, pp. 244–258. Springer, Heidelberg (1992). https://doi.org/10.1007/BFb0013830
Ölveczky, P.C., Meseguer, J.: The real-time Maude tool. In: Ramakrishnan, C.R., Rehof, J. (eds.) TACAS 2008. LNCS, vol. 4963, pp. 332–336. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-78800-3_23
The Presto Website (2020). http://safe-tools.dsic.upv.es/presto
Roşu, G.: \(\mathbb{K} \): a semantic framework for programming languages and formal analysis tools. In: Dependable Software Systems Engineering. NATO Science for Peace and Security Series - D: Information and Communication Security, vol. 50, pp. 186–206. IOS Press (2017)
Rodríguez, A., Durán, F., Rutle, A., Kristensen, L.M.: Executing multilevel domain-specific models in Maude. J. Object Technol. 18(2), 4:1–4:21 (2019)
Slagle, J.R.: Automated theorem-proving for theories with simplifiers, commutativity, and associativity. J. ACM 21(4), 622–642 (1974)
Viry, P.: Equational rules for rewriting logic. Theoret. Comput. Sci. 285(2), 487–517 (2002)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendices
A Full Specification of the Bank Account System

B Specialization of the Bank Account System \(\mathscr {R}_b\)

C Specialization of the Bank Account System \(\mathscr {R}_b\) with Compression

Rights and permissions
Copyright information
© 2023 Springer Nature Switzerland AG
About this chapter
Cite this chapter
Alpuente, M., Ballis, D., Escobar, S., Meseguer, J., Sapiña, J. (2023). Optimizing Maude Programs via Program Specialization. In: Lopez-Garcia, P., Gallagher, J.P., Giacobazzi, R. (eds) Analysis, Verification and Transformation for Declarative Programming and Intelligent Systems. Lecture Notes in Computer Science, vol 13160. Springer, Cham. https://doi.org/10.1007/978-3-031-31476-6_2
Download citation
DOI: https://doi.org/10.1007/978-3-031-31476-6_2
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-31475-9
Online ISBN: 978-3-031-31476-6
eBook Packages: Computer ScienceComputer Science (R0)