LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/preprocessing/passes - ff_disjunctive_bit.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 10 14 71.4 %
Date: 2024-12-24 13:19:25 Functions: 2 2 100.0 %
Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Alex Ozdemir
       4                 :            :  *
       5                 :            :  * This file is part of the cvc5 project.
       6                 :            :  *
       7                 :            :  * Copyright (c) 2009-2024 by the authors listed in the file AUTHORS
       8                 :            :  * in the top-level source directory and their institutional affiliations.
       9                 :            :  * All rights reserved.  See the file COPYING in the top-level source
      10                 :            :  * directory for licensing information.
      11                 :            :  * ****************************************************************************
      12                 :            :  *
      13                 :            :  * replace disjunctive bit constraints with polynomial bit constraints
      14                 :            :  *
      15                 :            :  * example: x = 0 OR x = 1 becomes x * x = x
      16                 :            :  */
      17                 :            : 
      18                 :            : #include "preprocessing/passes/ff_disjunctive_bit.h"
      19                 :            : 
      20                 :            : // external includes
      21                 :            : 
      22                 :            : // std includes
      23                 :            : 
      24                 :            : // internal includes
      25                 :            : #include "preprocessing/assertion_pipeline.h"
      26                 :            : #include "theory/ff/parse.h"
      27                 :            : 
      28                 :            : namespace cvc5::internal {
      29                 :            : namespace preprocessing {
      30                 :            : namespace passes {
      31                 :            : 
      32                 :      50591 : FfDisjunctiveBit::FfDisjunctiveBit(PreprocessingPassContext* preprocContext)
      33                 :      50591 :     : PreprocessingPass(preprocContext, "ff-disjunctive-bit")
      34                 :            : {
      35                 :      50591 : }
      36                 :            : 
      37                 :      36520 : PreprocessingPassResult FfDisjunctiveBit::applyInternal(
      38                 :            :     AssertionPipeline* assertionsToPreprocess)
      39                 :            : {
      40                 :      36520 :   auto nm = nodeManager();
      41         [ +  + ]:     595643 :   for (uint64_t i = 0, n = assertionsToPreprocess->size(); i < n; ++i)
      42                 :            :   {
      43                 :    1118250 :     Node fact = (*assertionsToPreprocess)[i];
      44                 :    1118250 :     std::optional<Node> var = theory::ff::parse::disjunctiveBitConstraint(fact);
      45         [ -  + ]:     559123 :     if (var.has_value())
      46                 :            :     {
      47         [ -  - ]:          0 :       Trace("ff::disjunctive-bit") << "rw bit constr: " << *var << std::endl;
      48                 :          0 :       Node var2 = nm->mkNode(Kind::FINITE_FIELD_MULT, *var, *var);
      49                 :          0 :       assertionsToPreprocess->replace(i,
      50                 :          0 :                                       var2.eqNode(*var),
      51                 :            :                                       nullptr,
      52                 :            :                                       TrustId::PREPROCESS_FF_DISJUNCTIVE_BIT);
      53                 :            :     }
      54                 :            :   }
      55                 :      36520 :   return PreprocessingPassResult::NO_CONFLICT;
      56                 :            : }
      57                 :            : 
      58                 :            : }  // namespace passes
      59                 :            : }  // namespace preprocessing
      60                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14