[proofs] Alethe: Translate FACTORING rule (#7398)
authorLachnitt <lachnitt@stanford.edu>
Fri, 22 Oct 2021 19:00:52 +0000 (12:00 -0700)
committerGitHub <noreply@github.com>
Fri, 22 Oct 2021 19:00:52 +0000 (19:00 +0000)
Implementation of the translation of FACTORING rules into the Alethe calculus.

Co-authored-by: Haniel Barbosa <hanielbbarbosa@gmail.com>
src/proof/alethe/alethe_post_processor.cpp

index 7bdc15c05ac391ed67c3406637fa825589b8f62d..920ca7dcb84045b0b24af5d82c70430c2d93c37a 100644 (file)
@@ -728,6 +728,38 @@ bool AletheProofPostprocessCallback::update(Node res,
                            {},
                            *cdp);
     }
+    // ======== Factoring
+    // See proof_rule.h for documentation on the FACTORING rule. This comment
+    // uses variable names as introduced there.
+    //
+    // If C2 = (or F1 ... Fn) but C1 != (or C2 ... C2), then VC2 = (cl F1 ...
+    // Fn) Otherwise, VC2 = (cl C2).
+    //
+    //    P
+    // ------- DUPLICATED_LITERALS
+    //   VC2*
+    //
+    // * the corresponding proof node is C2
+    case PfRule::FACTORING:
+    {
+      if (res.getKind() == kind::OR)
+      {
+        for (const Node& child : children[0])
+        {
+          if (child != res)
+          {
+            return addAletheStepFromOr(
+                AletheRule::DUPLICATED_LITERALS, res, children, {}, *cdp);
+          }
+        }
+      }
+      return addAletheStep(AletheRule::DUPLICATED_LITERALS,
+                           res,
+                           nm->mkNode(kind::SEXPR, d_cl, res),
+                           children,
+                           {},
+                           *cdp);
+    }
     default:
     {
       return addAletheStep(AletheRule::UNDEFINED,