12 Rümmer, Hojjat, Kuncaktruen 8 ≤ 0n 9 ≤ −1 ∨ (rec 9 = 1 ∧ n 9 = 0)x 2 ≥ 0n f ≤ −1 ∨ (rec f = 1 ∧ n f = 0)res 3 = x 3 + 1falseFig. 5. Tree interpolant solving the interpolation problem in Fig. 4The UFO verification system [3] is able to compute DAG interpolants, based onthe interpolation functionality of MathSAT [9]. We can observe that DAG interpolants(despite their name) are incomparable in expressiveness to tree interpolation. This isbecause DAG interpolants correspond to linear <strong>Horn</strong> clauses, <strong>and</strong> might have sharedrelation symbol in bodies, while tree interpolants correspond to possibly nonlinear treelike<strong>Horn</strong> clauses, but do not allow shared relation symbols in bodies.Encoding of restricted DAG interpolants as linear <strong>Horn</strong> clauses. For every v ∈ V, let{ ¯x v } = ( ⋃fv(L E (a, v)) ) ∩ ( ⋃fv(L E (v, a)) )(a,v)∈E(v,a)∈Ebe the variables allowed in the interpolant to be computed <strong>for</strong> v, <strong>and</strong> p v be a freshrelation symbol of arity | ¯x v |. The interpolation problem is then defined by the followingset of linear <strong>Horn</strong> clauses:For each (v, w) ∈ E: L V (v) ∧ L E (v, w) ∧ p v ( ¯x v ) → p w ( ¯x w ),L V (v) ∧ ¬L V (w) ∧ L E (v, w) ∧ p v ( ¯x v ) → false,For en, ex ∈ V: true → p en ( ¯x en ), p ex ( ¯x ex ) → falseEncoding of linear <strong>Horn</strong> clauses as DAG interpolants. Suppose HC is a finite, recursionfree,<strong>and</strong> linear set of <strong>Horn</strong> clauses. We can solve the system of <strong>Horn</strong> clauses by computinga DAG interpolant <strong>for</strong> every connected component of the → HC -graph. As inSect. 5.2, we normalise <strong>Horn</strong> clauses according to Def. 2. We also assume that multipleclauses C ∧ p( ¯x p ) → q( ¯x q ) <strong>and</strong> D ∧ p( ¯x p ) → q( ¯x q ) with the same relation symbols aremerged to (C ∨ D) ∧ p( ¯x p ) → q( ¯x q ).Let {p 1 , . . . , p n } be all relation symbols of one connected component. We then definethe DAG interpolation problem (V, E, en, ex), L E , L V by
<strong>Classifying</strong> <strong>and</strong> <strong>Solving</strong> <strong>Horn</strong> <strong>Clauses</strong> <strong>for</strong> <strong>Verification</strong> 13– the vertices V = {p 1 , . . . , p n } ∪ {en, ex}, including two fresh nodes en, ex,– the edge relationE ={(p, q) | there is a clause C ∧ p( ¯x p ) → q( ¯x q ) ∈ HC}∪ {(en, p) | there is a clause D → p( ¯x p ) ∈ HC}∪ {(p, ex) | there is a clause E ∧ p( ¯x p ) → false ∈ HC} ,– <strong>for</strong> each (v, w) ∈ E, the edge labelling⎧C ∧ ¯x v = ¯x v ∧ ¯x w = ¯x w⎪⎨L E (v, w) = D ∧ ¯x w = ¯x w⎪⎩ E ∧ ¯x v = ¯x vif C ∧ v( ¯x v ) → w( ¯x w ) ∈ HCif v = en <strong>and</strong> D → w( ¯x w ) ∈ HCif w = ex <strong>and</strong> E ∧ v( ¯x v ) → false ∈ HCNote that the labels include equations like ¯x v = ¯x v to ensure that the right variablesare allowed to occur in interpolants.– <strong>for</strong> each v ∈ V, the node labelling L V (v) = true.By checking the definition of DAG interpolants, it can be verified that every interpolantsolving the problem (V, E, en, ex), L E , L V is also a solution of the linear <strong>Horn</strong> clauses.5.5 Disjunctive Interpolants [30]Disjunctive interpolants were introduced in [30] as a generalisation of tree interpolants.Disjunctive interpolants resemble tree interpolants in the sense that the relationship ofthe components of an interpolant is defined by a tree; in contrast to tree interpolants,however, this tree is an <strong>and</strong>/or-tree: branching in the tree can represent either conjunctionsor disjunctions. Disjunctive interpolants correspond to sets of body-disjoint <strong>Horn</strong>clauses; in this representation, <strong>and</strong>-branching is encoded by clauses with multiple bodyliterals (like with tree interpolants), while or-branching is interpreted as multiple clausessharing the same head symbol. For a detailed account on disjunctive interpolants, werefer the reader to [30].The solution of body-disjoint <strong>Horn</strong> clauses can be computed by solving a sequenceof tree-like sets of <strong>Horn</strong> clauses:Lemma 2. Let HC be a finite set of recursion-free body-disjoint <strong>Horn</strong> clauses. HChas a syntactic/semantic solution if <strong>and</strong> only if every maximum tree-like subset of HChas a syntactic/semantic solution.Proof. We outline direction “⇐” <strong>for</strong> syntactic solutions. <strong>Solving</strong> the tree-like subsets ofHC yields, <strong>for</strong> each relation symbol p ∈ R, a set SC p of solution constraints. A globalsolution of HC can be constructed by <strong>for</strong>ming a positive Boolean combination of theconstraints in SC p <strong>for</strong> each p ∈ R.⊓⊔Example 2. We consider a recursion-free unwinding of the <strong>Horn</strong> clauses in Fig. 2. Tomake the set of clauses body-disjoint, the clauses (6), (9), (11), (12) were duplicated,introducing primed copies of all relation symbols involved. The clauses are not headdisjoint,since (10) <strong>and</strong> (11) share the same head symbol: