Abstract
In response to the challenges associated with a Coq-based extraction of readable and traceable Scala code, the Scallina project defines a grammar delimiting a common subset of Gallina and Scala along with an optimized translation strategy for programs conforming to the aforementioned grammar. The Scallina translator shows how these contributions can be transferred into a working prototype. A typical application features a user implementing a functional program in Gallina, the core language of Coq, proving this program’s correctness with regards to its specification and making use of Scallina to synthesize readable Scala components.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
An implementation extracted from a program which is proven-correct in a proof assistant can be considered correct when one assumes that the proof assistant itself and its corresponding extraction mechanism are correct.
- 2.
Unless these programs are rewritten from scratch and manually proven using the proof assistant.
- 3.
- 4.
Scheme will not be considered in this paper since it is not statically typed.
- 5.
- 6.
Except that types cannot start by an abstraction or a constructor.
- 7.
More information about Leon’s Pure Scala is available in paragraph 3 of [3] and in the documentation section of http://leon.epfl.ch.
- 8.
- 9.
Note that values can, in turn, easily be converted to Java values.
- 10.
- 11.
- 12.
- 13.
References
Amin, N., Grütter, S., Odersky, M., Rompf, T., Stucki, S.: The essence of dependent object types. In: Lindley, S., McBride, C., Trinder, P., Sannella, D. (eds.) A List of Successes That Can Change the World. LNCS, vol. 9600, pp. 249–272. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-30936-1_14
Barthe, G., Forest, J., Pichardie, D., Rusu, V.: Defining and reasoning about recursive functions: a practical tool for the coq proof assistant. In: Hagiya, M., Wadler, P. (eds.) FLOPS 2006. LNCS, vol. 3945, pp. 114–129. Springer, Heidelberg (2006). https://doi.org/10.1007/11737414_9
Blanc, R., Kuncak, V., Kneuss, E., Suter, P.: An overview of the leon verification system: verification by translation to recursive functions. In: Proceedings of the 4th Workshop on Scala, SCALA 2013, pp. 1:1–1:10. ACM, New York (2013). https://doi.org/10.1145/2489837.2489838
Filliâtre, J.-C., Paskevich, A.: Why3 — where programs meet provers. In: Felleisen, M., Gardner, P. (eds.) ESOP 2013. LNCS, vol. 7792, pp. 125–128. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-37036-6_8
Guallart, N.: An overview of type theories. Axiomathes 25(1), 61–77 (2015). https://doi.org/10.1007/s10516-014-9260-9
Haftmann, F., Bulwahn, L.: Code generation from Isabelle/HOL theories, October 2017. https://isabelle.in.tum.de/dist/Isabelle2017/doc/codegen.pdf
Haftmann, F., Nipkow, T.: Code generation via higher-order rewrite systems. In: Blume, M., Kobayashi, N., Vidal, G. (eds.) FLOPS 2010. LNCS, vol. 6009, pp. 103–117. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-12251-4_9
Hindley, R.: The principle type-scheme of an object in combinatory logic. Trans. Am. Math. Soc. 146, 29–60 (1969)
Hupel, L., Kuncak, V.: Translating Scala programs to Isabelle/HOL. In: Olivetti, N., Tiwari, A. (eds.) IJCAR 2016. LNCS (LNAI), vol. 9706, pp. 568–577. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-40229-1_38
Klein, G., et al.: sel4: formal verification of an OS kernel. In: Matthews, J.N., Anderson, T.E. (eds.) Proceedings of the 22nd ACM Symposium on Operating Systems Principles 2009, SOSP 2009, Big Sky, Montana, USA, 11–14 October 2009, pp. 207–220. ACM (2009). https://doi.org/10.1145/1629575.1629596
Kuncak, V.: Developing verified software using Leon. In: Havelund, K., Holzmann, G., Joshi, R. (eds.) NFM 2015. LNCS, vol. 9058, pp. 12–15. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-17524-9_2
Leroy, X.: Formal certification of a compiler back-end or: programming a compiler with a proof assistant. In: Morrisett, J.G., Jones, S.L.P. (eds.) Proceedings of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2006, Charleston, South Carolina, USA, 11–13 January 2006, pp. 42–54. ACM (2006). https://doi.org/10.1145/1111037.1111042
Letouzey, P.: A new extraction for Coq. In: Geuvers, H., Wiedijk, F. (eds.) TYPES 2002. LNCS, vol. 2646, pp. 200–219. Springer, Heidelberg (2003). https://doi.org/10.1007/3-540-39185-1_12
Letouzey, P.: Programmation fonctionnelle certifiée : L’extraction de programmes dans l’assistant Coq. (Certified functional programming : Program extraction within Coq proof assistant). Ph.D. thesis, University of Paris-Sud, Orsay, France (2004). https://tel.archives-ouvertes.fr/tel-00150912
Letouzey, P.: Extraction in Coq: an overview. In: Beckmann, A., Dimitracopoulos, C., Löwe, B. (eds.) CiE 2008. LNCS, vol. 5028, pp. 359–369. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-69407-6_39
The Coq development team: The Coq proof assistant reference manual. LogiCal Project (2004). http://coq.inria.fr, version 8.0
Milner, R.: A theory of type polymorphism in programming. J. Comput. Syst. Sci. 17(3), 348–375 (1978). https://doi.org/10.1016/0022-0000(78)90014-4
Nipkow, T., Wenzel, M., Paulson, L.C. (eds.): Isabelle/HOL. LNCS, vol. 2283. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-45949-9
Odersky, M.: The scala language specification. Technical report, Programming Methods Laboratory, EPFL, Lausanne, Switzerland, June 2014
Odersky, M., Rompf, T.: Unifying functional and object-oriented programming with Scala. Commun. ACM 57(4), 76–86 (2014). https://doi.org/10.1145/2591013
Odersky, M., Spoon, L., Venners, B.: Programming in Scala: A Comprehensive Step-by-Step Guide, 2nd edn. Artima Incorporation, USA (2011)
Acknowledgement
The authors would like to thank the National Council for Scientific Research in Lebanon (CNRS-L) for their funding, as well as Murex S.A.S for providing financial support.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2018 Springer Nature Switzerland AG
About this paper
Cite this paper
El Bakouny, Y., Mezher, D. (2018). The Scallina Grammar. In: Massoni, T., Mousavi, M. (eds) Formal Methods: Foundations and Applications. SBMF 2018. Lecture Notes in Computer Science(), vol 11254. Springer, Cham. https://doi.org/10.1007/978-3-030-03044-5_7
Download citation
DOI: https://doi.org/10.1007/978-3-030-03044-5_7
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-03043-8
Online ISBN: 978-3-030-03044-5
eBook Packages: Computer ScienceComputer Science (R0)