Verifying a Copying Garbage Collector in GP 2

  • Gia S. Wulandari
  • Detlef Plump
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 11176)


Cheney’s copying garbage collector is regarded as a challenging test case for formal approaches to the verification of imperative programs with pointers. The algorithm works for possibly cyclic data structures with unrestricted sharing which cannot be handled by standard separation logics. In addition, the algorithm relocates data and requires establishing an isomorphism between the initial and the final data structure of a program run.

We present an implementation of Cheney’s garbage collector in the graph programming language GP 2 and a proof that it is totally correct. Our proof is shorter and less complicated than comparable proofs in the literature. This is partly due to the fact that the GP 2 program abstracts from details of memory management such as address arithmetic. We use sound proof rules previously employed in the verification of GP 2 programs but treat assertions semantically because current assertion languages for graph transformation cannot express the existence of an isomorphism between initial and final graphs.


  1. 1.
    Bak, C., Plump, D.: Compiling graph programs to C. In: Echahed, R., Minas, M. (eds.) ICGT 2016. LNCS, vol. 9761, pp. 102–117. Springer, Cham (2016). Scholar
  2. 2.
    Birkedal, L., Torp-Smith, N., Reynolds, J.C.: Local reasoning about a copying garbage collector. In Proceedings Symposium on Principles of Programming Languages (POPL 2004), pp. 220–231. ACM (2004).
  3. 3.
    Cheney, C.J.: A nonrecursive list compacting algorithm. Commun. ACM 13(11), 677–678 (1970). Scholar
  4. 4.
    Courcelle, B., Engelfriet, J.: Graph Structure and Monadic Second-Order Logic: A Language-Theoretic Approach. Cambridge University Press, Cambridge (2012). Scholar
  5. 5.
    Hobor, A., Villard, J.: The ramifications of sharing in data structures. In Proceedings Symposium on Principles of Programming Languages (POPL 2013), pp. 523–536. ACM (2013). Scholar
  6. 6.
    Klarlund, N., Schwartzbach, M.: Verification of pointers. DAIMI Report Series 23(470). Aarhus University (1994).
  7. 7.
    Mccreight, A.E.: The Mechanized Verification of Garbage Collector Implementations. Ph.D thesis, Yale University (2008)Google Scholar
  8. 8.
    Myreen, M.O.: Reusable verification of a copying collector. In: Leavens, G.T., O’Hearn, P., Rajamani, S.K. (eds.) VSTTE 2010. LNCS, vol. 6217, pp. 142–156. Springer, Heidelberg (2010). Scholar
  9. 9.
    Plotkin, G.D.: A structural approach to operational semantics. J. Log. Algebraic Program. 60–61, 17–139 (2004). Scholar
  10. 10.
    Plump, D.: Reasoning about graph programs. In: Proceedings Computing with Terms and Graphs (TERMGRAPH 2016), Electronic Proceedings in Theoretical Computer Science, vol. 225, pp. 35–44 (2016). Scholar
  11. 11.
    Plump, D.: From imperative to rule-based graph programs. J. Log. Algebraic Methods Program. 88, 154–173 (2017). Scholar
  12. 12.
    Poskitt, C.M.: Verification of Graph Programs. Ph.D thesis, University of York (2013)Google Scholar
  13. 13.
    Poskitt, C.M., Plump, D.: Hoare-style verification of graph programs. Fundamenta Informaticae 118(1), 135–175 (2012). Scholar
  14. 14.
    Poskitt, C.M., Plump, D.: Verifying total correctness of graph programs. In: Proceedings International Workshop on Graph Computation Models (GCM 2012) 2012. Revised version, Electronic Communications of the EASST, vol. 61 (2013).
  15. 15.
    Poskitt, C.M., Plump, D.: Verifying monadic second-order properties of graph programs. In: Giese, H., König, B. (eds.) ICGT 2014. LNCS, vol. 8571, pp. 33–48. Springer, Cham (2014). Scholar
  16. 16.
    Torp-Smith, N., Birkedal, L., Reynolds, J.C.: Local reasoning about a copying garbage collector. ACM Trans. Program. Lang. Syst. 30(4), 24:1–24:58 (2008). Scholar

Copyright information

© Springer Nature Switzerland AG 2018

Authors and Affiliations

  1. 1.Department of Computer ScienceUniversity of YorkYorkUK
  2. 2.School of ComputingTelkom UniversityBandungIndonesia

Personalised recommendations