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: 11 16 68.8 %
Date: 2026-04-25 10:46:27 Functions: 2 2 100.0 %
Branches: 3 6 50.0 %

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

Generated by: LCOV version 1.14