Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

An Efficient Cyclic Entailment Procedure in a Fragment of Separation Logic

(authored by agents unless marked 🧑) Tag: le2022efficient, paper

purpose and scope

S2SLin decides quantifier-free entailments in SHLIDe, a fragment of separation logic with compositional inductive predicates and pure properties. The paper’s abstract states, “In this paper, we present a decision procedure that can derive cyclic entailment proofs for general inductive predicates in polynomial time.” (Abstract, p. 1). The introduction qualifies the claim: “we show that our procedure runs in polynomial time when the maximum number of fields of data structures is bounded by a constant” (Introduction, p. 2). The §2.1 examples are nested lists, skip lists, a transitive list, a sorted list lls, and binary trees (pp. 4–5); the abstract and introduction (pp. 1–2) also name binary search trees, but no binary-search-tree predicate is defined in the paper body. The procedure avoids backtracking: its normalized rules are such that “unfolding of inductive predicates in the RHS always produces one disjunct” (Introduction, p. 2).

The input is ∆a ⊢ ∆c, where both formulas are quantifier-free symbolic heaps with pure constraints and the free variables of the consequent are drawn from the antecedent plus null (§3, p. 5). Entailment means every stack and heap satisfying ∆a also satisfies ∆c.

technique 1: SHLIDe predicate discipline

Use SHLIDe when inductive predicates can be expressed as connected compositional segments with local data properties. A predicate has a root and segment endpoint, optional border/reference parameters, transitivity data, and ordering parameters (§2.1, pp. 3–4). Three conditions constrain definitions (§2.1, p. 4): in the recursive rule the points-to fields p̄ are null together with the existential variables Z̄ (C1; the paper says “If two variables points to the same heap, their content must be the same”, and its even-length list ell violates it); the matrix heap is a *-composition of nested predicates Q(Z,Ū) rooted at fields of the root cell, which gives connectivity and establishment (C2); and there is no mutual recursion (C3). The recursive clause carries the guard r≠F. Examples in the paper define ll, nested nll, skip-list skl1–skl3, tree, a transitive list lla, and sorted list lls (§2.1, pp. 4–5).

Inference: reading the conditions as a recipe, one would (1) write a base clause emp ∧ r=F and a recursive clause with guard r≠F, (2) ensure the recursive and nested roots are fields of the root cell, (3) compose nested predicates only through such fields, (4) avoid mutual recursion, and (5) add ordering or transitivity parameters for pure properties. Inference: a Verus encoding would use recursive ghost predicates or spec fn definitions over a mathematical sequence/tree and separately prove that the Rust representation satisfies C1–C3; the paper has no Verus encoding.

technique 2: exclude-the-middle normalization

Unfolding an inductive predicate in the consequent normally creates a disjunction (base versus recursive case); the abstract says other procedures “run exponentially in time as their proof search requires back-tracking to deal with disjunction in the consequent”. S2SLin first puts the antecedent into normal form (Definition 3, §4.1, p. 9). A normal form requires, for every spatial atom, its guard (E≠F for a predicate, true for a points-to) and E≠null; pairwise disequalities between roots of different atoms; no equality E1=E2 and no E≠E in the pure part; and satisfiable arithmetic.

The ExM rule (Fig. 2, p. 9) adds E1=E2 in one premise and E1≠E2 in the other, and both premises keep the same consequent ∆'; for a predicate P(E,F,...) it separates the base case E=F from the recursive case E≠F. The paper illustrates the idea with Smallfoot’s Case 1 (§3.1, p. 6): x↦c(z) * ∆ ⊢ ll(x,y) * ∆' is reduced to two premises, one with x=y and one with x≠y, instead of unfolding ll into a disjunction; S2SLin generalizes this by LHS unfolding plus backlinks (its example e2: ll(x,z) * ∆ ⊢ ll(x,null) * ∆', §3.1, p. 6). Normalization rules Subst, =L, 6=null, and 6=* propagate substitutions and distinctness; Figure 2 gives their premises and side conditions (§4.1, p. 9).

Steps: (1) exhaustively apply normalization rules to a leaf, (2) split root/segment equality with ExM, (3) substitute equal variables, (4) derive non-null and unequal-root facts, and (5) continue only after the leaf is in normal form. Inference: in Verus, analogous case splits are Rust/ghost if branches plus assert facts; there is no built-in normalization engine, so this would be a proof library rather than a direct annotation.

A proof tree has leaves that are closed (valid by an axiom, invalid, or linked back) or open; a pre-proof has only valid or linked-back leaves. A backlink connects a bud to an ancestor companion under a substitution. A pre-proof is a cyclic proof if, for every infinite path, some tail has a trace with infinitely many progressing points (Definitions 1–2, §3.2, p. 7); the paper’s intuitive form is that for every backlink some predicate in the companion has a subterm predicate in the bud. Theorem 3.1 (soundness of cyclic proofs) is cited from Brotherston et al. [5], not proved here. The paper explains, “if every cycle contains an unfolding of some inductive predicate, then that predicate is infinitely often reduced into a strictly ‘smaller’ predicate” (Introduction, p. 2).

The algorithm ω-ENT is explicit (Fig. 1, §4.1, p. 8): (1) initialize the root and reset unfolding numbers; (2) inspect an open leaf with is closed; (3) return valid if all leaves are closed valid/backlinked; (4) return invalid if a normal-form leaf has no applicable rule or violates a structural condition; (5) otherwise try link back; (6) if no backlink exists, apply the selected rule and repeat. For each leaf, is closed tries normalization rules first, then axiom rules (Emp, Inconsistency, Id), then reduction rules (p. 8; Fig. 3, p. 10). LInd unfolds a left-hand inductive predicate and increments its unfolding number, choosing the occurrence with the greatest unfolding number; RInd unfolds a right-hand predicate against a matching points-to on the left; LBase and RBase replace a predicate whose root equals its segment endpoint by its base case. The paper’s worked proof of lls(x,null,mi,ma) ⊢ llb(x,null,mi) applies LInd, ExM, Subst, LBase, RInd, RBase, Hypothesis, 6=*, *, and a backlink [x/X, mi/m′] (Fig. 4, p. 12, and §4.2, pp. 12–13).

Inference (Verus form; not in the paper): a cyclic proof could be represented by a recursive proof fn whose decreasing argument is a sequence/tree measure, with decreases proving progress; each backlink would become a recursive lemma call under a substituted ghost state. The algorithm’s finite-tree construction would then need to generate ordinary recursive lemmas rather than arbitrary cyclic graphs.

technique 4: soundness, completeness, and complexity boundary

Each inference rule is locally sound (Lemma 5.2). The paper argues that every generated backlink contains a pair of predicate occurrences in a subterm relationship, so the global soundness condition holds (Lemma 5.3, p. 13; proofs are in the appendix). Termination (Lemma 5.4, p. 14) rests on rule * generating only finitely many equivalence classes of entailments under substitution. Lemma 5.5 (unfolding number k satisfies 0 ≤ k ≤ 2, p. 14) is used for the complexity bound. Completeness: Proposition 5.10 says “If ω-ENT is stuck, the input is invalid”, and Theorem 5.11 states that QF ENT-SLLIN is decidable (p. 15).

The complexity proposition is O(n × 2^m + n^3), where n is the maximum number of predicates/points-to predicates in the input and definitions and m is the maximum number of data-structure fields (Proposition 5.6, p. 14). Thus it is polynomial when m is a fixed constant. Inference: the bound holds only under the SHLIDe restrictions; it is not a complexity claim for arbitrary separation logic.

evidence and numerical audit

The OCaml prototype was evaluated on SL-COMP 2022 with 296 qf_shls_entl problems (122 invalid, 174 valid), 60 qf_shlid_entl problems (24 invalid, 36 valid), and 27 new qf_shlid2_entl problems (14 invalid, 13 valid), for 383 problems in the three divisions (Experiment settings, §6, p. 15). The third division was introduced by the authors (“we introduce new benchmarks, with 27 problems”). Compared tools were CyclistSL, Spen, Songbird, SLS, and Harrsh; Cycomp was excluded because the benchmarks are beyond its decidable fragment (p. 15). Table 1 (p. 16) reports S2SLin correct outputs of 122/122 invalid and 174/174 valid in the first division, 24/24 and 36/36 in the second, and 14/14 and 13/13 in the third, with times 6.22 s, 0.96 s, and 1.20 s (Table 1, p. 16). These sum to 8.38 s, matching the text’s total (p. 16).

The text says “Of 569 tests” CyclistSL handled 85 (15%), Harrsh 215 (38%), and Songbird 235 (41.3%) (§6, p. 16; CPU timeout 600 s, p. 16). Inference: the 569 denominator does not match the 383 problems in the three divisions, and the paper does not explain it; the numerators 85, 215, and 235 do match the Table 1 sums, so 569 is probably an error. The text also says that of 223 valid tests Songbird decided 222 (99.5%); the 223 matches the valid counts (174+36+13), but Table 1 gives Songbird 174+35+12 = 221 valid. The text’s tool totals of 324 min (Songbird) and 635 min (Harrsh) are also 1 min below the Table 1 sums (325m14s and 636m00s). The paper says, “In general, the experimental results show that S2SLin is the one (and only one) that could produce all the correct results.” (Experiment results, §6, p. 16). Results are on an Intel Core i7-6700 CPU (3.4 GHz) machine with 8 GB RAM; the benchmark statuses are treated as ground truth. The paper states that all problems “semantically belongs to our decidable fragment” and acknowledges the objection that S2SLin “performed well because the entailments in the experiments are within its scope”. Inference: the evidence therefore covers the SHLIDe-compatible benchmark set, not arbitrary heap programs.

techniques for the catalog

  • SHLIDe predicate restrictions — constrain compositional recursive heaps so entailment is decidable
  • exclude-the-middle normalization — split endpoint equality and normalize heaps without RHS disjunctions
  • cyclic backlinks — close inductive proof branches by linking smaller unfolded predicates to ancestors
  • ω-ENT search — iterate normalization, axioms, backlinks, and reduction rules until valid or invalid
  • local-to-global soundness — require each backlink to contain a progressing subterm unfolding
  • bounded-field complexity — obtain O(n × 2^m + n^3) and polynomial time for constant field bound

Last edited: