Abstract
Cylindric algebras have been developed as an algebraisation of equational first order logic. We adapt them to cylindric Kleene lattices and their variants and present relational and relational fault models for these. This allows us to encode frames and local variable blocks, and to derive Morgan’s refinement calculus as well as an algebraic Hoare logic for while programs with assignment laws. Our approach thus opens the door for algebraic calculations with program and logical variables instead of domain-specific reasoning over concrete models of the program store. A refinement proof for a small program is presented as an example.
Dongol and Struth are supported by EPSRC Grant EP/R032556/2; Hayes, Meinicke and Dongol are supported by ARC Discovery Grant DP190102142.
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 applying Henkin, Monk and Tarski’s work to program algebra we do not rely much on the use of ordinals; sets usually suffice.
- 2.
- 3.
- 4.
This is similar to the predicative encoding of relations in the Z style [16, 27], in which the value of a variable \(\kappa \) in the initial state is represented by \(\kappa \) and its value in the final state is represented by \(\kappa '\); relational cylindrification in Z is represented by \(\exists _{\kappa ,\kappa '} R\), i.e. \(C_\kappa C_{\kappa '} R\) in the relational model. That is, relations are encoded using a set of variables, which for each program variable \(\kappa \) also contains \(\kappa '\).
- 5.
We are grateful to an anonymous referee for pointing out an encoding.
- 6.
In that paper \(c_{\kappa }{x}\) is written \(x \backslash \kappa \).
References
Andréka, H., Mikulás, S., Németi, I.: The equational theory of Kleene lattices. Theoret. Comput. Sci. 412(52), 7099–7108 (2011)
Armstrong, A., Gomes, V.B.F., Struth, G.: Building program construction and verification tools from algebraic principles. Formal Aspects Comput. 28(2), 265–293 (2016)
Back, R.-J., von Wright, J.: Refinement calculus - a systematic introduction. Springer, New York (1999). https://doi.org/10.1007/978-1-4612-1674-2
Birkhoff, G.: Lattice Theory. American Mathematical Society, New York (1940)
Colvin, R.J., Hayes, I.J., Meinicke, L.A.: Designing a semantic model for a wide-spectrum language with concurrency. Formal Aspects Comput. 29, 853–875 (2016)
Cranch, J., Laurence, M.R., Struth, G.: Completeness results for omega-regular algebras. J. Logical Algebric Methods Program. 84(3), 402–425 (2015)
Desharnais, J., Möller, B., Struth, G.: Kleene algebra with domain. ACM TOCL 7(4), 798–833 (2006)
Desharnais, J., Struth, G.: Internal axioms for domain semirings. Sci. Comput. Program. 76(3), 181–203 (2011)
The Coq development team. The Coq proof assistant reference manual. LogiCal Project. Version 8.0 (2004)
Dongol, B., Gomes, V.F.B., Hayes, I.J., Struth, G.: Partial semigroups and convolution algebras. Arch. Formal Proofs (2017)
Dongol, B., Hayes, I.J., Struth, G.: Relational convolution, generalised modalities and incidence algebras. CoRR, abs/1702.04603 (2017)
Ehm, T., Möller, B., Struth, G.: Kleene modules. In: Berghammer, R., Möller, B., Struth, G. (eds.) RelMiCS 2003. LNCS, vol. 3051, pp. 112–123. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-24771-5_10
Gabbay, M.J., Ciancia, V.: Freshness and name-restriction in sets of traces with names. In: Hofmann, M. (ed.) FoSSaCS 2011. LNCS, vol. 6604, pp. 365–380. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-19805-2_25
Giacobazzi, R., Debray, S.K., Levi, G.: A generalized semantics for constraint logic programs. In: FGCS, pp. 581–591 (1992)
Gomes, V.B.F., Struth, G.: Modal Kleene algebra applied to program correctness. In: Fitzgerald, J., Heitmeyer, C., Gnesi, S., Philippou, A. (eds.) FM 2016. LNCS, vol. 9995, pp. 310–325. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-48989-6_19
Hayes, I. (ed.): Specification Case Studies, 2nd edn. Prentice Hall International, Englewood Cliffs (1993)
Henkin, L., Donald Monk, J., Tarski, A.: Cylindric Algebras, Part I., volume 64 of Studies in logic and the foundations of mathematics. North-Holland Pub. Co. (1971)
Kozen, D.: On action algebras. In: van Eijk, J., Visser, A. (eds.) Logic and Information Flow, pp. 78–88. MIT Press, Cambridge (1994)
Kozen, D.: Kleene algebra with tests. ACM Trans. Program. Lang. Syst. 19(3), 427–443 (1997)
Kozen, D.: On Hoare logic and Kleene algebra with tests. ACM Trans. Comput. Log. 1(1), 60–76 (2000)
Meinicke, L.A., Hayes, I.J.: Handling localisation in rely/guarantee concurrency: an algebraic approach. arXiv:1907.04005 [cs.LO] (2019)
Möller, B., Struth, G.: wp is wlp. In: MacCaull, W., Winter, M., Düntsch, I. (eds.) RelMiCS 2005. LNCS, vol. 3929, pp. 200–211. Springer, Heidelberg (2006). https://doi.org/10.1007/11734673_16
Morgan, C.: Programming From Specifications. Prentice-Hall, Upper Saddle River (1990)
Morgan, C.C.: Programming from Specifications, 2nd edn. Prentice Hall, Hemel Hempstead (1994)
Pous, D.: Kleene algebra with tests and Coq tools for while programs. In: Blazy, S., Paulin-Mohring, C., Pichardie, D. (eds.) ITP 2013. LNCS, vol. 7998, pp. 180–196. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39634-2_15
Pratt, V.: Action logic and pure induction. In: van Eijck, J. (ed.) JELIA 1990. LNCS, vol. 478, pp. 97–120. Springer, Heidelberg (1991). https://doi.org/10.1007/BFb0018436
Spivey, J.M.: The Z notation: a reference manual, 2nd edn. Prentice Hall International, Englewood Cliffs (1992)
Struth, G.: Hoare semigroups. Math. Struct. Comput. Sci. 28(6), 775–799 (2018)
von Wright, J.: Towards a refinement algebra. Sci. Comput. Program. 51(1–2), 23–45 (2004)
Wells, C.: Some applications of the wreath product construction. Am. Math. Monthly 83(5), 317–338 (1976)
Acknowledgements
We thank Simon Doherty for discussions on earlier versions of this work.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendices
A Construction of Weak Kleene Lattices
Instead of proving Proposition 2, we show that it is a corollary to a standard semidirect product construction, which is well known from semigroup theory. All proofs in this appendix have been verified with Isabelle.
An l-monoid module of an l-monoid L and a semilattice S with least element 0 is an action \(\circ :L\rightarrow S\rightarrow S\) that satisfies
It follows that \(p\circ 0 = 0\).
The semidirect product \(L\ltimes S\) on \(L\times S\) is defined by
The relational redefinition of composition in Sect. 3 is a simple instance of this standard algebraic concept. It is easy to check that (1, 0) is the unit of \(\ltimes \) and (0, 0) a left annihilator. In addition, we define join and meet pointwise on pairs as \((p,x)+(q,y)=(p+q,x+y)\) and \((p,x)\cdot (q,y)=(p\cdot q,x\cdot y)\). The following fact is routine. Most axioms have already been checked elsewhere [6, 11].
Proposition 15
Let L be an l-monoid and S a semilattice with 0. Then \(L\ltimes S\) forms a weak l-monoid.
If K is a Kleene lattice, we define a Kleene lattice module by adding the axiom
Hence the action axioms for Kleene lattice modules are essentially those for Kleene modules [12]. Finally, we define the star on products as
It follows that \((p,x)^+ = (p^+,p^*\circ x)\).
Proposition 15 then extends as follows.
Theorem 1
Let K be a Kleene lattice and S a semilattice with 0. Then \(K\ltimes S\) forms a weak Kleene lattice.
Dongol, Hayes and Struth [11] present a similar result in the less general setting of quantale modules, which however captures the relational fault model in Sect. 3. A formalisation with Isabelle can be found in the Archive of Formal Proofs [10], including a verification of the properties of the relational star presented in Sect. 3. Cranch, Laurence and Struth [6] present a second proof in the more general setting of regular algebras that satisfy strictly weaker induction axioms. It gives a good impression of the manipulations needed in our present proof. Möller and Struth [22] present a third proof for total correctness in the setting of modal Kleene algebras. Instead of semidirect products, it is based on wreath products (cf. [30]).
B Construction of Weak Liberation Kleene Lattices
Instead of proving Proposition 13 for relational cylindrification we give an algebraic proof based on a new algebraic definition. This proof also supports an indirect proof of Proposition 2. All proofs in this appendix have once again been checked with Isabelle.
A cylindric Kleene lattice module is a Kleene lattice module over a cylindric Kleene lattice with cylindrification defined by
By this definition, \(\widetilde{c}_\kappa \, (1,0) = (1_\kappa ,0)\) and .
First we derive an algebraic variant of Lemma 6 that is suitable for the relational fault model.
Lemma 21
Let L be a \(\mathsf {CKL}\) and S a semilattice with 0. Then
Next we turn to the algebraic proof that subsumes Proposition 13.
A Liberation Kleene lattice module is a Kleene lattice module defined over a liberation Kleene lattice.
Proposition 16
Let K be a \(\mathsf {LKL}\) and S a semilattice with 0, such that
holds for all \(x,y\in S\). Then \(K\ltimes S\) forms a weak \(\mathsf {LKL}\).
Rights and permissions
Copyright information
© 2019 Springer Nature Switzerland AG
About this paper
Cite this paper
Dongol, B., Hayes, I., Meinicke, L., Struth, G. (2019). Cylindric Kleene Lattices for Program Construction. In: Hutton, G. (eds) Mathematics of Program Construction. MPC 2019. Lecture Notes in Computer Science(), vol 11825. Springer, Cham. https://doi.org/10.1007/978-3-030-33636-3_8
Download citation
DOI: https://doi.org/10.1007/978-3-030-33636-3_8
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-33635-6
Online ISBN: 978-3-030-33636-3
eBook Packages: Computer ScienceComputer Science (R0)