Skip to main content

Lecture 7: Non-Ground Superposition

Laura Kovács and Andrei Voronkov

Unification and Lifting (Recap)​

Idea (Robinson 1965; Bachmair & Ganzinger 1990). Represent an infinite number of ground inferences by a single non-ground inference.

  • For BR\mathbb{BR} we work with non-ground clauses.
  • We generalize “same” ground atom to unifiability of non-ground atoms.
  • We compute only most general unifiers (mgus).

Lifting Lemma for BR\mathbb{BR}. Let CC and DD be clauses that share no variables. If there is a ground inference

Cσ1Dσ2C′(ground BR),\frac{C\sigma_1 \qquad D\sigma_2}{C'}(\text{ground }\mathbb{BR}),

then there exists a substitution σ\sigma such that

CDC′′(non-ground BR)\frac{C \qquad D}{C''}(\text{non-ground }\mathbb{BR})

and C′=C′′σC' = C''\sigma.
Similar lifting lemmas hold for every inference in BR\mathbb{BR} and Sup\mathbb{S}\mathrm{up}.

What Should We Lift?​

  • Ordering ≻\succ.
  • Selection function σ\sigma.
  • Calculus Supsat\mathbb{S}\mathrm{up}^{\mathrm{sat}} (thanks to the lifting lemmas).

Most importantly, lifting requires solving equations s=ts = t between terms and atoms, which we do via most general unifiers.

Knuth-Bendix Ordering (Ground Case Recap)​

Fix a signature Σ\Sigma, inducing the term algebra TA⁡(Σ)\operatorname{TA}(\Sigma), together with:

  • A total ordering ≫\gg on Σ\Sigma (the precedence);
  • A weight function w:Σ→Nw : \Sigma \to \mathbb{N}.

For a ground term t=g(t1,…,tn)t = g(t_1,\ldots,t_n) its weight is

∣g(t1,…,tn)∣=w(g)+∑i=1n∣ti∣.|g(t_1,\ldots,t_n)| = w(g) + \sum_{i=1}^n |t_i|.

The Knuth-Bendix ordering ≻KB\succ_\text{KB} compares ground terms as follows: g(t1,…,tn)≻KBh(s1,…,sm)g(t_1,\ldots,t_n) \succ_\text{KB} h(s_1,\ldots,s_m) iff

  1. ∣g(t1,…,tn)∣>∣h(s1,…,sm)∣|g(t_1,\ldots,t_n)| > |h(s_1,\ldots,s_m)| (by weight); or
  2. ∣g(t1,…,tn)∣=∣h(s1,…,sm)∣|g(t_1,\ldots,t_n)| = |h(s_1,\ldots,s_m)| and one of the following holds:
    • g≫hg \gg h (by precedence);
    • g=hg = h and, for some 1≤i≤n1 \leq i \leq n, t1=s1,…,ti−1=si−1t_1 = s_1,\ldots,t_{i-1} = s_{i-1} and ti≻KBsit_i \succ_\text{KB} s_i (lexicographically, left-to-right).

Note. Weight functions ww are not arbitrary—they must be compatible with ≫\gg.

Weight Functions: Ground Case​

A weight function w:Σ→Nw : \Sigma \to \mathbb{N} satisfies:

  • w(a)>0w(a) > 0 for every constant a∈Σa \in \Sigma;
  • If w(f)=0w(f) = 0 for a unary function f∈Σf \in \Sigma, then f≫gf \gg g for all g≠fg \neq f (so ff is the greatest symbol in the precedence).

Weight Functions: Non-Ground Case​

For non-ground terms extend ww to variables: w:Σ∪Vars→Nw : \Sigma \cup \mathrm{Vars} \to \mathbb{N}, where Vars\mathrm{Vars} denotes the variables. We require:

  • w(x)=v0w(x) = v_0 for all variables xx, with v0>0v_0 > 0;
  • w(a)≥v0w(a) \geq v_0 for every constant a∈Σa \in \Sigma;
  • If w(f)=0w(f) = 0 for a unary function f∈Σf \in \Sigma, then f≫gf \gg g for all g≠fg \neq f.

Consequently, at most one unary function can have weight 00. Given a term ss and variable xx, we write #(x,s)\#(x,s) for the number of occurrences of xx in ss.

Knuth-Bendix Ordering (Non-Ground Case)​

Let w:Σ∪Vars→Nw : \Sigma \cup \mathrm{Vars} \to \mathbb{N} be as above. For terms ss and tt,

  • s≻KBts \succ_\text{KB} t if #(x,s)≥#(x,t)\#(x,s) \geq \#(x,t) for every variable xx and ∣s∣>∣t∣|s| > |t| (by weight); or
  • #(x,s)≥#(x,t)\#(x,s) \geq \#(x,t) for every xx, ∣s∣=∣t∣|s| = |t|, and one of the following holds:
    • t=xt = x and s=fn(x)s = f^n(x) for some n≥1n \geq 1;
    • s=g(t1,…,tn)s = g(t_1,\ldots,t_n), t=h(s1,…,sm)t = h(s_1,\ldots,s_m), and g≫hg \gg h (by precedence);
    • s=g(t1,…,tn)s = g(t_1,\ldots,t_n), t=g(s1,…,sn)t = g(s_1,\ldots,s_n), and for some 1≤i≤n1 \leq i \leq n we have t1=s1,…,ti−1=si−1t_1 = s_1,\ldots,t_{i-1} = s_{i-1} and ti≻KBsit_i \succ_\text{KB} s_i (lexicographically).

Selection Functions and Lifting​

If, for some grounding substitution θ\theta, the literal LθL\theta is selected in Lθ∨CθL\theta \lor C\theta, then LL is selected in L∨CL \lor C.
Therefore, if the ground selection function is well-behaved, the lifted non-ground function is well-behaved as well.

Non-Ground Superposition​

Superposition: l=r‾∨Cs[l′]=t‾∨D(s[r]=t∨C∨D)θ(Sup),l=r‾∨Cs[l′]≠t‾∨D(s[r]≠t∨C∨D)θ(Sup),\frac{\underline{l = r} \lor C \qquad \underline{s[l'] = t} \lor D}{(s[r] = t \lor C \lor D)\theta}(\text{Sup}), \qquad \frac{\underline{l = r} \lor C \qquad \underline{s[l'] \neq t} \lor D}{(s[r] \neq t \lor C \lor D)\theta}(\text{Sup}),

where

  1. θ\theta is an mgu of ll and l′l';
  2. l′l' is not a variable;
  3. rθ⪰̸lθr\theta \not\succeq l\theta;
  4. tθ⪰̸s[l′]θt\theta \not\succeq s[l']\theta.
Observations.
  • The ordering is partial, hence conditions such as rθ⪰̸lθr\theta \not\succeq l\theta.
  • These conditions are checked a posteriori (after the rule fires); still, if l≻rl \succ r then lθ≻rθl\theta \succ r\theta, which helps prune some inferences a priori.

Equality Resolution and Equality Factoring​

Equality Resolution. s≠s′‾∨CCθ(ER),\frac{\underline{s \neq s'} \lor C}{C\theta}(\text{ER}),

where θ\theta is an mgu of ss and s′s'.

Equality Factoring. l=r‾∨l′=r′∨C(l=r∨r≠r′∨C)θ(EF),\frac{\underline{l = r} \lor l' = r' \lor C}{(l = r \lor r \neq r' \lor C)\theta}(\text{EF}),

where θ\theta is an mgu of ll and l′l', rθ⪰̸lθr\theta \not\succeq l\theta, r′θ⪰̸lθr'\theta \not\succeq l\theta, and r′θ⪰̸rθr'\theta \not\succeq r\theta.

Non-Ground Binary Resolution​

  • Binary resolution: P‾∨C1¬P′‾∨C2(C1∨C2)θ(BR),\frac{\underline{P} \lor C_1 \qquad \underline{\neg P'} \lor C_2}{(C_1 \lor C_2)\theta}(\text{BR}), where θ\theta is an mgu of PP and P′P'.
  • Positive factoring: P‾∨P′‾∨C(P∨C)θ(Fact),\frac{\underline{P} \lor \underline{P'} \lor C}{(P \lor C)\theta}(\text{Fact}), where θ\theta is an mgu of PP and P′P'.
  • Negative factoring: ¬P‾∨¬P′‾∨C(¬P∨C)θ(Fact),\frac{\underline{\neg P} \lor \underline{\neg P'} \lor C}{(\neg P \lor C)\theta}(\text{Fact}), where θ\theta is an mgu of PP and P′P'.

🎬 Animation: Watch first-order resolution connect the mgu, selected literals, and resolvent.

Exercise​

Consider the clause set

¬p(z,a)∨¬p(z,x)∨¬p(x,z),p(y,a)∨p(y,f(y)),p(w,a)∨p(f(w),w),\begin{aligned} &\neg p(z,a) \lor \neg p(z,x) \lor \neg p(x,z),\\ &p(y,a) \lor p\big(y,f(y)\big),\\ &p(w,a) \lor p\big(f(w),w\big), \end{aligned}

where pp is a predicate, ff a function, x,y,z,wx,y,z,w variables, and aa a constant.

Give a refutation in the non-ground binary resolution system BR\mathbb{BR}. For every derived clause, specify the premises, the inference rule, and the mgu used.

Checking Redundancy​

Assume the current search space SS contains no redundant clauses.
A redundant clause can appear only when a new child (the conclusion of an inference) is added.

We perform two kinds of redundancy checks after each inference under a fair strategy:

  • The child itself is redundant.
  • The child makes an existing clause redundant.

We use some fair strategy and perform these checks after every inference that generates a new clause.
In fact, one can do better in some of the cases.

Subsumption (Non-Ground)​

A clause CC subsumes a clause DD if Cθ⊆DC\theta \subseteq D for some substitution θ\theta.
Subsumption and Redundancy: If SS contains different clauses CC and DD such that CC subsumes DD, then DD is redundant in SS and may be removed.

Exercise​

Let pp be a unary predicate, ff a unary function, x,yx,y variables, and cc a constant.
Consider the clauses C1=p(x)∨p(y)C_1 = p(x) \lor p(y), C2=p(x)C_2 = p(x), and D=p(f(c))D = p(f(c)).

(a) Does C1C_1 subsume DD?
(b) Does C2C_2 subsume DD?

Demodulation (Non-Ground)​

Demodulation replaces instances of equalities by simpler terms:

l=rL[l′]∨DL[rθ]∨D(Dem),\frac{l = r \qquad L[l'] \lor D}{L[r\theta] \lor D}(\text{Dem}),

where lθ=l′l\theta = l', lθ≻rθl\theta \succ r\theta, and (L[l′]∨D)≻(lθ=rθ)(L[l'] \lor D) \succ (l\theta = r\theta).
Equivalently,

l=rL[lθ]∨DL[rθ]∨D(Dem),\frac{l = r \qquad L[l\theta] \lor D}{L[r\theta] \lor D}(\text{Dem}),

with lθ≻rθl\theta \succ r\theta and (L[lθ]∨D)≻(lθ=rθ)(L[l\theta] \lor D) \succ (l\theta = r\theta).

General Redundancy (Non-Ground)​

A clause DD is redundant with respect to CC if D∗D^* is redundant with respect to C∗C^*, where D∗D^* and C∗C^* are the sets of ground instances of DD and CC.
It suffices to find a substitution θ\theta such that, for any ground instance D∗D^* of DD:

  1. D∗≻CθD^* \succ C\theta, and
  2. D∗D^* is a logical consequence of CθC\theta.

Generating vs. Simplifying Inferences​

An inference

C1…CnC\frac{C_1 \quad \ldots \quad C_n}{C}

is simplifying if at least one premise CiC_i becomes redundant after CC is added; we say CiC_i is simplified into CC. Otherwise the inference is generating.

Note. Deciding whether an inference is simplifying is undecidable (and so are several related checks).

Key principles.
  1. Apply simplifying inferences eagerly; apply generating inferences lazily.
  2. Checking for simplifying inferences must pay off—in practice, it must be cheap.

Redundancy Checking Workflow​

Whenever a new clause CC is added:

  • Retention test: Is CC redundant?
  • Forward simplification: Can CC be simplified using existing clauses?
  • Backward simplification: Does CC simplify or eliminate older clauses?

Examples of Redundancy Tests​

  • Retention:
    • Tautology checking.
    • Subsumption.
  • Simplification:
    • Demodulation (forward/backward).
    • Subsumption resolution: A∨C¬B∨DD(),¬A∨CB∨DD(),\frac{A \lor C \qquad \neg B \lor D}{D}(), \qquad \frac{\neg A \lor C \qquad B \lor D}{D}(), whenever some substitution θ\theta satisfies Aθ∨Cθ⊆B∨DA\theta \lor C\theta \subseteq B \lor D.

Cost of Redundancy Criteria​

  • Tautology checking is based on congruence closure.
  • Subsumption and subsumption resolution are NP-complete.

Observations​

  • There may be chains (repeated applications) of forward simplifications;
  • after such a chain, another retention test should be run.
  • Backward simplification is often expensive.
  • In practice, the retention test may include extra heuristics which may sacrifice completeness (e.g., dropping overly heavy clauses).