Open this publication in new window or tab >>
2023 (English) In: Software Engineering and Formal Methods, SEFM 2023 / [ed] Ferreira, C; Willemse, TAC, Springer, 2023, Vol. 14323, p. 126-144Conference paper, Published paper (Refereed)
Abstract [en] Contracts capture assumptions (preconditions) and guarantees (postconditions) of functions in a software program, and are an important paradigm for documenting program code, for program understanding, and to enable modular program verification. In this paper, we focus on contracts for stateful software modules, for instance modules implementing data-structures like queues. Such modules offer different kinds of functions to their environment: observers, which are pure functions used to query the state of the module; and mutators, which can change the module state. We present a novel technique to synthesize contracts for the mutators of a module, in which pre- and postconditions are expressed as Boolean combinations of the observers. Our method builds on existing algorithms for active learning of register automata to model the possible behaviours of the stateful module. We then present techniques for synthesizing contracts from a learned register automaton. The entire method is fully black-box and automated. Based on our proposed approach, we develop a tool called CoGent that generates a set of contracts for a mutator from a given register automaton of a module. Finally, we evaluate our tool using the APIs for various data structures.
Place, publisher, year, edition, pages
Springer, 2023
Series
Lecture Notes in Computer Science, ISSN 0302-9743, E-ISSN 1611-3349 ; 14323
National Category
Computer Sciences Computer Systems
Identifiers urn:nbn:se:uu:diva-539620 (URN) 10.1007/978-3-031-47115-5_8 (DOI) 001293530200008 () 9783031471148 (ISBN)9783031471155 (ISBN)
Conference 21st International Workshop on Software Engineering and Formal Methods (SEFM), November 06-10, 2023, Eindhoven, Netherlands
Funder Swedish Foundation for Strategic ResearchSwedish Research CouncilKnut and Alice Wallenberg Foundation
2024-10-022024-10-022024-10-02 Bibliographically approved