Abstract
Program logics typically reason about an over-approximation of program behaviour to prove the absence of bugs. Recently, program logics have been proposed that instead prove the presence of bugs by means of under-approximate reasoning, which has the promise of better scalability. In this paper, we present an under-approximate program logic for a nondeterministic graph programming language, and show how it can be used to reason deductively about program incorrectness, whether defined by the presence of forbidden graph structure or by finitely failing executions. We prove this ‘incorrectness logic’ to be sound and complete, and speculate on some possible future applications of it.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Al-Sibahi, A.S., Dimovski, A.S., Wasowski, A.: Symbolic execution of high-level transformations. In: SLE 2016, pp. 207–220. ACM (2016)
Apt, K.R., de Boer, F.S., Olderog, E.: Verification of Sequential and Concurrent Programs. Texts in Computer Science. Springer, London (2009). https://doi.org/10.1007/978-1-84882-745-5
Azizi, B., Zamani, B., Rahimi, S.K.: SEET: symbolic execution of ETL transformations. J. Syst. Softw. 168, 110675 (2020)
Baldan, P., Corradini, A., König, B.: A framework for the verification of infinite-state graph transformation systems. Inf. Comput. 206(7), 869–907 (2008)
Brenas, J.H., Echahed, R., Strecker, M.: Verifying graph transformation systems with description logics. In: Lambers, L., Weber, J. (eds.) ICGT 2018. LNCS, vol. 10887, pp. 155–170. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-92991-0_10
Bruni, R., Giacobazzi, R., Gori, R., Ranzato, F.: A logic for locally complete abstract interpretations. In: LICS 2021. IEEE (2021, to appear)
Cook, S.A.: Soundness and completeness of an axiom system for program verification. SIAM J. Comput. 7(1), 70–90 (1978)
Corrodi, C., Heußner, A., Poskitt, C.M.: A semantics comparison workbench for a concurrent, asynchronous, distributed programming language. Formal Aspects Comput. 30(1), 163–192 (2018)
Ghamarian, A.H., de Mol, M., Rensink, A., Zambon, E., Zimakova, M.: Modelling and analysis using GROOVE. Int. J. Softw. Tools Technol. Transfer 14(1), 15–40 (2012)
Habel, A., Pennemann, K.: Correctness of high-level transformation systems relative to nested conditions. Math. Struct. Comput. Sci. 19(2), 245–296 (2009)
Habel, A., Pennemann, K.-H., Rensink, A.: Weakest preconditions for high-level programs. In: Corradini, A., Ehrig, H., Montanari, U., Ribeiro, L., Rozenberg, G. (eds.) ICGT 2006. LNCS, vol. 4178, pp. 445–460. Springer, Heidelberg (2006). https://doi.org/10.1007/11841883_31
Habel, A., Plump, D.: Relabelling in graph transformation. In: Corradini, A., Ehrig, H., Kreowski, H.-J., Rozenberg, G. (eds.) ICGT 2002. LNCS, vol. 2505, pp. 135–147. Springer, Heidelberg (2002). https://doi.org/10.1007/3-540-45832-8_12
Heckel, R., Taentzer, G.: Graph Transformation for Software Engineers - With Applications to Model-Based Development and Domain-Specific Language Engineering. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-43916-3
Hoare, C.A.R.: An axiomatic basis for computer programming. Commun. ACM (CACM) 12(10), 576–580 (1969)
Isenberg, T., Steenken, D., Wehrheim, H.: Bounded model checking of graph transformation systems via SMT solving. In: Beyer, D., Boreale, M. (eds.) FMOODS/FORTE -2013. LNCS, vol. 7892, pp. 178–192. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-38592-6_13
König, B., Esparza, J.: Verification of graph transformation systems with context-free specifications. In: Ehrig, H., Rensink, A., Rozenberg, G., Schürr, A. (eds.) ICGT 2010. LNCS, vol. 6372, pp. 107–122. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-15928-2_8
Makhlouf, A., Percebois, C., Tran, H.N.: Two-level reasoning about graph transformation programs. In: Guerra, E., Orejas, F. (eds.) ICGT 2019. LNCS, vol. 11629, pp. 111–127. Springer, Cham (2019). https://doi.org/10.1007/978-3-030-23611-3_7
Murray, T.: An under-approximate relational logic: heralding logics of insecurity, incorrect implementation & more. CoRR abs/2003.04791 (2020)
Navarro, M., Orejas, F., Pino, E., Lambers, L.: A navigational logic for reasoning about graph properties. J. Logical Algebraic Methods Program. 118, 100616 (2021)
Oakes, B.J., Troya, J., Lúcio, L., Wimmer, M.: Full contract verification for ATL using symbolic execution. Softw. Syst. Model. 17(3), 815–849 (2018)
O’Hearn, P.W.: Incorrectness logic. Proc. ACM Program. Lang. 4(POPL), 10:1–10:32 (2020)
Orejas, F., Pino, E., Navarro, M., Lambers, L.: Institutions for navigational logics for graphical structures. Theoret. Comput. Sci. 741, 19–24 (2018)
Plump, D.: The design of GP 2. In: WRS 2011. EPTCS, vol. 82, pp. 1–16 (2011)
Poskitt, C.M.: Verification of graph programs. Ph.D. thesis, University of York (2013)
Poskitt, C.M., Plump, D.: Hoare-style verification of graph programs. Fund. Inform. 118(1–2), 135–175 (2012)
Poskitt, C.M., Plump, D.: Verifying total correctness of graph programs. ECEASST, vol. 61 (2013)
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). https://doi.org/10.1007/978-3-319-09108-2_3
Raad, A., Berdine, J., Dang, H.-H., Dreyer, D., O’Hearn, P., Villard, J.: Local reasoning about the presence of bugs: incorrectness separation logic. In: Lahiri, S.K., Wang, C. (eds.) CAV 2020. LNCS, vol. 12225, pp. 225–252. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-53291-8_14
Schneider, S., Dyck, J., Giese, H.: Formal verification of invariants for attributed graph transformation systems based on nested attributed graph conditions. In: Gadducci, F., Kehrer, T. (eds.) ICGT 2020. LNCS, vol. 12150, pp. 257–275. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-51372-6_15
de Vries, E., Koutavas, V.: Reverse Hoare logic. In: Barthe, G., Pardo, A., Schneider, G. (eds.) SEFM 2011. LNCS, vol. 7041, pp. 155–171. Springer, Heidelberg (2011). https://doi.org/10.1007/978-3-642-24690-6_12
Wulandari, G.S., Plump, D.: Verifying graph programs with first-order logic. In: GCM 2020. EPTCS, vol. 330, pp. 181–200 (2020)
Acknowledgements
I am grateful to the ICGT’21 referees for their detailed reviews and suggestions, which have helped to improve the quality of this paper.
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Appendix
Appendix
Proof
(Proposition 1; Lemmata 1–2). By induction over the form of E-conditions, following the proof structure for transformations ‘App’, ‘A’, and ‘L’ for the similar assertion language in [24].    \(\square \)
Proof
(Proposition 2). \(\Longrightarrow \). Assume that \(H\models \mathrm {WPost}(\mathcal {R},c)\). There exists some \(r\in \mathcal {R}\) such that:
There exists an \(h\!: R^I\hookrightarrow G\) such that \(h \models ^I \mathrm {Dang}(r^{-1})\wedge \mathrm {Right}(r, \mathrm {Shift}(r, c) )\). Using Proposition 1, there exists a direct derivation from some graph G to H via \(r = \langle L\Rightarrow R \rangle \), and by Lemma 2, there exists some \(g\!:L^I\hookrightarrow G\) such that \(g \models ^I \mathrm {Shift}(r,c)\). By Lemma 1, \(G\models c\).
\(\Longleftarrow \). Assume that there exists a graph G such that \(G\models c\) and \(G\Rightarrow _\mathcal {R} H\). There exists some \(r = \langle L \Rightarrow R \rangle \in \mathcal {R}\) such that \(G\Rightarrow _r H\). By the definition of \(\models \), Lemma 1, and Lemma 2, there exists some \(h\!:R^I\hookrightarrow G \models ^I \mathrm {Right}(r,\mathrm {Shift}(r,c))\). By the definition of direct derivations and Proposition 1, \(h \models ^I \mathrm {Dang}(r^{-1})\), and thus \(h \models ^I \mathrm {Dang}(r^{-1}) \wedge \mathrm {Right}(r,\mathrm {Shift}(r,c))\). By the definition of \(\models \), \(H \models \exists \mathtt {x}_1,\cdots \mathtt {x}_n.\exists R.\mathrm {Dang}(r^{-1}) \wedge \mathrm {Right}(r,\mathrm {Shift}(r,c))\), that is, \(H \models \mathrm {wpost}(r,c)\). Being a disjunct of \(\mathrm {WPost}(r,c)\), we derive the result \(H \models \mathrm {WPost}(r,c)\).    \(\square \)
Proof
(Theorem 1). Given \(\vdash [c] P [\epsilon : d]\), we need to show that \(\models [c] P [\epsilon : d]\). We consider each axiom and proof rule in turn and proceed by induction on proofs.
RuleSetSucc, RuleSetFail. The validity of these axioms follows immediately from the definitions of \(\llbracket \mathcal {R} \rrbracket ok\), \(\llbracket \mathcal {R} \rrbracket er\), Proposition 1, and Proposition 2.
SeqSucc. Suppose that \(\vdash [c] P;Q [ok: d]\). By induction, we have \(\models [c] P [ok: e]\) and \(\models [e] Q [ok: d]\). By definition of \(\models \), for all \(H. H \models d\), there exists a \(G'.G'\models e\) with \((G',G) \in \llbracket Q \rrbracket ok\), and for all \(G'. G' \models e\), there exists a \(G.G \models c\) with \((G,G') \in \llbracket P \rrbracket ok\). From the definition of \(\models \) and \(\llbracket P;Q \rrbracket ok\), it then follows that \(\models [c] P;Q [ok: d]\). Analogous for case \(\vdash [c] P;Q [er: d]\).
SeqFail. Suppose that \(\vdash [c] P;Q [er: d]\). By induction, we have \(\models [c] P [er: d]\). By definition of \(\models \), for all \(H. H \models d\), there exists a \(G. G \models c\) with \((G,H) \in \llbracket P \rrbracket er\). By the definition of \(\llbracket P;Q \rrbracket er\) and \(\models \), it follows that \(\models [c] P;Q [er: d]\).
IfElse. Suppose that \(\vdash [c] \mathtt {if}\ \mathcal {R}\ \mathtt {then}\ P\ \mathtt {else}\ Q [\epsilon : d]\). By induction, \(\models [c \wedge \mathrm {App}(\mathcal {R})] P [\epsilon : d]\) and \(\models [c \wedge \lnot \mathrm {App}(\mathcal {R})] Q [\epsilon : d]\). From the definition of \(\models \), \(\llbracket \mathtt {if}\ \mathcal {R}\ \mathtt {then}\ P\ \mathtt {else}\ Q \rrbracket \epsilon \), and Proposition 1, we obtain the result that \(\models [c] \mathtt {if}\ \mathcal {R}\ \mathtt {then}\ P\ \mathtt {else}\ Q [\epsilon : d]\).
Cons. Suppose that \(\vdash [c] P [\epsilon : d]\). By induction, we have \(\models [c'] P [\epsilon : d']\), \(\models d \Longrightarrow d'\), and \(\models c' \Longrightarrow c\). It immediately follows that \(\models [c] P [\epsilon : d]\).
IterZero. For every graph \(G. G\models c \wedge \lnot \mathrm {App}(\mathcal {R})\), by Proposition 1, \(G\not \Rightarrow _\mathcal {R}\), \((G,G)\in \llbracket \mathcal {R}\rrbracket er\), and thus \((G,G) \in \llbracket \mathcal {R}! \rrbracket ok\). It immediately follows that \(\models [c \wedge \lnot \mathrm {App}(\mathcal {R})] \mathcal {R}! [ok: c \wedge \lnot \mathrm {App}(\mathcal {R})]\).
Iter. Suppose that \(\vdash [c \wedge \mathrm {App}(\mathcal {R})] \mathcal {R!} [ok: d \wedge \lnot \mathrm {App}(\mathcal {R})]\). By induction, \(\models [c \wedge \mathrm {App}(\mathcal {R})] \mathcal {R;R!} [ok: d \wedge \lnot \mathrm {App}(\mathcal {R})\). By definition of \(\models \), for all \(H. H \models d \wedge \lnot \mathrm {App}(\mathcal {R})\), there exists some \(G. G\models c \wedge \mathrm {App}(\mathcal {R})\) and \((G,H) \in \llbracket \mathcal {R};\mathcal {R}! \rrbracket ok\). By the definition of \(\llbracket \mathcal {R}! \rrbracket ok\) and \(\models \), we obtain \(\models [c \wedge \mathrm {App}(\mathcal {R})] \mathcal {R!} [ok: d \wedge \lnot \mathrm {App}(\mathcal {R})]\).
IterVar. Suppose that \(\vdash [c_0] \mathcal {R}! [ok: c_n]\). By induction, \(\models [c_{i-1}] \mathcal {R} [ok: c_i]\) for every \(0 < i \le n\) and \(\models c_n \Longrightarrow \lnot \mathrm {App}(\mathcal {R})\). By the definition of \(\models \) and \(\llbracket \mathcal {R} \rrbracket ok\), for every \(G_i. G_i \models c_i\), there exists some \(G_{i-1}. G_{i-1} \models c_{i-1}\) and \(G_{i-1} \Rightarrow _\mathcal {R} G_i\). It follow that there is a sequence of derivations \(G_0 \Rightarrow _\mathcal {R} \cdots \Rightarrow _\mathcal {R} G_n\) with \(G_0 \models c_0\) and \(G_n \models c_n\). By \(\models c_n \Longrightarrow \lnot \mathrm {App}(\mathcal {R})\) and Proposition 1, we have \(G_n \not \Rightarrow _\mathcal {R}\), i.e. \((G_n,G_n) \in \llbracket \mathcal {R} \rrbracket er\). Together with the definition of \(\llbracket \mathcal {R}! \rrbracket ok\), it follows that \(\models [c_0] \mathcal {R}! [ok: c_n]\).    \(\square \)
Proof
(Theorem 2). We prove relative completeness extensionally by showing that for every program P, extensional assertion c, and exit condition \(\epsilon \in \{ok, er\}\), \(\vdash [c]P[\epsilon : \mathrm {WPOST}[P,c]]\), where \(\mathrm {WPOST}[P,c]\) is an extensional assertion expressing the weakest postcondition relative to P and c, i.e. if \(\models [c] P [\epsilon : d]\) for any d, then \(d\Longrightarrow \mathrm {WPOST}[P,c]\) is valid. Relative completeness is obtained by applying the rule of consequence to \(\vdash [c]P[\epsilon : \mathrm {WPOST}[P,c]]\).
Rule Application (\(\epsilon = ok\)). Immediate from RuleSetSucc and Cons.
Rule Application (\(\epsilon = er\)). Immediate from RuleSetFail, the definition of \(\llbracket \mathcal {R} \rrbracket er\), and Cons.
Sequential Application (\(\epsilon =ok\)). In this case,
By induction we have \(\vdash [\mathrm {WPOST}[P,c]] Q [ok: \mathrm {WPOST}[Q,\mathrm {WPOST}[P,c]]]\) and \(\vdash [c] P [ok: \mathrm {WPOST}[P,c]]\). By SeqSucc we derive the triple \(\vdash [c] P;Q [ok: \mathrm {WPOST}[Q,\mathrm {WPOST}[P,c]]]\), and by Cons \(\vdash [c] P;Q [ok: \mathrm {WPOST}[P;Q,c]]\).
Sequential Application (\(\epsilon =er\)). If the program P;Â Q fails and the error occurs in Q, then the proof is analogous to the ok case. If the error occurs in P:
By induction we have \(\vdash [c] P [ er: \mathrm {WPOST}[P,c]]\), and by SeqFail derive \(\vdash [c] P;Q [er: \mathrm {WPOST}[P,c]]\). With Cons we get \(\vdash [c] P;Q [er: \mathrm {WPOST}[P;Q,c]]\).
If-then-else. The proof for this case follows a similar structure to sequential composition but treating the two branches separately.
Iteration. Define \(c_i\) as \(\mathrm {WPOST}[\mathcal {R},c_{i-1}]\) for every \(0 < i \le n\). We have:
By induction, \(\vdash [c_{i-1}] \mathcal {R} [ok: \mathrm {WPOST}[\mathcal {R},c_{i-1}]]\) and thus \(\vdash [c_{i-1}] \mathcal {R} [ok: c_i]\). By IterVar and Cons derive the result, \(\vdash [c_0] \mathcal {R!} [ok: \mathrm {WPOST}[\mathcal {R!},c_0]]\). Â Â Â \(\square \)
Rights and permissions
Copyright information
© 2021 Springer Nature Switzerland AG
About this paper
Cite this paper
Poskitt, C.M. (2021). Incorrectness Logic for Graph Programs. In: Gadducci, F., Kehrer, T. (eds) Graph Transformation. ICGT 2021. Lecture Notes in Computer Science(), vol 12741. Springer, Cham. https://doi.org/10.1007/978-3-030-78946-6_5
Download citation
DOI: https://doi.org/10.1007/978-3-030-78946-6_5
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-78945-9
Online ISBN: 978-3-030-78946-6
eBook Packages: Computer ScienceComputer Science (R0)