From HandWiki

In mathematical logic, proof compression by RecycleUnits[1] is a method for compressing propositional logic resolution proofs. Its main idea is to make use of intermediate (e.g. non input) proof results being unit clauses, i.e. clauses containing only one literal. Certain proof nodes can be replaced with the nodes representing these unit clauses. After this operation the obtained graph is transformed into a valid proof. The output proof is shorter than the original while being equivalent or stronger.


The algorithms treat resolution proofs as directed acyclic graphs, where each node is labeled by a clause and each node has either one or two predecessors called parents. If a node has two parents it is also labeled with a propositional variable called the pivot, which was used to compute the nodes clause using resolution.
The following algorithm describes the replacement of nodes.
It is assumed that in the resolution proof for all non leaf nodes with two parent nodes, the left parent node contains the positive and the right parent node the negative pivot variable. The algorithm first iterates over all non leaf unit clauses and then over all non ancestor nodes of the proof. If the node's pivot element is the variable of the present unit clause's literal, one of the parent nodes can be replaced by the node corresponding to the unit clause. Because of the above assumption, if the literal is equal to the pivot, the left parent contains the literal and can be replaced by the unit clause node. If the literal is equal to the negation of the pivot the right parent is replaced.

1  function RecycleUnits(Proof [math]\displaystyle{ P }[/math]):
2      Let [math]\displaystyle{ U }[/math] be the set of non leaf nodes representing unit clauses
3      for each [math]\displaystyle{ u \in U }[/math] do
4          Mark the ancestors of u
5          for each unmarked [math]\displaystyle{ n \in P }[/math] do
6              let [math]\displaystyle{ p }[/math] be the pivot variable of [math]\displaystyle{ n }[/math]
7              let [math]\displaystyle{ l }[/math] be the literal contained in the clause of [math]\displaystyle{ u }[/math]
8              if [math]\displaystyle{ p == l }[/math] then
9                  replace the left parent of [math]\displaystyle{ n }[/math] with [math]\displaystyle{ u }[/math]
10             else if [math]\displaystyle{ \neg p == l }[/math] then
11                 replace the right parent of [math]\displaystyle{ n }[/math] with [math]\displaystyle{ u }[/math]

In general after execution of this function the proof won't be a legal proof anymore. The following algorithm takes the root node of a proof and constructs a legal proof out of it. The computation begins with recursively calls to the children nodes. In order to minimize the algorithm calls, it is beingt kept track of which nodes were already visited. Note that a resolution proof can be seen as a general directed acyclic graph as opposed to a tree. After the recursive call the clause of the present node is updated. While doing so four different cases can occur. The present pivot variable can occur in both, the left, the right or in none of the parent nodes. If it occurs in both parent nodes the clause is calculated as resolvent of the parent clauses. If it is not present in one of the parent nodes the clause of this parent can be copied. If it misses in both parents one has to choose heuristically.

1  function ReconstructProof(Node [math]\displaystyle{ n }[/math]):
3      if [math]\displaystyle{ n }[/math] is visited return
4      mark [math]\displaystyle{ n }[/math] as visited
5      if [math]\displaystyle{ n }[/math] has no parents return
6      else if [math]\displaystyle{ n }[/math] has only one parent [math]\displaystyle{ x }[/math] then
7          ReconstructProof([math]\displaystyle{ x }[/math])
8          [math]\displaystyle{ n }[/math].Clause = [math]\displaystyle{ x }[/math].Clause
9      else
10         let [math]\displaystyle{ l }[/math] be the left and [math]\displaystyle{ r }[/math] the right parent node
11         let [math]\displaystyle{ p }[/math] be the pivot variable used to compute [math]\displaystyle{ n }[/math]
12         ReconstructProof([math]\displaystyle{ l }[/math])
13         ReconstructProof([math]\displaystyle{ r }[/math])
14         if [math]\displaystyle{ p \in l.Clause }[/math] and [math]\displaystyle{ p \in r.Clause }[/math]
15             [math]\displaystyle{ n }[/math].Clause = Resolve([math]\displaystyle{ l }[/math],[math]\displaystyle{ r }[/math],[math]\displaystyle{ p }[/math])
16         else if [math]\displaystyle{ p \in l.Clause }[/math] and [math]\displaystyle{ p \notin r.Clause }[/math]
17             [math]\displaystyle{ n }[/math].Clause = [math]\displaystyle{ r }[/math].Clause
18             delete reference to [math]\displaystyle{ l }[/math]
19         else if [math]\displaystyle{ p \in r.Clause }[/math] and [math]\displaystyle{ p \notin l.Clause }[/math]
20             [math]\displaystyle{ n }[/math].Clause = [math]\displaystyle{ l }[/math].Clause
21             delete reference to [math]\displaystyle{ r }[/math]
22         else
23             let [math]\displaystyle{ x \in \{l,r\} }[/math] and [math]\displaystyle{ y \in \{l,r\} \setminus \{x\} }[/math] //choose x heuristically
24             [math]\displaystyle{ n }[/math].Clause = [math]\displaystyle{ x }[/math].Clause
25             delete reference to [math]\displaystyle{ y }[/math]


Consider the following resolution proof.
One intermediate result is [math]\displaystyle{ C_8 }[/math] which is representing the unit clause (-1).

[math]\displaystyle{ (1)\cfrac{ (2)\cfrac{ (1)\cfrac{C_1 (1,3)\qquad C_2 (-1,2,5)}{C_3 (2,3,5)} \qquad C_4 (1,-2) } {C_7 (1,3,5)} \qquad (4)\cfrac{C_5 (-1,4) \qquad C_6 (-1,-4)}{\color{red}C_8 (-1)} } { C_9 (3,5) } }[/math]

There is one non-ancestor node using the variable 1 as a pivot element: [math]\displaystyle{ C_3 }[/math].

[math]\displaystyle{ (1)\cfrac{ (2)\cfrac{ {\color{red}(1)}\cfrac{C_1 (1,3)\qquad C_2 (-1,2,5)}{C_3 (2,3,5)} \qquad C_4 (1,-2) } {C_7 (1,3,5)} \qquad (4)\cfrac{C_5 (-1,4) \qquad C_6 (-1,-4)}{C_8 (-1)} } { C_9 (3,5) } }[/math]

The literal -1 is contained in the right parent of this node and therefore this parent is replaced by [math]\displaystyle{ C_8 }[/math]. The string [math]\displaystyle{ {C_8}^* }[/math] denotes a reference to the clause [math]\displaystyle{ C_8 }[/math] (the structure is now a directed acyclic graph rather than a tree).

[math]\displaystyle{ (1)\cfrac{ (2)\cfrac{ (1)\cfrac{C_1 (1,3)\qquad {\color{red} {C_8}^*}}{C_3 (2,3,5)} \qquad C_4 (1,-2) } {C_7 (1,3,5)} \qquad (4)\cfrac{C_5 (-1,4) \qquad C_6 (-1,-4)}{C_8 (-1)} } { C_9 (3,5) } }[/math]

This structure is not a legal proof anymore, because [math]\displaystyle{ C_3 }[/math] is not the resolvent of [math]\displaystyle{ C_1 }[/math] and [math]\displaystyle{ C_8 }[/math]. Therefore it has to be transformed into one again.
The first step is to update [math]\displaystyle{ C_3 }[/math]. As the pivot variable 1 appears in both parent nodes, [math]\displaystyle{ C_3 }[/math] is computed as the resolvent of them.

[math]\displaystyle{ (1)\cfrac{ (2)\cfrac{ (1)\cfrac{C_1 (1,3)\qquad {C_8}^*}{C_3 {\color{red}(3)}} \qquad C_4 (1,-2) } {C_7 (1,3,5)} \qquad (4)\cfrac{C_5 (-1,4) \qquad C_6 (-1,-4)}{C_8 (-1)} } { C_9 (3,5) } }[/math]

The left parent node of [math]\displaystyle{ C_7 }[/math] does not contain the pivot variable and therefore the clause of this parent is copied into the clause of [math]\displaystyle{ C_7 }[/math]. The link between [math]\displaystyle{ C_7 }[/math] and [math]\displaystyle{ C_4 }[/math] is removed and since there are no other links to [math]\displaystyle{ C_4 }[/math] this node can be deleted.

[math]\displaystyle{ (1)\cfrac{ \cfrac{ (1)\cfrac{C_1 (1,3)\qquad {C_8}^*}{C_3 (3)} } {C_7 {\color{red}(3)}} \qquad (4)\cfrac{C_5 (-1,4) \qquad C_6 (-1,-4)}{C_8 (-1)} } { C_9 (3,5) } }[/math]

Again the left parent of [math]\displaystyle{ C_9 }[/math] does not contain the pivot variable and the same operation is performed as before.

[math]\displaystyle{ \cfrac{ \cfrac{ (1)\cfrac{C_1 (1,3)\qquad (4)\cfrac{C_5 (-1,4) \qquad C_6 (-1,-4)}{C_8 (-1)}}{C_3 (3)} } {C_7 (3)} } { C_9 {\color{red}(3)} } }[/math]

Note: the reference [math]\displaystyle{ {C_8}^* }[/math] was replaced by the actual proof node [math]\displaystyle{ C_8 }[/math].
The result of this proof is the unit clause (3) which is a stronger result than the clause (3,5) of the original proof.


  1. Bar-Ilan, O.; Fuhrmann, O.; Hoory, S.; Shacham, O.; Strichman, O. Linear-time Reductions of Resolution Proofs. Hardware and Software: Verification and Testing, p. 114–128, Springer, 2011.