Hostname: page-component-89b8bd64d-72crv Total loading time: 0 Render date: 2026-05-06T20:08:19.680Z Has data issue: false hasContentIssue false

Trace contracts

Published online by Cambridge University Press:  13 December 2023

CAMERON MOY
Affiliation:
Northeastern University, Boston, MA, USA (e-mail: camoy@ccs.neu.edu)
MATTHIAS FELLEISEN
Affiliation:
Northeastern University, Boston, MA, USA (e-mail: matthias@ccs.neu.edu)
Rights & Permissions [Opens in a new window]

Abstract

Behavioral software contracts allow programmers to strengthen the obligations and promises that they express with conventional types. They lack expressive power, though, when it comes to invariants that hold across several function calls. Trace contracts narrow this expressiveness gap. A trace contract is a predicate over the sequence of values that flow through function calls and returns. This paper presents a principled design, an implementation, and an evaluation of trace contracts.

Information

Type
Research Article
Creative Commons
Creative Common License - CCCreative Common License - BY
This is an Open Access article, distributed under the terms of the Creative Commons Attribution licence (https://creativecommons.org/licenses/by/4.0/), which permits unrestricted re-use, distribution and reproduction, provided the original article is properly cited.
Copyright
© The Author(s), 2023. Published by Cambridge University Press
Figure 0

Fig. 1. The extended racket grammar for trace contracts.

Figure 1

Fig. 2. The state-machine contract for AI players, with a transition diagram.

Figure 2

Fig. 3. Surface and evaluation syntax of ${{\Lambda}}.$

Figure 3

Fig. 4. Reduction relation of ${{\Lambda}}.$

Figure 4

Fig. 5. Metafunctions of ${{\Lambda}}$

Figure 5

Fig. 6. Surface and evaluation syntax of ${{\Lambda_B}}$.

Figure 6

Fig. 7. Reduction relation of ${{\Lambda_B}}.$

Figure 7

Fig. 8. Surface and evaluation syntax of ${{\Lambda_C}}.$

Figure 8

Fig. 9. Reduction relation of ${{\Lambda_C}}.$

Figure 9

Fig. 10. Surface and evaluation syntax of ${{\Lambda_T}}.$

Figure 10

Fig. 11. Reduction relation of ${{\Lambda_T}}.$

Figure 11

Fig. 12. Surface and evaluation syntax of ${{\Lambda_U}}.$

Figure 12

Fig. 13. Reduction relation of ${{\Lambda_U}}.$

Figure 13

Table 1. Basic metrics and performance measurements.

Figure 14

Fig. 14. Proof Syntax of ${{\Lambda}}$, ${{\Lambda_B}}$, and ${{\Lambda_C}}$

Figure 15

Fig. 15. Valid expression judgment.

Figure 16

Fig. 16. Expression and evaluation context simulation relation.

Figure 17

Fig. 17. Expression and evaluation context compiler.

Submit a response

Discussions

No Discussions have been published for this article.