Foundations of regular coinduction

Inference systems are a widespread framework used to define possibly recursive predicates by means of inference rules. They allow both inductive and coinductive interpretations that are fairly well-studied. In this paper, we consider a middle way interpretation, called regular, which combines advantages of both approaches: it allows non-well-founded reasoning while being finite. We show that the natural proof-theoretic definition of the regular interpretation, based on regular trees, coincides with a rational fixed point. Then, we provide an equivalent inductive characterization, which leads to an algorithm which looks for a regular derivation of a judgment. Relying on these results, we define proof techniques for regular reasoning: the regular coinduction principle, to prove completeness, and an inductive technique to prove soundness, based on the inductive characterization of the regular interpretation. Finally, we show the regular approach can be smoothly extended to inference systems with corules, a recently introduced, generalised framework, which allows one to refine the coinductive interpretation, proving that also this flexible regular interpretation admits an equivalent inductive characterisation.


Introduction
Non-well-founded structures, such as graphs and streams, are ubiquitous in computer science. Defining and proving properties of this kind of structures in a natural way is a challenging problem. Indeed, standard inductive techniques are not adequate, because they require to reach a base case in finitely many steps, and this is clearly not guaranteed, since non-wellfounded structures are conceptually infinite. The natural way to deal with such structures is by coinduction, the dual of induction, which allows non-well-founded reasoning.
A widespread approach to structure formal reasoning is by inference rules, which define the steps we can do to prove judgements we are interested in. They support both inductive and coinductive reasoning in a pretty natural way: in inductive reasoning we are only allowed to use finite derivations, while in the coinductive one we can prove judgements by arbitrary, finite or infinite, derivations, hence coinductive reasoning can properly handle non-well-founded structures.
Coinductive reasoning is very powerful: it allows to derive judgements which require the proof of infinitely many different judgements. For instance, consider the following inference rule used to prove that a stream contains only positive elements: allPos(s) allPos(x : s) x > 0 To prove that the stream of all odd natural numbers contains only positive elements, we can use the following infinite derivation: . . . which is valid in coinductive reasoning and contains infinitely many different judgements. However, there are cases where, even though we need an infinite derivation, this derivation requires only the proof of finitely many different judgements. This is often the case when dealing with cyclic structures, such as graphs or cyclic streams, since they are non-wellfounded, but finitely representable. For instance, if we want to prove that the stream of all 1's contains only positive elements, we can use the following derivation: . . . Borrowing the terminology from trees [Cou83], we call a derivation requiring the proof of finitely many different judgments regular (a.k.a. rational 1 ), and we call regular coinduction (or regular reasoning) the approach that allows only regular derivations.
Whereas inductive and coinductive reasoning have well-known semantic foundations and proof principles, to our knowledge regular reasoning by means of inference rules has never been explored at the same extent. The aim of this paper is to fill this gap, by providing solid foundations also to the regular approach. Indeed, we believe that the regular approach provides a very interesting middle way between induction and coinduction.
Indeed, inductive reasoning is restricted to finite derivations, but, in return, we implicitly get an (abstract) algorithm, which looks for a derivation of a judgement. Such an algorithm is sound and complete with respect to derivable judgements. That is, it may not terminate for judgements that do not have a finite derivation, but it is guaranteed to successfully terminate, finding a finite derivation, for all and only derivable judgments. Instead, coinductive reasoning allows also infinite derivations, but there is no hope, in general, to find an algorithm which succesfully terminates for derivable judgments, because, as we have seen, a derivation may require infinitely many different judgements to be proved 2 .
Regular reasoning combines advantages of the two approaches: on one hand, it is not restricted to finite derivations, going beyond limits of induction, but, on the other hand, it still has, like induction, a finite nature, hence it is possible to design an algorithm which finds a derivation for all and only derivable judgments, as we will show in the following.
In detail, the contribution of this paper is the following. • An equivalent model-theoretic characterization of judgements derivable by a regular proof tree, showing it is an instance of the rational fixed point [AMV06]. This is important since it provides a purely semantic view of regular coinduction. Moreover, from this we get a proof principle, the regular coinduction principle, which can be used to prove completeness of a set of inference rules against a set of valid judgements, that is, that all valid judgement are derivable by a regular proof tree. • An equivalent inductive characterization of judgements derivable by a regular proof tree. Essentially, following the structure of the operational model of coinductive logic programming [SMBG06,AD15], but in the more abstract setting of rule-based definitions, we enrich judgements by a finite set of circular hypotheses, used to keep track of already encountered judgements so that, when the same judgement is found again, it can be used as an axiom. This nicely formalizes, by an abstract construction in the general setting of rule-based definitions and a correcteness proof given once and for all, techniques used in different specific cases for dealing with cyclic structures inductively, by detecting cycles to ensure termination. Furthermore, this provides us with a sound and complete algorithm to find a regular derivation for a judgment, if any. Finally, relying on the inductive characterization, we define a proof technique to show soundness of a set of inference rules against a set of valid judgements, that is, that all derivable judgements are valid. Moreover, we show that all these results can be smoothly extended to a recently introduced generalisation of coinductive reasoning, namely flexible coinduction [Dag17,ADZ17b,Dag19]. Beside standard rules, this generalised framework allows also corules, which are special rules used to validate infinite derivations. As a result, using corules, we are able to filter out some undesired infinite derivations, having a much finer control on the set of derivable judgements. Flexible coinduction smoothly extends standard coinduction, subsuming it, that is, standard coinduction can be recovered by a specific choice of corules. We will show this is the case also in the regular case, that is, flexible regular coinduction subsumes standard regular coinduction.
The rest of the paper is organized as follows. In Sect. 2 we recall basic concepts on inference systems and define the regular interpretation in proof-theoretic terms. In Sect. 3 we define the rational fixed point in a lattice-theoretic setting, and in Sect. 4 we prove that the regular interpretation coincides with a rational fixed point. Sect. 5 provides the equivalent inductive characterization of the regular interpretation and Sect. 6 discusses proof techniques for regular reasoning. In Sect. 7 we extend all the previously presented results to flexible coinduction. Finally, Sect. 8 discusses related work and Sect. 9 concludes the paper, outlining future work.
Notations. Let X be a set, we denote by ℘(X) and ℘ ω (X) its power-set and its finite power-set, respectively. For a function f : X → Y , f ! : ℘(X) → ℘(Y ) and f * : ℘(Y ) → ℘(X) are the direct image and the inverse image along f , respectively, hat is, We also denote by X the set of finite sequences on X, by ε the empty sequence and by αβ the concatenation of sequences α and β.

Inference systems and regular derivations
In this section, we recall basic definitions about inference systems [Acz77, LG09,San11] and their standard semantics, and define their regular interpretation. Let us assume a universe U, which is a set, whose elements j are called judgements. An inference system I is a set of (inference) rules, which are pairs Pr , c , also written Pr c , where Pr ⊆ U is the set of premises, while c ∈ U is the conclusion. A proof tree (a.k.a. derivation) in I is a tree with nodes (labelled) in U and such that, for each node j with set of children Pr , there is a rule Pr , j in I. The inference operator F I : ℘(U) → ℘(U) is defined as follows: there is a rule Pr , j ∈ I, that is, X ⊆ F I (X), and it is an interpretation, if it is both closed and consistent, namely, a fixed point X = F I (X).
There are two main approaches to define interpretations of an inference system: the model-theoretic and the proof-theoretic one. The two standard interpretations, the inductive and the coinductive one, can be equivalently defined in proof-theoretic and in model-theoretic style: • the inductive interpretation µ I is the set of judgements having a well-founded proof tree, and also the least fixed point of F I , and • the coinductive interpretation ν I is the set of judgements having an arbitrary (wellfounded or not) proof tree, and also the greatest fixed point of F I . In the following, we will write I µ j for j ∈ µ I and I ν j for j ∈ ν I .
In this paper, we assume inference systems to be finitary, that is, all rules have a finite set of premises. Under this assumption, well-founded proof trees are always finite and infinite proof trees are always non-well-founded 3 , hence we will use this simpler terminology.
In the coinductive interpretation, since we allow arbitrary proof trees, we can derive judgements requiring infinitely many different judgements to be proved. However, there are cases where we still need infinite derivations, but only of finitely many judgements. This idea of an infinite proof tree containing only finitely many different judgements nicely corresponds to a well-known class of trees: regular trees [Cou83]. We say that a tree is regular if it has a finite number of different subtrees. Then, we can define another set of judgements: Definition 2.1 (Regular interpretation). The regular interpretation of an inference system I is the set ρ I of judgements having a regular proof tree.
In the following we will write I ρ j for j ∈ ρ I . To ensure that the regular interpretation is well-defined, we have to check it is indeed an interpretation, namely, it is a fixed point of F I . We refer to Sect. 4 for this proof.
Let us illustrate regular proof trees by a couple of examples. Consider λ-terms, ranged over by M, N , with the usual full β-reduction →. Denote by R(M ) the set of terms reachable from M , that is, where → is the reflexive and transitive closure of →, and by S(M ) the subset of R(M ) of those terms reachable in one step, that is, Note that S(M ) is necessarily finite as the set of redexes in any λ-term is finite, while R(M ) may in general be infinite. We say that a term M is regularly reducible if the set R(M ) is finite. In other words, this means that its evaluation graph of M is finite or, alternatively, its evaluation tree is regular, because the evaluation tree of M has one different subtree for any term reachable from M . Obviously, all strongly normalising terms are regularly reducible, but also some non-normalising terms are regularly reducible, for instance, so is the term Ω = ∆ ∆, where ∆ = λx.x x, as it always reduces to itself. Instead, a term like Ω 1 = ∆ 1 ∆ 1 , with ∆ 1 = λx.x x x, is not regularly reducible as it reduces to larger and larger terms ( We can define a judgement reg-red(M ) characterising regularly reducible terms as the regular interpretation of the following rule: Indeed, the proof tree for reg-red(M ) coincides with the evaluation tree of M , hence judgements derivable by regular proof trees coincides with regularly reducible terms. As another example, assume that we want to define the judgement dist G (v , u, δ), where G is a graph, v and u are nodes in G and δ ∈ [0, ∞], stating that the distance from v to u in G is δ. We represent a graph by its accessibility function G : V → ℘(V ), where V is the finite set of nodes. The judgement is defined by the following (meta-)rules, where we assume min ∅ = ∞: Of course the inductive interpretation is not enough: it can only deal with acyclic graphs, because, in presence of cycles, we cannot reach a base case (an axiom) in finitely many steps. Hence, we need infinite derivations to handle cycles, and, since the set of nodes is finite, to compute the distance, we need only finitely many judgements, thus regular derivations should be enough. Fig. 1 shows a concrete example of this feature of derivations in the above inference system. As we said, standard inductive and coinductive interpretations are fixed points of the inference operator. In the next few sections, we will show that this is the case also for the regular interpretation.

The rational fixed point
In this section we define the rational fixed point in a lattice-theoretic setting, which will be the basis for the fixed point characterisation of the regular interpretation. The construction we present in Def. 3.1 and Theorem 3.2 is an instance of analogous constructions [AMV06, MPW16,MPW19] developed in a more general category-theoretic setting. We work in the lattice-theoretic setting, since it is enough for the aim of this paper and definitions and proofs are simpler and understandable by a wider audience. First, we report some basic definitions on lattices, for details we refer to [DP02]. A complete lattice is a partially ordered set L, where all A ⊆ L have a least upper bound (a.k.a. join), denoted by A. In particular, in L there are both a top element = L and a bottom element ⊥ = ∅. Furthermore, it can be proved that all A ⊆ L have also a greatest lower bound (a.k.a. meet), denoted by A. In the following, for all x, y ∈ L, we will write x y for the binary join and x y for the binary meet. The paradigmatic example of complete lattice is the power-set ℘(X) of a set X, ordered by set inclusion, where least upper bounds are given by unions. An We denote by C(L) the set of compact elements in L. It is easy to check that C(L) is closed under binary joins, that is, if x, y ∈ L are compact, then x y is compact as well. In the power-set lattice, compact elements are finite subsets.
An algebraic lattice is a complete lattice L, where each x ∈ L is the join of all compact elements below it, that is, x = {y ∈ C(L) | y x}. In other words, an algebraic lattice is generated by the set of its compact elements, since each element can be decomposed as a (possibly infinite) join of compact elements. The power-set lattice is algebraic, since each element can be decomposed as a union of singletons, which are obviously compact.
Given a function F : L → L and an element x ∈ L, we say that x is a pre-fixed point if F (x) x, a post-fixed point if x F (x), and a fixed point if x = F (x). We are interested in a special class of functions, called finitary functions (a.k.a. Scott-continuous functions), defined below. A subset A ⊆ L is directed if, for all x, y ∈ A, there is z ∈ A such that x z and y z, then a finitary function F : L → L is a function preserving the joins of all directed subsets of L, that is, for each directed subset A ⊆ L, F ( A) = F ! (A). A finitary function is also monotone: if x y then the set {x, y} is directed and its join is y, hence we get F (y) = F (x) F (y), that is, F (x) F (y). Monotone functions over a complete lattice have an important property: thanks to the Knaster-Tarski theorem [Tar55], we know that they have both least and greatest fixed points, that we denote by µF and νF , respectively. We will show that for a finitary function over an algebraic lattice we can construct another fixed point lying between the least and the greatest one. In the following we assume an algebraic lattice L, .
Note that, since both compact elements and post-fixed points are closed under binary joins, we have that, for all x, y ∈ R F , x y ∈ R F , but, in general, ρF is not compact, because it is the join of an infinite set.
The following theorem ensures that the rational fixed point is well-defined, that is, it is indeed a fixed point. Such result is a consequence of a general category-theoretic analysis [AMV06], we rephrase the proof in our more specific setting as it is much simpler. Proof. Since ρF is defined as the least upper bound of a set of post-fixed points, it is post-fixed as well. Hence, we have only to check that F (ρF ) ρF . First, since L is algebraic we have F (ρF ) = {x ∈ C(L) | x F (ρF )}, hence it is enough to prove that, for all x ∈ C(L) such that x F (ρF ), we have x ρF . Consider Finally, x w is compact, as it is the join of compact elements, hence x w ∈ R F , and this implies x x w ρF , as needed.
As for least and greatest fixed points, as an immediate consequence of Def. 3.1, we get a proof principle to show that an element is below ρF . Proposition 3.3. Let F : L → L be a finitary function and z ∈ L, then, if there is a set

Fixed point semantics for regular coinduction
In this section, we prove that the regular interpretation ρ I of a (finitary) inference system I (Def. 2.1) coincides with the rational fixed point of the inference operator F I . Rather than giving an ad-hoc proof, we present a general framework where to express in a uniform and systematic way the equivalence between proof-theoretic and model-theoretic semantics, and then prove such equivalence for the regular case. To do this, we need a more formal account of proof trees. These definitions work for any inference system, even non-finitary ones.
A formal account of proof trees. To carry out the proof, we need a more formal account of proof trees (see [Dag19] for details).
A tree language on a set A is a non-empty and prefix-closed subset L ⊆ A , that is, such that, for all α ∈ A and x ∈ A, if αx ∈ L then α ∈ L, hence, in particular, the empty sequence belongs to any tree language.
A tree τ on a set A is a pair r, L where L is a tree language on A and r ∈ A is the root of the tree. We set N(τ ) = L and r(τ ) = r. Intuitively, a sequence α ∈ L represents a node of the tree labelled by τ (α), defined as the last element of the sequence r(τ )α. Therefore, a tree τ on A induces a partial function from A to A whose domain is a tree language. Differently from the literature [Cou83,AAMV03], our definition forces trees to be unordered and, more importantly, it ensures there cannot be two sibling nodes with the same label, we refer to [Dag19], where these trees are called children injective, for a detailed comparison. These two additional requirements will be essential to prove a crucial result of this section, Theorem 4.7, and are reasonable to define proof trees as we will see below.
Having these notations, we say that a tree τ on the universe U is a proof tree in I iff, for all nodes α ∈ N(τ ), we have r ! (chl τ (α)), τ (α) ∈ I. In the following, as it is customary, we often represent proof trees using stacks of rules, that is, if Pr , c ∈ I and T = {τ i | i ∈ I} is a collection of trees such that r ! (T ) = Pr and r( Finally, we say that a tree τ is a proof tree for a judgement j ∈ U if it is a proof tree rooted in j , that is, r(τ ) = j .
Relating proof-theoretic and model-theoretic semantics. We now present a systematic approach to define and relate proof-theoretic and model-theoretic semantics of inference systems. Let T I be the set of all (well-founded or not) proof trees in I and, abusing a bit the notation, let r : T I → U be the function that maps a proof tree to its root. Then the direct image and the inverse image along r are r ! : ℘(T I ) → ℘(U) and r * : ℘(U) → ℘(T I ), respectively. There is an adjunction r ! r * , that is, for all X ⊆ T I and Y ⊆ U, In other words, r ! behaves as an abstraction function [CC77]. We define the tree inference operator T I : ℘(T I ) → ℘(T I ) as follows: It is easy to check that T I is monotone. This function behaves the same way as F I , but keeps track of the trees used to derive the premises of the rule. More formally, F I and T I are related by the following proposition, which is an immediate consequence of their definitions.
It can be proved 4 that µT I is the set of well-founded proof trees, while νT I is the set of all proof trees. Then, the correspondence between proof-theoretic and model-theoretic approaches in the standard inductive and coinductive cases can be succinctly expressed by the equalities: µ I = r ! (µT I ) = µF I and ν I = r ! (νT I ) = νF I . 4 We omit the proofs because the focus of the paper is on regular trees. The regular case. First of all, we state a fundamental property of finitary inference systems: Proposition 4.3. If I is finitary, then F I and T I are finitary.
Proof. We do the proof for T I . Let X ⊆ ℘(U) be a directed subset. Since T I is monotone, we have T I ! (X) ⊆ T I ( X), hence we have only to check the other inclusion. If τ ∈ T I ( X), dst(τ ) ⊆ X and, since dst(τ ) is finite, as τ is a proof tree and I is finitary, there is a finite Let us denote by R I the set of regular proof trees in I. Thanks to Prop. 4.3 and Theorem 3.2, we know that ρF I and ρT I are both well-defined. Then, the theorem we have to prove is the following: The first step of the proof is to show that the set of regular proof trees coincides with the rational fixed point of T I . To this end, we have the following characterization of post-fixed points of T I .
To prove ρT I ⊆ R I , let X ⊆ T I be a finite post-fixed point of T I , then we have to show that X ⊆ R I . Let τ ∈ X, then, by Lemma 4.5, we have SubTr(τ ) ⊆ X, hence SubTr(τ ) is finite, that is, τ is regular, as needed.
Thanks to Lemma 4.6 and Def. 2.1, we trivially get the first equality: ρ I = r ! (ρT I ).
To prove the second equality of Theorem 4.4, we need a general property of regular trees, which is a stronger version of a result proved in [Dag19]. To this end, assume a set A and denote by T A and R A the sets of all trees and regular trees on A, respectively. Note that functions dst : T A → ℘(T A ) and r : T A → A, mapping a tree to its direct subtrees and to its root, respectively, are well-defined and restrict to R A , because subtrees of a regular tree are regular as well. Basically, we show that, starting from a graph structure on a subset of A, for each node of the graph there is a unique way to construct a tree coherent with the graph structure, and, moreover, if this subset is finite, all the constructed trees are regular.
In this context a graph is a function g : X → ℘(X), modelling the adjacency function, that is, X is the set of nodes and, for all x ∈ X, g(x) is the set of adjacents of x.
Theorem 4.7. Let g : X → ℘(X) be a function and v : X → A be an injective function. Then, there exists a unique function p : X → T A such that the following diagram commutes: furthermore, if X is finite, then p corestricts to R A , that is, the following diagram commutes: Proof. For all x ∈ X, we define the set L x,n of paths of length n starting from x and the set L x of all paths starting from x as follows: Trivially we have, for all x ∈ X, L x ⊆ A . We show, by induction on n, that for all n ∈ N, x ∈ X, α ∈ A and a ∈ A, if αa ∈ L x,n+1 then α ∈ L x,n . Base: Since αa ∈ L x,1 , we have α = ε ∈ L x,0 , as needed. Induction: We prove the thesis for n + 1. Since αa ∈ L x,n+2 , by definition of L x,n+2 , we have α = v(y)β, for some y ∈ g(x), and βa ∈ L y,n+1 . By induction hypothesis, we get β ∈ L y,n , then, by definition of L x,n+1 , we get α = v(y)β ∈ L x,n+1 , as needed. This implies that L x is prefix-closed, thus a tree language, and so x, L x is a tree on A. We define To prove that the diagram commutes, we have to show that, for all x ∈ X and τ ∈ T A , r(p(x)) = v(x), which is true by construction of p, and τ ∈ dst(p(x)) iff τ = p(y) for some y ∈ g(x). First of all, note that, for all y ∈ g(x) and α ∈ A , we have v(y)α ∈ L x iff α ∈ L y : if α ∈ L y then α ∈ L y,n , for some n ∈ N, thus v(y)α ∈ L x,n+1 ⊆ L x , and, if v(y)α ∈ L x then v(y)α ∈ L x,n+1 , for some n ∈ N, thus there is z ∈ g(x) such that v(z) = v(y) and α ∈ L z,n ⊆ L z , but, since v is injective, we get z = y and so α ∈ L y . From this fact we immediately get that p(y) ∈ dst(p(x)), for all y ∈ g(x). On the other hand, if τ ∈ dst(p(x)), then τ = p(x) |a , for some a ∈ A, that is, τ = a, {α ∈ A | aα ∈ L x } . In particular, we have a ∈ L x,1 ⊆ L x , hence a = v(y), for some y ∈ g(x). Therefore, again thanks to the fact above, we get τ = v(y), L y = p(y), as needed.
To prove uniqueness, consider a function q : X → T A making the diagram commute. Then, r(q(x)) = v(x) = r(p(x)), hence we have only to show that N(q(x)) = L x . Therefore, we prove by induction on α ∈ A that, for all x ∈ X, α ∈ N(q(x)) iff α ∈ L x . Base: The thesis is trivial. Induction: We prove the thesis for aα. We have aα ∈ N(q(x)) iff α ∈ N(q(x) |a ) and, since the diagram commutes, hence q(x) |a = q(y), for some y ∈ g(x), this is equivalent to a = r(q(x) |a ) = r(q(y)) = v(y) and α ∈ N(q(y)), for some y ∈ g(x). By induction hypothesis, this is equivalent to a = v(y) and α ∈ L y , which is equivalent to aα ∈ L x . To prove that p corestricts to R A , we just have to show that, if X is finite, then p(x) is regular, for all x ∈ X. We prove, by induction on α, that, for all α ∈ N(p(x)), there exists y ∈ X such that p(x) |α = p(y). Base: We have p(x) |ε = p(x), as needed. Induction: We prove the thesis for βa. We have p(x) | βa = (p(x) | β ) |a and by induction hypothesis, there is z ∈ X such that p(x) | β = p(z). Therefore, we have p(x) |α = p(z) |a ∈ dst(p(z)), hence, since the diagram commutes, there is y ∈ g(z) ⊆ X such that p(z) |a = p(y), as needed. Finally, we note that p is injective: if p(x) = p(y) then v(x) = r(p(x)) = r(p(y)) = v(y), hence x = y because v is injective.
This result looks like a final coalgebra theorem for the functor mapping a set X to ℘(X) × A, but it is not. Indeed, such a functor cannot have a final coalgebra, because this would imply the existence of a bijection between a set Z, the carrier of such a final coalgebra, and ℘(Z) × A, which is not possible for cardinality reasons. Here we manage to have a unique function making the diagram commute, because we additionally require the function v : X → A to be injective.
We can now prove Theorem 4.4.
Proof of Theorem 4.4. By Lemma 4.6 we get r ! (R I ) = r ! (ρT I ). Recall that in ℘(T I ), compact elements are finite subsets, hence the set of all compact elements is ℘ ω (T I ). Then, by definition of the rational fixed point and since r ! preserves arbitrary unions (it is a left adjoint), we get r ! (ρT I ) = {r ! (X) | X ∈ ℘ ω (T I ) and X ⊆ T I (X)}. Hence, if X ∈ ℘ ω (T I ) and X ⊆ T I (X), r ! (X) is obviously finite and, by Corollary 4.2, it is also post-fixed. Therefore, by definition of the rational fixed point, we get r ! (X) ⊆ ρF I , and this proves r ! (ρT I ) ⊆ ρF I . To conclude the proof, we show that ρF I ⊆ r ! (R I ). To this end, we just have to prove that, given a finite set X ∈ ℘ ω (U) such that X ⊆ F I (X), each judgement j ∈ X has a regular proof tree. Since X ⊆ F I (X), for each j ∈ X, there is Pr j ⊆ X such that Pr j , j ∈ I. Hence, applying Theorem 4.7, where g maps j to Pr j and v is the restriction of the identity on U to X, we get an injective function p : X → R U . We have still to prove that p(j ) is a proof tree. It is easy to prove by induction on α that, for all α ∈ N(p(j )), there is j ∈ X such that p(j ) |α = p(j ). Therefore, r ! (dst(p(j ) |α )), r(p(j ) |α ) = r ! (dst(p(j ))), r(p(j )) = Pr j , j , because dst • p = p ! • g and r • p = v, by Theorem 4.7. This proves that p(j ) is a proof tree in I, as Pr j , j ∈ I by hypothesis.

An inductive characterization
Although the regular interpretation is essentially coinductive, as it allows non-well-founded derivations, it has an intrinsic finite nature, because it requires proof trees to be regular, that is, to have only finitely many subtrees. Given this finiteness, a natural question is the following: is it possible to find a finite presentation of derivations for judgements belonging to the regular interpretation? f a 2:12

F. Dagnino
Vol. 17:4 In this section we show this is the case, by providing an inductive characterization of the regular interpretation.
The idea behind such an inductive characterisation is simple. Regular trees are basically cyclic structures. Usually, to deal with cyclic structures inductively, we need to use auxiliary structures to detect cycles, to ensure termination. For instance, in order to perform a visit of a graph, we detect cycles by marking already encountered nodes. The inductive characterization described below models such cycle detection mechanism in an abstract and canonical way, in the general setting of inference systems. The idea is the following: during the proof, we keep track of already encountered judgements and, if we find again the same judgement, we can use it as an axiom.
This approach is intuitively correct, since in a regular proof tree there are only finitely many subtrees, hence infinite paths must contain repeated judgements, and this mechanism is designed precisely to detect such repetitions.
We now formally define the construction and prove its correctness. Let I be a finitary inference system on the universe U. We consider judgements of shape H j where H ⊆ U is a finite set of judgements, called circular hypotheses, and j ∈ U is a judgement. Then, we have the following definition.
Definition 5.1. The inference system I consists of the following rules: Therefore, in the system I , we have the same rules as in I, that, however, extend the set of circular hypotheses by adding the conclusion of the rule as an hypothesis in the premises. Furthermore, I has also an additional axiom that allows to apply circular hypotheses.
The correctness of the construction in Def. 5.1 is expressed by the fact that, a judgement j has a regular proof tree in I if and only if it has a finite derivation in I without circular hypotheses, as formally stated by the next theorem.
Theorem 5.2. I µ ∅ j iff I ρ j . We prove a more general version of the theorem. First of all, if X ⊆ U, we denote by I ⊕X the system obtained from I by adding an axiom for each element of X, hence we have Then, the left-to-right implication of Theorem 5.2 is an immediate consequence of the following lemma: The proof is by induction on rules in I . There are two types of rules, hence we distinguish two cases: (hp): we have j ∈ H , hence ∅, j ∈ I ⊕H , thus I ⊕H ρ j . (unfold): we have a rule {j 1 , . . . , j n }, j ∈ I and, by induction hypothesis, we get I ⊕H ∪{j } ρ j i , for all i ∈ 1..n. Since ρ I ⊕H ∪{j } is a rational fixed point (Theorem 4.4), for all i ∈ 1..n, there is a finite set X i such that as F I ⊕H is monotone, and j ∈ F I (X), because, by construction, {j 1 , . . . , j n } ⊆ X. Thus, we get X ∪ {j } ⊆ F I ⊕H (X) ∪ {j } = F I ⊕H (X), because j ∈ F I (X) ⊆ F I ⊕H (X), hence X ∪ {j } is a postfixed point of F I ⊕H , since it is monotone. Therefore, since X ∪ {j } is a finite post-fixed point, by Prop. 3.3 and Theorem 4.4, we get I ⊕H ρ j . The proof of the other implication relies on an auxiliary family of functions indexed over finite subsets of U and finite graphs g : X → ℘(X), with X ∈ ℘ ω (U), mapping a judgement j ∈ X and a subset S ⊆ X to a tree whose nodes are judgements of shape H j . This function is recursively defined as follows: The function tr H X, g enjoys the following properties: Proposition 5.4. For all H ∈ ℘ ω (U), g : X → ℘(X) with X ∈ ℘ ω (U), j ∈ X and S ⊆ X, tr H X, g (j , S) is defined. Proof. Denote by c(S) the cardinality of the set X \ (H ∪ S). We prove that, for all n ∈ N and S ⊆ X, if c(S) = n then tr H X, g (j , S) is defined. The proof is by induction on n. Base: If c(S) = n = 0, then X ⊆ H ∪ S, hence j ∈ H ∪ S hence tr H X, g (j , S) = H ∪ S j .
Proposition 5.5. For all H ∈ ℘ ω (U), g : X → ℘(X) with X ∈ ℘ ω (U), j ∈ X and S ⊆ X, if g(j ), j ∈ I, for all j ∈ X \ H , then tr H X, g (j , S) is a finite proof tree for H ∪ S j in I .
Proof. The proof is a straightforward induction on the definition of tr H X, g . We can now prove the following lemma, which concludes the proof of Theorem 5.2.
Lemma 5.6. If I ⊕H ρ j then I µ H j . Proof. If j ∈ ρ I ⊕H , since ρ I ⊕H = ρF I ⊕H (Theorem 4.4), we have that there exists a finite set X ⊆ U such that j ∈ X ⊆ F I ⊕H (X) = F I (X) ∪ H . Then, for each j ∈ X \ H , there is Pr j ⊆ X such that Pr j , j ∈ I. Define g : X → ℘(X) by g(j ) = Pr j , if j ∈ X \ H , and g(j ) = ∅ otherwise. Therefore, by Prop. 5.4, tr H X, g (j , ∅) is defined and, by Prop. 5.5, it is a finite proof tree for H j in I , hence we get I µ H j , as needed. We conclude the section by discussing a more operational aspect of Def. 5.1. In this definition, we aimed at being as liberal as possible, hence, the two types of rules are not mutually exclusive: for a judgement H j with j ∈ H we can either apply the circular hypothesis or use a rule from I. Since here we are only interested in derivability, this aspect is not that relevant, however, it becomes more interesting from an algorithmic perspective. Indeed, we can consider an alternative definition, where we allow the second type of rule only if j / ∈ H , in other words, we apply circular hypotheses as soon as we can. In this way we would have less valid proof trees in I , but the set of derivable judgements remains the same. Indeed, Lemma 5.3 ensures soundness also of the deterministic version, because any proof tree in the deterministic version is also a proof tree in the non-deterministic one. On the other hand, Lemma 5.6 ensures completeness of the deterministic version, because the functions tr H X, g build a proof tree in the deterministic version, since they perform the additional check j / ∈ H to apply rules from I.

Regular reasoning
In this section we discuss proof techniques for regular reasoning, which can be defined thanks to the results proved in Sect. 4 and Sect. 5. Let I be a finitary inference system on the universe U. We are typically interested in comparing the regular interpretation of I to a set of judgements S ⊆ U (specification). In particular, we focus on two properties: soundness: all derivable judgements belong to S, that is, ρ I ⊆ S, completeness: all judgements in S are derivable, that is, S ⊆ ρ I .
For completeness proofs, we rely on the fixed point characterization of ρ I (Theorem 4.4). Indeed, since ρ I = ρF I , from Prop. 3.3 we get a proof principle, which we call the regular coinduction principle, expressed by the following proposition: Proposition 6.1 (Regular coinduction). Let S ⊆ U be a set of judgements, then if, for all j ∈ S, there is a finite set X ⊆ U such that • X ⊆ F I (X), and • j ∈ X, then, S ⊆ ρ I .
Proof. Immediate from Prop. 3.3. This is very much like the usual coinduction principle, but it additionally requires X to be finite. The condition X ⊆ F I (X) can be equivalently expressed as follows: for all j ∈ X, there is a rule Pr , j ∈ I such that Pr ⊆ X.
Example 6.2. To show how proofs by regular coinduction work, as first example we consider the introductory one: the definition of the judgement allPos(s), where s is a stream of natural numbers, which, intuitively, should hold when s is positive, that is, it contains only positive elements. We report here the inference system I >0 defining this predicate: The specification S >0 is the set of judgements allPos(s), where s is rational, meaning that it has finitely many different substreams, and positive. Then, the completeness statement is the following: If s is rational and positive, then I >0 ρ allPos(s). To prove the result, let s be a rational stream containing only positive elements and set X s = {allPos(s ) | s = x 1 : . . . :x n :s }. Clearly, X s is finite, because s is rational, and allPos(s) ∈ X s , hence we have only to prove that it is consistent. Let allPos(s ) ∈ X s , then s = x:s , thus s = x 1 : . . . :x n :x:s , and so x > 0, because it is an element of s, and allPos(s ) ∈ X s , by definition of X s , and this proves that X s is a post-fixed point. Therefore, by the regular coinduction principle we get the thesis. Let us now focus on the soundness property. If we interpreted I inductively, we would prove soundness by induction on rules, but in the regular case this technique is not available, since it is unsound. However, in Theorem 5.2, we proved that j ∈ ρ I if and only if ∅ j is derivable in I , which is interpreted inductively. Therefore, we can exploit the induction principle associated with I to prove soundness, as the following proposition states: Proposition 6.3. Let S ⊆ U be a set of judgements, then, if there is a family (S H ) H ∈℘ω(U ) such that S H ⊆ U and S ∅ ⊆ S, and, for all H ∈ ℘ ω (U), • H ⊆ S H , and • for all rules Pr , j ∈ I, if Pr ⊆ S H ∪{j } then j ∈ S H , then ρ I ⊆ S.
Proof. By induction on I , we immediately get that I µ H j implies j ∈ S H . Therefore, if j ∈ ρ I , by Theorem 5.2, we have I µ ∅ j , hence j ∈ S ∅ ⊆ S.
In other words, given a specification S ⊆ U, to prove soundness we have first to generalize the specification to a family of specifications, indexed over finite sets of judgements, in order to take into account circular hypotheses. Then, we reason by induction on rules in the equivalent inductive system (see Def. 5.1) and, since S ∅ ⊆ S, we get soundness. We now consider a more complex example: the definition of the distance in a graph (see page 5), proving it is sound and complete with respect to the expected meaning.
Example 6.5. For the reader's convenience, we report here the rules defining this judgement: We denote by I dist the above inference system. We recall for the reader's convenicence a few definitions we need in the proof. Let us assume a graph G : V → ℘(V ). An edge in G is a pair v , u such that u ∈ G(v ), often written vu. We denote by E the set of edges in G.
A path from v 0 to u n in G is a non-empty finite sequence of nodes α = v 0 . . . v n with n ≥ 0, such that, for all i ∈ 1..n, v i−1 v i ∈ E . The empty path starting from the node v to itself is the sequence v . If α is a path in G, then we denote by α the length of α, that is, the number of edges in α, and we write v ∈ α when the node v occurs in α, that is, the path α traverses v . The distance from a node v to a node u, denoted by δ(v , u), is the least length of a path from v to u, that is, δ(v , u) = min{ α | α is a path from v to u}, hence, if there is no path from v to u, δ(v , u) = min ∅ = ∞. We say a path α = v 0 . . . v n is simple if it visits every node at most once, that is, v i = v j implies i = j, for all i, j ∈ 0..n. Note that the empty path is trivially simple. It is also important to note that δ(v , u) is the least length of a simple path from v to u. Then, the specification D is the set of judgements dist G (v , u, δ) with δ = δ(v , u).
We can now state that the definition of dist G (v , u, δ) is sound and complete with respect to the specification D.
Completeness proof. The proof is by regular coinduction. Let us consider a judgement dist G (v , u, δ(v , u)). Let R v ⊆ V be the set of nodes reachable from v and let us define This set is clearly finite and, moreover, dist G (v , u, δ(v , u)) ∈ X v , because v is reachable from itself. Hence, we have only to prove that X v is a post-fixed point. Let v ∈ R v , then we have to find a rule with conclusion dist G (v , u, δ(v , u)) and whose premises are in X v . We have two cases: • If v = u, then δ(v , u) = 0 and so we have the thesis by rule (empty).
Soundness proof. To apply Prop. 6.3, we generalize the specification D to a family of sets D H , indexed over finite sets of judgements, defined below. ( )dist G (v , u, δ) ∈ D H iff there is a set of paths P and a function f : P → N ∪ {∞} such that (1) for all α ∈ P , either α goes from v to u and f (α) = 0, or α goes from v to v and dist G (v , u, f (α)) ∈ H ; (2) for each simple path β from v to u, there is α ∈ P such that β = αβ ; then, by Item 3 of ( ), δ = min{ α + f (α) | α ∈ P }, for some set of paths P and function f : Since H is empty, by Item 1 of ( ), we have that, for all α ∈ P , α is a path from v to u and f (α) = 0, hence δ(v , u) ≤ α + f (α) for all α ∈ P and so δ(v , u) ≤ δ. To prove the other inequality, let β be a simple path from v to u, then, by Item 2 of ( ), there is α ∈ P such that β = αβ , but, by Item 1 of ( ), α goes from v to u and f (α) = 0, hence β = α, because it cannot traverse twice u; thus we have δ ≤ β = α + f (α), for any simple path β, and so δ ≤ δ(v , u).
The fact that H ⊆ D H is immediate because, if dist G (v , u, δ) ∈ H , then, to get the thesis, it is enough to take as P the set containing only the empty path with f (v ) = δ, which trivially satisfies all conditions in ( ).
Then, we have only to check that all sets D H are closed with respect to the rules (empty) and (adj), as formulated in Prop. 6.3.
If n = 0, then G(v ) is empty, δ = min ∅ = ∞ and there is no path from v to u. Hence, the thesis follows by taking P = ∅.
Then, let us assume n ≥ 1. By hypothesis, δ = 1 + min{δ 1 , . . . , δ n } = 1 + δ k , for some k ∈ 1..n, since we are considering rule (adj). Since dist G (v i , u, δ i ) ∈ D H , for all i ∈ 1..n, there are P i and f i : P i → N ∪ {∞} satisfying ( ), in particular, by Item 3, we have that δ i = min{ α + f i (α) | α ∈ P i }. We define P as the set of paths v α with α ∈ P i such that, if α ends in v , then f i (α) = δ, and f : P → N ∪ {∞} is defined by f (v α) = f i (α) when α ∈ P i . Clearly, P satisfies Item 1 of ( )with respect to H . To check that Item 2 holds, let β be a simple path from v to u, then β = vv i β , for some i ∈ 1..n. Hence, v i β is a simple path from v i to u and v / ∈ v i β , thus, by Item 2 of ( )applied to P i , there is α ∈ P i such that v i β = α γ, and v / ∈ α , because v / ∈ v i β . Therefore, v α ∈ P and v α γ = vv i β = β, as needed.

Flexible regular coinduction
Infinite derivations are a very powerful tool, which make it possible to deal with a variety of situations that cannot be handled by only finite derivations. However, in some cases, they have an unexpected behaviour, allowing the derivation of intuitively incorrect judgements. The same issue affects also regular derivations. Let us explain this by an example. Consider the following rules, defining the judgement min(x, l), where x is an integer and s is a rational stream, stating that x is the minimum of the stream s.
min(y, s) min(z, x:s) z = min{x, y} In Fig. 2 we report three infinite regular derivations, thus valid for the regular interpretation of the above rules, where, however, only the first one is intuitively correct: judgements min(0, 2:2: . . .) and min(1, 2:2: . . .) should not be derivable, as 0 and 1 do not belong to the stream.
Inference systems with corules [ADZ17b, Dag19] have been recently designed precisely to address this issue for the coinductive interpretation, where arbitrary infinite derivations are allowed. Beside standard inference rules, they introduce special rules, called corules, which allow one to refine the coinductive interpretation, by filtering out some, undesired, infinite derivations. More precisely, an inference system with corules, or generalised inference system, is a pair I, I co where I and I co are inference systems, whose elements are called rules and corules, respectively. A corule is also denoted by Pr c , very much like a rule, but with a thicker line.
The semantics of such a pair, denoted by ν I, I co , is constructed in two steps: • first, we take the inductive interpretation of the union I ∪ I co , that is, µ I ∪ I co , • then, we take the coinductive interpretation of I restricted to µ I ∪ I co .
In symbols, we have ν I, I co = ν I | µ I∪Ico , where I | X is the inference system obtained from I by keeping only rules with conclusion in X ⊆ U.
In terms of proof trees, ν I, I co is the set of judgements with an arbitrary (finite or not) proof tree in I, whose nodes all have a finite proof tree in I∪I co . In [Dag19], ν I, I co is proved to be an interpretation of I, that is, a fixed point of F I .
In this section, we show that the results previously given for regular coinduction smoothly extend to generalised inference systems. The technical development in the following is partly repetitive; this could have been avoided by presenting the results in the generalized framework since the beginning. However, to have separation of concerns, we preferred to first give a presentation using only standard notions, limiting to this section non-standard ones.
We start by defining the regular interpretation of an inference system with corules.
Definition 7.1. Let I, I co be an inference system with corules. The regular interpretation ρ I, I co of I, I co is defined by ρ I, I co = ρ I | µ I∪Ico .
As we will see later in this section (Corollary 7.7), but it is not difficult to be convinced of it, in proof-theoretic terms this is equivalent to say that ρ I, I co is the set of judgements with a regular proof tree in I, whose nodes all have a finite proof tree in I ∪ I co . In this way, we can filter out some, undesired, regular derivations. In the following, we will write I, I co ρ j for j ∈ ρ I, I co .
Coming back to the example, using corules, we can provide a correct definition of the judgement min(x, s) as follows: min(y, s) min(z, x:s) z = min{x, y} min(x, x:s) The additional constraint, imposed by the coaxiom, allows us to build regular infinite derivation using only judgements min(x, s) where x belongs to s; thus filtering out the second and third incorrect proof trees in Fig. 2, since they involve judgements with no finite derivation using also the coaxiom.
All the results discussed so far for the regular interpretation can be smoothly extended to the regular interpretation of an inference system with corules. We will now develop all Let F , G : L → L be two functions, we write F G for the pointwise join of F and G, and, for all z ∈ L, F z for the function defined by F z (x) = F (x) z. It is easy to see that, if F and G are monotone, then F G is monotone as well, hence, by the Tarski theorem, it has a least fixed point µ(F G). It is also easy to check that if z ∈ L is a pre-fixed point of F G, then it is a pre-fixed point of F as well, because F (z) F (z) G(z) z; this will be crucial for the following construction.
We can now define the bounded rational fixed point: In other words, ρ[F , G] is the least upper bound of all compact elements below the least fixed point of F G, that is, To see that ρ[F , G] is well-defined, that is, it is indeed a fixed point of F , we have the following propositions: Proposition 7.3. If F : L → L is finitary, then, for all z ∈ L, F z is finitary as well.
Proof. Let D ⊆ L be a directed set. Since F is finitary, it is monotone, hence F z is monotone as well, therefore we get (F ! (D) z) F ( D) z. To prove the other inequality, it is enough to show that, for any compact element y F ( D) z, y (F ! (D) z), because the lattice is algebraic. Since F is finitary, we have F ( D) = F ! (D). We know that y z and y F ( D) = F ! (D) and, since y is compact, there is a finite subset W ⊆ D such that y F ! (W ). Since D is directed and W is finite, there is w ∈ D such that W w, , because F is monotone and w ∈ D. Therefore, we get y F (w) z (F ! (D) z), as needed. In [ADZ17b,Dag19] the authors show that the least and the greatest fixed point are instances of the bounded fixed point. Analogously, we show that the least and the rational fixed point are instances of the rational fixed point bounded by a function G, that is, they can be recovered for specific choices of G. In the following, for all z ∈ L, we write K z : L → L for the constant function, that is, K z (x) = z, for all x ∈ L. 7.2. Fixed point semantics. Let I, I co be an inference system with corules where I is finitary. We have two goals: first we want to justify the proof-theoretic characterisation provided at the beginning of this section and, second, we want to prove that the rational interpretation generated by corules is indeed an interpretation of the first inference system.
To get the proof-theoretic characterisation, it is enough to observe the following property: Proposition 7.6. Let X ⊆ U, then τ ∈ R I | X iff τ ∈ R I and, for all α ∈ N(τ ), τ (α) ∈ X.
Proof. By definition we have I | X ⊆ I, hence R I | X ⊆ R I , and, all rules in I | X have conlcusion in X. Then, the thesis is immediate since, by definition, all nodes of a proof tree are labelled by the conclusion of some rule.
Recall that we have described ρ I, I co in proof-theoretic terms as the set of judgements having a regular proof tree in I, whose nodes all have a finite proof tree in I ∪ I co . Formally, we have the following corollary: Corollary 7.7. I, I co ρ j iff there is τ ∈ R I such that r(τ ) = j and, for all α ∈ N(τ ), τ (α) ∈ µ I ∪ I co .
Towards the second goal, we show that the regular interpretation of I, I co coincides with the rational fixed point of F I bounded by F Ico (see Def. 7.2), which is an immediate consequence of the following proposition: Proof. By Def. 7.1 and Theorem 4.4, we know that ρ I, I co = ρF (I | µ I∪Ico ) . By Def. 7.2, we have ρ[F I , F Ico ] = ρ(F I ) µ(F I ∪F Ico ) and, by definition of the inference operator, we have F I∪Ico = F I ∪ F Ico , hence µ I ∪ I co = µ(F I ∪ F Ico ) and (F I ) µ(F I ∪F Ico ) = (F I ) µ I∪Ico . Therefore, as proved in [Dag19], we have F (I | µ I∪Ico ) = (F I ) µ I∪Ico , which implies the thesis.
Then, this proposition, together with Prop. 7.4, in particular ensures that ρ I, I co is indeed a fixed point of F I , that is, an interpretation of I.
An important property of inference systems with corules is that standard interpretations (the inductive and the coinductive one) are particular cases. Analogously, the inductive and the regular interpretations are particular cases of the regular interpretation generated by corules. Let us denote by I U the inference system containing one axiom for each j ∈ U, that is, Pr , j ∈ I U iff Pr = ∅. We have the following proposition: Proposition 7.9. Let I be an inference system, then µ I = ρ I, ∅ and ρ I = ρ I, I U .
Proof. It follows from Prop. 7.5, because ρ I, I co = ρ[F I , F Ico ], by Prop. 7.8, and we have F I U (X) = U and F ∅ (X) = ∅, for all X ⊆ U.
In other words, when the set of corules is empty, we allow only rules with conclusion in µ I ∪ ∅ = µ I , hence we cannot derive anything outside µ I , and, on the other hand, when the set of corules is I U , we do not remove any rule, because µ I ∪ I U = U, thus we get exactly the regular interpretation of I. 7.3. Cycle detection for corules. As the standard regular interpretation, also the regular interpretation of an inference system with corules has a sound and complete algorithm to find a derivation for a judgment, if any, and may not terminate otherwise.
Let us assume an inference system with corules I, I co . Since its regular interpretation is defined as the regular interpretation of I | µ I∪Ico , which is the inference system obtained from I by keeping only rules with conclusion in µ I ∪ I co , we could get an inductive characterisation of ρ I, I co by applying the construction in Def. 5.1 to the inference system I | µ I∪Ico . This provides us with a sound and complete algorithm to find a derivation for a judgement which belongs to ρ I, I co , which works the same way as the one introduced in Sect. 5, but, in addition, each time we apply the rule (unfold) with Pr , j ∈ I, we have to check that j ∈ µ I ∪ I co . However, we will see that this additional check is necessary only to apply circular hypotheses, thus defining a cleaner procedure.
To this end we construct the inference system I Ico as follows: Definition 7.10. The inference system I Ico consists of the following rules: This definition is basically the same as Def. 5.1, except the additional side condition in rule (b-hp) j ∈ µ I ∪ I co , which enforces the additional check. We have the following fundamental properties: Proposition 7.11. If I Ico µ H j then j ∈ µ I ∪ I co .
Proof. By induction on rules of I Ico : the case for rule (b-hp) is trivial, for the rule (b-unfold), by Def. 7.10, we have a rule {j 1 , . . . , j n }, j ∈ I and, by induction hypothesis, we know that j k ∈ µ I ∪ I co , for all k ∈ 1..n, hence j ∈ µ I ∪ I co , as µ I ∪ I co is closed with respect to I.
Proposition 7.12. If H ⊆ µ I ∪ I co , then I Ico µ H j iff I | µ I∪Ico µ H j .
Proof. The proof of the left-to-right implication is by induction on rules in I Ico .
(b-hp): By hypothesis j ∈ µ I ∪ I co , then the thesis follows by rule (hp).
(b-unfold): By Def. 7.10, we have a rule {j 1 , . . . , j n }, j ∈ I and by Prop. 7.11 we have j ∈ µ I ∪ I co , hence H ∪ {j } ⊆ µ I ∪ I co and {j 1 , . . . , j n }, j ∈ I | µ I∪Ico . Therefore, by induction hypothesis, we get I | µ I∪Ico µ H ∪ {j } j k , for all k ∈ 1..n, then the thesis follows by rule (unfold). Therefore, we get the thesis applying rule (unfold). The proof of the right-to-left implication is by induction on rules in I | µ I∪Ico .
with j = k mod n, we get c 0 − (x k − y k ) = c 0 + y k − x k = c j+1 b −k , that, when k tends to ∞, converges to 0, hence we get lim(x k − y k ) = c 0 .

Related work
The regular approach has been adopted in many different contexts, notably to define proof systems for several kinds of logics, and to define operational models of programming languages supporting cyclic structures. Concerning proof systems allowing regular proofs, usually called circlar proofs, we find proposals in [San02,FS13,Dou17] for logics with fixed point operators, and in [Bro05,BS11] for classical first order logic with inductive definitions. In both cases, regular proofs allow to naturally handle the unfolding of fixed point and recursive definitions, respectively. However, regular proofs allow the derivation of wrong sequents, such as the empty one; hence, to solve this issue, they have to impose additional constraints on regular proofs, such as parity conditions in [FS13], thus filtering out undesired derivations. These additional requirements on regular proofs are expressed at the meta-level and typically require some condition to hold infinitely often in the regular proof. As inference systems with corules have been designed precisely to filter out undesired infinite derivations, and they seem pretty good at capturing requirements that should hold infinitely often in the proof, it would be interesting to investigate whether these additional constraints can be enforced by an appropriate set of corules.
In [BKL19], the authors present a proof system supporting coinductive reasoning with Horn clauses. Such a system allows only finite derivations, enabling coinduction thanks to a cycle detection mechanism similar to the one we use in the context of inference systems. However, in their setting, they have to perform an additional 'productivity" check, that is, they have to ensure that a cycle is closed only after the application of a clause, otherwise they would fall in inconsistency. This check is not required in our setting, as our derivations are built only using rules.
Even though all these proof systems are tightly related to our work, there is an important difference: we study regular reasoning by itself, without fixing a specific syntax. In this way, we can work abstractly, focusing only on the essential feature of regularity, thus providing a common abstract and simple background to all these proof systems.
The other context where we can find applications of regular coinduction is in programming languages supporting cyclic structures. In this case, we use the term regular corecursion for a semantics of recursive definitions which detects cycles, analogously to the inductive characterization of the regular interpretation in Sect. 5.
The approach proposed in the logic paradigm is particularly interesting. Indeed, logic programs can be regarded as particular, syntactic instances of inference systems: judgments are ground atoms, and inference rules are ground instances of clauses.
The declarative semantics of logic programs turns out to be defined exactly the same way as that of the underlying inference systems, as fixed point of the associated inference operator. Moreover, in coinductive logic programming, the resolution procedure, called 2:26

F. Dagnino
Vol. 17:4 coSLD resolution [SMBG06, SBMG07, AD15], keeps track of already encountered goals, so that, if it finds again the same goal, up-to unification, it can accept it. This mechanism looks very similar to our inductive characterization of the regular interpretation, hence, the analogy with inference systems holds also at the operational level. The same analogies hold between generalised inference systems and logic programs with coclauses introduced in [DAZ20]. Basing on this correspondence, in [DAZ20] soundness and completeness of the resolution procedure with respect to the regular declarative semantics are proved, rather than in an ad-hoc way, by relying on the inductive characterisation of the regular interpretation given in this paper (Theorem 5.2 and Corollary 7.13). That is, it is enough to show that the resolution procedure is equivalent to the inductive characterisation of the regular interpretation.

Conclusion
Inference systems [Acz77,San11] are a widely used framework to define and reason on several kinds of judgements (small-step and big-step operational semantics, type systems, proof systems, etc.) by means of inference rules. They naturally support both inductive and coinductive reasoning: in the former approach only finite derivations are allowed, while in the latter one, arbitrary derivations (finite or not) can be used.
In this paper, we have considered regular reasoning, an interesting middle way between induction and coinduction, combining advantages of both approaches: it is not restricted to finite derivations, thus overcoming limitations of the inductive approach, but it still has a finite nature, as a regular derivation can only contain finitely many judgements. We started from a natural proof-theoretic definition of the regular interpretation of an inference system, as the set of judgements derivable by a regular proof tree. After presenting the construction of the rational fixed point in a lattice-theoretic setting, we proved that the regular interpretation coincides with the rational fixed point of the inference operator associated with the inference system. Then, we showed that the regular interpretation has an equivalent inductive characterization, which provides us with an algorithm to find a derivation for a judgment, if any. Relying on these results, we discussed proof techniques for regular reasoning: from the fact that the regular interpretation is a rational fixed point, we got the regular coinduction principle, which allows us to prove completeness, while, from the inductive characterization, we derived a proof technique to show soundness.
Finally, we focused on inference systems with corules [ADZ17b, Dag19], a recently introduced generalisation of inference systems, allowing refinements of the coinductive interpretation. We showed that all results presented for regular coinduction can be smoothly extended to this generalised framework, thus providing a flexible approach also to regular reasoning.
Concerning future work, an interesting direction is the development of more sophisticated proof techniques for regular reasoning. Indeed, several enhanced coinductive techniques have been proposed, such as parametrized coinduction [HNDV13] and coinduction up-to [BPPR17], which have been proved to be effective in several contexts. Adapting such techniques to the (flexible) regular case would provide us with powerful tools to support regular reasoning. A further development in this direction would be to provide support to regular reasoning in proof assistants, which usually provide primitives only for plain induction and coinduction. To this end, we could start from existing approaches [Spa16, UV17] to implement regular terms in proof assistants. Finally, it would be interesting to apply results in this paper to build, in a principled way, abstract and operational models of languages supporting regular corecursion, going beyond the logic paradigm.