1 Introduction
Reachability Logic (RL) [19] has been introduced as a languageparametric program logic: a formalism for specifying the functional correctness of programs, which may belong to any programming language whose operational semantics is also specified in RL. The functional correctness of a program is stated as the validity of a set of RL formulas (specifying the program’s expected properties) with respect to another set of RL formulas (specifying the operational semantics of the language containing the program).
Such statements are proved by means of a proof system, which has adequate metaproperties with respect to validity: soundness (i.e., only valid RL formulas can be proved) and relative completeness (all valid RL formulas can, in principle, be proved, modulo the existence of “oracles” for auxiliary tasks). The proof of metaproperties for the RL proof system is highly nontrivial, but it only needs to be done once.
Program logics already have a halfcentury history between them, from the first occurrence of Hoare logic [6] to contemporary separation logics [12]. However, all those logics depend on a language’s syntax and therefore have to be defined over and over again, for each new language (or even, for each new language version). In particular, the metaproperties of the corresponding proof systems should be reproved over and over again, a tedious task that is often postponed to an indeterminate future.
Despite being languageparametric, Reachability Logic does not come in only one version. Several versions of the logic have been proposed over the years [14, 20, 19]. The formalism has been generalised from programming languages to more abstract models: rewriting logic [9, 18] and transition systems [15], which can be used for specifying designs, and verifying them before they are implemented in program code. This does not replace code verification, just as code verification does not replace the testing of the final running software; but it enables the early catching of errors and the early discovery of key functionalcorrectness properties, all of which are known to have practical, costeffective benefits.
Contributions.
We further study RL on transition systems (TS). We propose three proof systems for RL, and formalise them in the Coq [2] and Isabelle/HOL [11] proof assistants. One may naturally ask: why having several proof systems and proof assistants  why not one of each? The answer is manyfold:

the proof systems we propose have some common features: the soundness and completenes metaproperties, and the coinductiveness nature inherited from RL. However, they do differ in others aspects: (i) the “amount” of induction they contain; (ii) their degree of compositionality (i.e., their ability to prove local formulas on “components” of a TS, and then to use those formulas as lemmas in proofs of global formulas on the TS); and (iii) the difficulty level of their soundness proofs.

we show that the more induction a proof system uses, and the closest its coinduction style to our problem domain of proving reachabilitylogic formulas, the more compositional the proof system is, but the more difficult its soundness proof. There is a winner: the most compositional proof system of the three, but we found that the other ones exhibit interesting, worthpresenting features as well.

Coq and Isabelle/HOL have different styles of coinduction: KnasterTarski style vs. CurryHoward style. Experiencing this firsthand with the nontrivial examples constituted by proof systems suggested a spinoff project, which amounts to porting some of the features of one proof assistant into the other one. For the moment, porting KnasterTarski features into the CurryHoward coinduction of Coq produced promising results, with possible practical impact for a broader class of Coq users.
Related Work.
Regarding RL, most papers in the abovegiven list of references mention its coinductive nature, but do not actually use it. Several Coq mechanisations of soundness proofs for RL proof systems are presented, but Coq’s coinduction is absent from them. In [4, 8] coinduction is used for formalising RL and for proving RL properties for programs and for termrewriting systems, but their approach is not mechanised in a proof assistant. More closely related work to ours is reported in [10]; they attack, however, the problem exactly in the opposite way: they develop a general theory of coinduction in Coq and use it to verify programs directly based on the semantics of programming languages, i.e., without using a proof system. They do show that a proof system for RL is an instance of their approach for theoretical reasons, in order to give a formal meaning to the completeness of their approach.
Regarding coinduction in Isabelle/HOL, which is based on the KnasterTarski fixpoint theorems, we used only a small portion of what is available: coinductive predicates, primitive coinductive datatypes and primitive corecursive functions. More advanced developments are reported in [3]. Regarding coinduction in Coq, it is based on the CurryHoward isomorphism that views proofs as programs, hence, coinductive proofs are wellformed corecursive programs [5]. An approach that bridges the gap between this and the KnasterTarski style of coinduction is [7]. A presentation of our own results on porting KnasterTarski style coinduction to Coq and a detailed comparison with the above is left for future work.
Regarding coinduction in formal methods, we note that it is mostly used for proving bisimulations. The book [17] serves as introduction to both these notions and explores the relationships between them.
Regarding compositional verification, most existing techniques decompose proofs among parallel composition operators. Various compositional methods for various parallel composition operators (relyguarantee for variablebased composition, assumptioncommitment for synchronisationbased composition, …) are presented in the book [13]. We employ compositionality in a different sense  structural, for transition systems, and logical, for formulas. We note, however, that many of the techniques presented in [13] have a coinductive nature, which could perhaps be exploited in future versions of RL proof systems.
Organisation.
The next section recaps preliminary notions: KnasterTarski style induction and coinduction, transition systems, and RL on transition systems. A first compositionality result, of RLvalidity with respect to certain subtransition systems, is given. The three following sections present our three proof systems in increasing order of complexity. Soundness and completeness results are given and a notion of compositionality with respect to formulas, in two versions: asymmetrical and symmetrical, is introduced and combined with the compositionality regarding subtransition systems. The three proof systems are shown to have increasingly demanding compositionality features. We then briefly discuss the mechanisations of the proof systems in the Coq and Isabelle/HOL proof assistants before we present future work and conclude. The Coq and Isabelle/HOL formalisations, as well as a full paper containing proofs of all the results, are available at http://project.inria.fr/from2019.
2 Preliminaries
2.1 Induction and Coinduction
Consider a complete lattice and a monotone function . According to the KnasterTarski fixpoint theorem, has a least fixpoint (respectively, greatest fixpoint ), which is the least (respectively, greatest) element of such that (resp. ). From this one deduces Tarski’s induction and coinduction principles: implies and implies .
Those principles can be used to define inductive and coinductive datatypes and recursive and corecursive functions. For example, the type of natural numbers is defined as the least fixpoint of the function . The greatest fixpoint of is the type of natural numbers with infinity.
As another example, let be a transition system where is the set of states and is the transition relation. A state is final, and we write , if there exists no such that . A path is a nonempty, possibly infinite sequence of states. More formally, the set of paths is the greatest fixpoint , where , with being simultaneously defined as and for all and . One can then corecursively define the length of a path as a value in the natural numbers with infinity: and .
Hereafter, whenever necessary, we emphasise the fact that certain notions are relative to a transition system by postfixing them with . We omit this subscript when it can be inferred from the context.
A complete lattice associated to a transition system , is the set of state predicates defined as the set of functions from to the set of Booleans . Its operations are defined by , , , , . We also extend the transition relation of into a symbolic transition function , defined by .
It is sometimes convenient to use a stronger variant of Tarski’s coinduction principle: iff . Regarding induction, it is sometimes convenient to use continuous functions, i.e., functions such that , and use Kleene’s fixpoint theorem: exists and is equal to .
2.2 Reachability Formulas
We adapt Reachability Logic to transition systems. Assume a transition system . Syntactically, a reachability formula (or, simply, a formula) over is a pair with . We let and . We denote by the set of all reachability formulas over the transition system .
Example 1
Figure 1 depicts an extended finitestate machine having three naturalnumber variables: ,, and , and three control nodes: , , and . Arrows connect the nodes and are possibly decorated with a Boolean guard and a set of parallel assignments of the variables. The variable is never assigned, thus, it stays constant. The purpose of the machine is to compute in the sum of the first natural numbers.
The machine is a finite representation of an infinitestate transition system whose stateset is the Cartesian product and whose transition relation is . A formula expressing the transition systems’s functional correctness is .
In order to define the semantics of reachability formulas we first introduce the following relation.
Definition 1
is the largest set of pairs such that: (i) for some , and ; or (ii) , for some , , and ; or (iii) for some , , and .
We write for . Tarski’s principle induces the following coinduction principle for :
Lemma 1
For , if for all , it holds that either , or or , then .
Definition 2 (Validity)
A formula is valid over , denoted by , whenever for all such that holds, it also holds that .
Example 2
The formula is valid over the transition system denoted by the statemachine depicted in Figure 1. Intuitively, this means that all finite paths “starting” in the control node “eventually reach” with holding. The “eventually reach” expression justifies the notation borrowed from Linear Temporal Logic (LTL). Indeed, reachability formulas are essentially LTL formulas for a certain version of LTL interpreted over finite paths.
We close the section with a simple notion of component of a transition system, and show that, if a formula is valid on a component, then it is valid on the whole transition system.
Definition 3 (Component)
A transition system is a component of if

and ;

for all , implies ;

for all , , implies .
We write when is a component of .
That is, is a full subtransition system of , and one may only “exit” from via its final states. We often interchangeably use sets of states and their characteristic predicates, like we did for above.
Theorem 1 (Compositionality of w.r.t transition systems)
and imply .
Example 3
In Figure 1, the selfloop on the control node denotes a transition system that is a component of the transition system denoted by the whole state machine. Let . One can show that , thus, is also valid over .
One could, in principle, prove the validity of reachability formulas directly from the semantical definitions. However, this has several disadvantages: lack of a methodology  each formula is proved in its own adhoc way, and lack of a notion of completeness  is there a uniform way for proving every valid formula? These issues are addressed by the proof systems presented by increasing order of complexity in the next sections.
3 A OneRule Proof System
[Stp] 
Our first proof system is depicted as the onerule inference system in Figure 2. It is parameterised by a transition system , and everything therein depends on it; we omit subscripts for simplicity. Intuitively, an application of the [Stp] rule can be seen as a symbolic execution step, taking a formula and “moving” “one step closer” to  specifically, taking an overapproximation of the “difference” between and (encoded in the sidecondition ) that contains no final states () and performing a symbolic execution step from (encoded in the symbolic transition function). The rule is applicable infinitely many times, hence the symbol next to it. Note that there are no hypotheses in the proof system: those would be reachability formulas in the lefthand side of the symbol, not allowed here.
For a more formal definition, consider the function defined by
is monotone, and, by KnasterTarski’s theorem, has a greatest fixpoint . We now define by . Tarski’s coinduction principle then induces the following coinduction principle for :
Lemma 2
For all set of hypotheses and , if for all , there is such that , and , then .
Soundness.
Soundness means that only valid formulas are proved:
Theorem 2 (Soundness of )
implies .
The proof uses the coinduction principle of the relation (Lemma 1), which occurs in the definition of validity, instantiated with the relation defined by . As a general observation, all proofs by coinduction use a specific coinduction principle instantiated with a specific predicate/relation. The instantiation step is where the user’s creativity is most involved.
Completeness.
Completeness is the reciprocal to soundness: any valid formula is provable. It is based on the following lemma, which essentially reduces reachability to a form of inductive invariance.
Lemma 3
If , , and then .
The proof of this lemma uses Lemma 2 with an appropriate instantion of the set therein.
Theorem 3 (Completeness of )
implies .
The proof of completeness is constructive: it uses the predicate that, for valid formulas , is shown to satisfy the three inclusions of Lemma 3. One may wonder: even when one does not know whether a formula is valid, can one still use the abovedefined and Lemma 3 in order to prove it? The answer is negative: proving the first implication with the abovedefined amounts to proving validity directly from the semantics of formulas, thus losing any benefit of having a proof system. Hence, completeness is a theoretical property; the practically useful property is Lemma 3, which users have to provide with a suitable that satisfy the three inclusions therein. In [16] we use this lemmma for verifying an infinitestate transitionsystem specification of a hypervisor.
Looking back at the proof system , we note that it is purely coinductive  no induction is present at all. This is unlike the proof systems in forthcoming sections. Regarding compositionality (with respect to transition systems) our proof system has it, since, by soundness and completeness and Theorem 1, one has that and implies . However, we show below that does not have another, equally desirable compositionality feature: asymmetrical compositionality with respect to formulas.
Asymmetrical compositionality with respect to formulas.
A proof system with this feature decomposes a proof of a formula into a proof of a formula and one of assuming . The asymmetry between the formulas involed suggested the property’s name. In Definition 4 below, is a binary relation  a subset of (equivalently, a predicate of type ), parameterised by a transition system . For hypotheses and , we write for and for .
Definition 4 (Asymmetrical compositionality with respect to formulas)
A proof system is asymmetrically compositional with respect to formulas if and imply .
The proof system is not asymmetrically compositional w.r.t. formulas, because that requires hypotheses, which does not have. One could add hypotheses to it, and a new rule to prove a formula if it is found among the hypotheses. However, note that, unlike the [Stp] rule, the new rule has an inductive nature: it can only occur a finite number of times in a proof (specifically, at most once, at the end of a finite proof).
4 An AsymmetricallyCompositional Proof System
In this section we propose another proof system and show that it is compositional with respect to transition systems and asymmetrically compositional with respect to formulas. These gains are achieved thanks to a the introduction of inductive rules in the proof system, enabling a better distribution of roles between these rules and the remaining coinductive rule; all at the cost of a more involved soundness proof.
[Hyp]  
[Trv]  
[Str]  
[Spl]  
[Tra]  
[Stp] 
Our second proof system is depicted in Figure 3. It is a binary relation  a subset of (or equivalently, a binary predicate of type ), parameterised by a transition system . Intuitively, the rule [Stp], labelled with , is coinductive, i.e., it can be applied infinitely many times, and the rules [Hyp], [Trv], [Str], [Spl], and [Tra], labelled by are inductive, i.e., they can only be applied finitely many times between two consecutive applications of [Stp]. Stated differently, a proof in is a possibly infinite series of phases, and in each phase there are finitely many applications of [Hyp], [Trv], [Str], [Spl], and [Tra] and, except in the last phase (if such a last phase exists), one application of [Stp].
Note that making the inductive rules coinductive would compromise soundness, because, e.g., the [Str] rule could forever reduce a proof of any formula to itself, thus proving any formula, valid or not.
The roles of the rules are the following ones. [Hyp] allows one to prove a formula if it is among the hypotheses. [Trv] is in charge of proving trivially valid formulas. [Str] is a general principle that amounts to strengthening a formula before proving it. [Spl] is used for getting rid of disjunctions in lefthand sides of formulas, which occur when several, alternative symbolic behaviours are explored in a proof search. [Tra] is a transitivity rule, used for proving facts about sequential symbolic behaviour. Note also the asymmetry in hypotheses of the rule [Tra]: for one formula validity is required, while for the other one, it is provability. This asymmetry is used to avoid technical difficulties that arise when proving the soundness of , but, as we shall see, it generates difficulties of its own. Finally, [Stp] makes the connection between the concrete paths and the symbolic ones, which the proof system explores during proof search.
For a formal definition: consider the following functions from to defined by
Let . It is not hard to show that is continuous, thus, by the Knaster Tarski and Kleene fixpoint theorems it has a smallest fixpoint . Now, we define the function by . is monotone, thus, it has a greatest fixpoint .
We define the proof system as follows : for all and , iff . The inductivecoiductive nature of is visible from its definition. It admits the following coinduction principle:
Lemma 4
If then for all it holds that .
Using the coinduction principle.
For proving statements of the form , one can:

find a sequence of sets such that , for , and ;

since , we obtain by induction on that for and in particular . By Lemma 4, .
We illustrate the above approach by proving a key lemma for the completeness of .
Lemma 5
If , , and then .
Proof We apply the above approach. Note that . We choose .

Let ; using the hypothesis , ;

Let ; we obtain ;

Let ; we obtain ;

Let ; using the second hypothesis and the fact that we obtain ;

Let ; using the hypothesis , we obtain ;

Let ; we obtain ;

Let ; we obtain ;

Let ; using the second hypothesis and the fact that , we obtain .
Hence, by basic properties of inclusion, , and from and Lemma 4 we obtain .
Soundness.
We define the recursive function by and . Intuitively, is the sequence obtained by removing elements from the “beginning” of . This is required in the definition of the following relation and is used hereafter.
Definition 5
is the largest set of pairs such that: (i) for some such that ; or (ii) , for some , such that ; or (iii) for some , and such that .
We write instead of . By analogy with Lemma 1 (coinduction principle for the relation), but using Tarski’s strong induction principle, we obtain:
Lemma 6
Let be s.t. . Then .
The following lemma is easily proved, by instantiating the parameter relation , which occurs in both the coinduction principles of the relations , with the other relation:
Lemma 7 ( equals )
For all and , if and only if .
Using the coinduction principle for and the above equality, as well as the induction principle for the functional we obtain, in a rather involved proof mixing induction and coinduction:
Theorem 4 (Soundness of )
If for all , , then implies .
Example 5
We sketch a proof of the fact that the transition system denoted by the state machine in Figure 1 meets its functional correcteness property: (i) . We first show (ii) , which can be done using in sequence the rules [Stp], [Str], and [Trv] of the proof system together with its soundness. Using (ii) and the [Tra] rule, (i) reduces to proving (iii) . Next, in Examples 3 and 4 we established^{1}^{1}1Example 4 used the proof system and its Lemma 3, but and its corresponding Lemma 5 can be used just as well. , hence, using this and the [Tra] rule, (iii) reduces to proving . This is performed by applying in sequence the rules [Stp], [Str], and [Trv], which concludes the proof.
Completeness.
Theorem 5 (Completeness of )
implies .
Compositionality.
Remembering Definition 4 of asymmetrical compositionality w.r.t formulas:
Theorem 6
is asymetrically compositional with respect to formulas.
Proof We have to show that if (i) and (ii) then . Now, (i) and (ii) and the soundness of imply and then , and then the conclusion holds by the completeness of .
Note that the statement (i) can be replaced by a weaker for components , thanks to the soundness and completenesss of and of Theorem 1. This allows us to mix the compositionality of with respect to transition systems and the asymetrical one with respect to formulas.
The proof system is thus better at compositionality than , thanks to the inclusion of inductive rules, in particular, of the rule [Hyp], but at the cost of a more involved soundness proof. It still has a problem: the asymmetry of the [Tra] rule, required by the soundness proof, is not elegant since the rule mixes semantics and syntax . This is not only an issue of elegance, but a practical issue as well.
Example 6
We attempt to prove the property (i) from Example 5 using the asymmetrical compositionality of w.r.t formulas. The first step, similar to that of Example 5, is proving (ii’) by using in sequence the rules [Stp], [Str], and [Trv] of . Then, Theorem 6 reduces (i) to (iii’) . The natural next step would be to use the [Tra] rule of , splitting (iii’) in two parts: , discharged by [Hyp], and then . But the [Tra] rule of , as it is, does not allow this. Hence, when one uses compositionality, one may get stuck in proofs because of technical issues with [Tra].
These issues are solved in the third proof system, which incorporates even more induction that the second one, and specialises its coinduction even closer to our problem domain. The third proof system also has better compositionality features. These gains come at the cost of an even more involved soundness proof.
5 A SymmetricallyCompositional Proof System
[Hyp]  
[Trv]  
[Str]  
[Spl]  
[Tra]  
[Stp]  
[Cut]  
[Cof]  
[Clr] 
Our third proof system is depicted in Figure 4. A first difference with the previous one is that hypotheses and conclusions are pairs of a Boolean tag and a formula. We call them tagged formulas, or simply formulas when there is no risk of confusion. The role of the tags is to avoid unsoundness.
The second difference is that the proof system is essentially inductive, i.e., there are no more infinite proofs, and no coinduction principle any more; whatever coinduction remains is tailored to our problem and emulated by the proof system, as can be seen seen below in the description of the proof system’s rules.
Another difference, especially with the second proof system , is that the hypotheses set is not constant. The following rules change the hypotheses set. First, the [Cut] rule, which says that in order to prove under hypotheses , it is enough to prove  for some formula  under hypotheses , and to prove under . This resembles a standard cut rule, but it is taylored to our specific setting. Second, the [Cof] rule adds a “copy” of the conclusion in the hypotheses, but tagged with f  and the new conclusion is also tagged with f. It is called this way in reference to the Coq cofix tactic that builds coinductive proofs in Coq also by copying a conclusion in the hypotheses; hence, we emulate in our proof system’s hypotheses a certain existing coinduction mechanism, and taylor it to proving reachability formulas. Note that, without the tags, one could simply assume any formula by [Cof] and prove it by [Hyp], which would be unsound since it would prove any formula, valid or not. Third, the [Clr] rule removes a formula from the hypotheses. Note that the [Stp] rule, when applied bottom to top, switches the Boolean from whatever value it has to t. Hence, it is [Stp] that makes “progress” in our setting, enabling the use of [Hyp] in a sound way. The other rules have the same respective roles as their homonyms in .
Soundness.
We present the soundness proof of at a higher level of abstraction than for the other proof systems. For example, we define proofs as finite trees, and assume that finite trees are known to the readers. For the other proof systems we adopted a more formal approach because the proofs in those systems were certain kinds of possibly infinite trees, whose a priori knowledge cannot be assumed.
Definition 6 (Proof)
A proof of a tagged formula for a transition system and under hypotheses  for short, a proof of  is a finite tree, whose root is labelled by the sequent , whose nodes are also labelled by sequents, obtained by applying bottomup the rules depicted in Figure 4.
We sometimes just write for “there is a proof of ” as defined above. The following definition introduces the sets of all hypotheses and of all conclusions occuring in a proof.
Definition 7 (All hypotheses and conclusions occuring in proof)
Assume a proof of . The set is the union of all sets of formulas, for all the nodelabels in the tree . The set is the set of all formulas , for all the nodelabels occuring in .
Hereafter in the currenct subsection about soundness we assume a proof (tree) of with corresponding sets and . The following technical lemma is proved by structural induction on such trees. It says that tagged fomulas in are among the hypotheses present at the root of , plus the conclusions , and, except perhaps for those in , the formulas in are tagged with f.
Lemma 8
, and, if , then .
Some more notions need to be defined. First, a pad
in a tree is a sequence of consecutive edges, and the length of a pad is the number of nodes on the pad. Hence, the length of a pad is strictly positive.
Definition 8
The last occurence of a tagged formula in is the maximal length of a pad from the root of to some node labelled by . For formulas we define by convention their last occurence in to be . This defines a total function .
Let also denote the set of finite paths of the transition system under consideration. We now define the set on which we shall reason by wellfounded induction. We equip with a wellfounded order, namely, with the restriction to of the lexicographicproduct order on defined by iff

, or

and , with on Booleans is defined by , or

and , and