skip to main content
10.1145/2489804.2489807acmotherconferencesArticle/Chapter ViewAbstractPublication PagesisstaConference Proceedingsconference-collections
research-article

Safe corecursion in coFJ

Published: 01 July 2013 Publication History

Abstract

In previous work we have presented coFJ, an extension to Featherweight Java that promotes coinductive programming, a sub-paradigm expressly devised to ease high-level programming and reasoning with cyclic data structures.
The coFJ language supports cyclic objects and regularly corecursive methods, that is, methods whose invocation terminates not only when the corresponding call trace is finite (as happens with ordinary recursion), but also when such a trace is infinite but cyclic, that is, can be specified by a regular term, or, equivalently, by a finite set of recursive syntactic equations.
In coFJ it is not easy to ensure that the invocation of a corecursive method will return a well-defined value, since the recursive equations corresponding to the regular trace of the recursive calls may not admit a (unique) solution; in such cases we say that the value returned by the method call is undetermined.
In this paper we propose two new contributions. First, we design a simpler construct for defining corecursive methods and, correspondingly, provide a more intuitive operational semantics. For this coFJ variant, we are able to define a type system that allows the user to specify that certain corecursive methods cannot return an undetermined value; in this way, it is possible to prevent unsafe use of such a value.
The operational semantics and the type system of coFJ are fully formalized, and the soundness of the type system is proved.

References

[1]
D. Ancona. Coinductive big-step operational semantics for type soundness of Java-like languages. In FTfJP '11, pages 5:1--5:6. ACM, 2011.
[2]
D. Ancona. Soundness of object-oriented languages with coinductive big-step semantics. In ECOOP 2012, pages 459--483, 2012.
[3]
D. Ancona, A. Corradi, G. Lagorio, and F. Damiani. Abstract compilation of object-oriented languages into coinductive CLP(X): can type inference meet verification? In FoVeOOS 2010, Revised Selected Papers, volume 6528 of LNCS, 2011.
[4]
D. Ancona and G. Lagorio. Coinductive type systems for object-oriented languages. In ECOOP 2009, volume 5653 of LNCS, pages 2--26, 2009.
[5]
D. Ancona and G. Lagorio. Idealized coinductive type systems for imperative object-oriented programs. RAIRO - Theoretical Informatics and Applications, 45(1):3--33, 2011.
[6]
D. Ancona and E. Zucca. Corecursive Featherweight Java. In FTfJP '12, 2012.
[7]
D. Ancona and E. Zucca. Translating corecursive Featherweight Java in coinductive logic programming. In Co-LP 2012 - A workshop on Coinductive Logic Programming, 2012.
[8]
Y. Bertot and P. Castéran. Interactive Theorem Proving and Program Development. Coq'Art: The Calculus of Inductive Constructions. Texts in Theoretical Computer Science. Springer Verlag, 2004.
[9]
M. Fähndrich and S. Xia. Establishing object invariants with delayed types. In OOPSLA 2007, pages 337--350. ACM Press, 2007.
[10]
N. Ghani, M. Hamana, T. Uustalu, and V. Vene. Representing cyclic structures as nested datatypes. In TFP, pages 173--188, 2006.
[11]
P. H., J. H., S. L. Peyton Jones, and P. Wadler. A history of haskell: being lazy with class. In History of Programming Languages Conference (HOPL-III), pages 1--55, 2007.
[12]
John Launchbury. A natural semantics for lazy evaluation. In POPL, pages 144--154, 1993.
[13]
R. Min and G. Gupta. Coinductive logic programming and its application to boolean sat. In FLAIRS Conference, 2009.
[14]
Xin Qi and Andrew C. Myers. Masked types for sound object initialization. In Z. Shao and B. C. Pierce, editors, POPL 2009, pages 53--65. ACM Press, 2009.
[15]
N. Saeedloei and G. Gupta. Verifying complex continuous real-time systems with coinductive CLP(R). In LATA 2010, LNCS. Springer, 2010.
[16]
L. Simon. Extending logic programming with coinduction. PhD thesis, University of Texas at Dallas, 2006.
[17]
L. Simon, A. Bansal, A. Mallya, and G. Gupta. Co-logic programming: Extending logic programming with coinduction. In ICALP 2007, pages 472--483, 2007.
[18]
L. Simon, A. Mallya, A. Bansal, and G. Gupta. Coinductive logic programming. In ICLP 2006, pages 330--345, 2006.
[19]
A. J. Summers and P. Müller. Freedom before commitment - a lightweight type system for object initialisation. In OOPSLA 2011. ACM Press, 2011.
[20]
F. A. Turbak and J. B. Wells. Cycle therapy: A prescription for fold and unfold on regular trees. In PPDP, pages 137--149, 2001.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Other conferences
FTfJP '13: Proceedings of the 15th Workshop on Formal Techniques for Java-like Programs
July 2013
52 pages
ISBN:9781450320429
DOI:10.1145/2489804
Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

Sponsors

  • CNRS: Centre National De La Rechercue Scientifique
  • UM2: University Montpellier 2
  • AITO: Association Internationale pour les Technologies Objets

In-Cooperation

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 July 2013

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Java
  2. coinduction
  3. programming paradigms
  4. regular terms

Qualifiers

  • Research-article

Funding Sources

Conference

ECOOP '13
Sponsor:
  • CNRS
  • UM2
  • AITO

Acceptance Rates

FTfJP '13 Paper Acceptance Rate 7 of 14 submissions, 50%;
Overall Acceptance Rate 51 of 75 submissions, 68%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)0
  • Downloads (Last 6 weeks)0
Reflects downloads up to 07 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2023)Classical (co)recursion: MechanicsJournal of Functional Programming10.1017/S095679682200016833Online publication date: 4-Apr-2023
  • (2017)Extending Coinductive Logic Programming with Co-FactsElectronic Proceedings in Theoretical Computer Science10.4204/EPTCS.258.1258(1-18)Online publication date: 13-Sep-2017
  • (2017)Generalizing Inference Systems by CoaxiomsProgramming Languages and Systems10.1007/978-3-662-54434-1_2(29-55)Online publication date: 19-Mar-2017
  • (2016)Towards a model of corecursion with defaultProceedings of the 18th Workshop on Formal Techniques for Java-like Programs10.1145/2955811.2955820(1-6)Online publication date: 17-Jul-2016

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media