LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/quantifiers - expr_miner_manager.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 31 39 79.5 %
Date: 2026-08-03 10:34:52 Functions: 4 5 80.0 %
Branches: 10 22 45.5 %

           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                 :            :  * Implementation of expression miner manager.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "theory/quantifiers/expr_miner_manager.h"
      14                 :            : 
      15                 :            : #include "options/quantifiers_options.h"
      16                 :            : #include "smt/env.h"
      17                 :            : #include "theory/datatypes/sygus_datatype_utils.h"
      18                 :            : #include "theory/quantifiers/query_generator_sample_sat.h"
      19                 :            : #include "theory/quantifiers/query_generator_unsat.h"
      20                 :            : 
      21                 :            : namespace cvc5::internal {
      22                 :            : namespace theory {
      23                 :            : namespace quantifiers {
      24                 :            : 
      25                 :         67 : ExpressionMinerManager::ExpressionMinerManager(Env& env)
      26                 :         67 :     : EnvObj(env), d_doFilterLogicalStrength(false), d_sols(env)
      27                 :            : {
      28                 :         67 : }
      29                 :            : 
      30                 :         67 : void ExpressionMinerManager::initializeSygus(const TypeNode& tn)
      31                 :            : {
      32 [ -  + ][ -  + ]:         67 :   Assert(tn.isDatatype());
                 [ -  - ]
      33                 :         67 :   const DType& dt = tn.getDType();
      34 [ -  + ][ -  + ]:         67 :   Assert(dt.isSygus());
                 [ -  - ]
      35                 :         67 :   Node vlist = dt.getSygusVarList();
      36                 :         67 :   std::vector<Node> vars;
      37         [ +  + ]:         67 :   if (!vlist.isNull())
      38                 :            :   {
      39         [ +  + ]:        213 :     for (const Node& sv : vlist)
      40                 :            :     {
      41                 :        150 :       d_vars.push_back(sv);
      42                 :        150 :     }
      43                 :            :   }
      44                 :         67 :   if (options().quantifiers.sygusFilterSolMode
      45         [ +  - ]:         67 :       == options::SygusFilterSolMode::STRONG)
      46                 :            :   {
      47                 :         67 :     enableFilterStrongSolutions();
      48                 :            :   }
      49                 :          0 :   else if (options().quantifiers.sygusFilterSolMode
      50         [ -  - ]:          0 :            == options::SygusFilterSolMode::WEAK)
      51                 :            :   {
      52                 :          0 :     enableFilterWeakSolutions();
      53                 :            :   }
      54                 :         67 : }
      55                 :            : 
      56                 :          0 : void ExpressionMinerManager::enableFilterWeakSolutions()
      57                 :            : {
      58                 :          0 :   d_doFilterLogicalStrength = true;
      59                 :          0 :   d_sols.initialize(d_vars);
      60                 :          0 :   d_sols.setLogicallyStrong(true);
      61                 :          0 : }
      62                 :            : 
      63                 :         67 : void ExpressionMinerManager::enableFilterStrongSolutions()
      64                 :            : {
      65                 :         67 :   d_doFilterLogicalStrength = true;
      66                 :         67 :   d_sols.initialize(d_vars);
      67                 :         67 :   d_sols.setLogicallyStrong(false);
      68                 :         67 : }
      69                 :            : 
      70                 :        897 : bool ExpressionMinerManager::addTerm(Node sol)
      71                 :            : {
      72                 :            :   // set the builtin version
      73                 :        897 :   Node solb = datatypes::utils::sygusToBuiltin(sol, true);
      74                 :            : 
      75                 :        897 :   bool ret = true;
      76                 :            :   // filter based on logical strength
      77         [ +  - ]:        897 :   if (d_doFilterLogicalStrength)
      78                 :            :   {
      79                 :        897 :     std::vector<Node> filtered;
      80                 :        897 :     ret = d_sols.addTerm(solb, filtered);
      81                 :        897 :   }
      82                 :        897 :   return ret;
      83                 :        897 : }
      84                 :            : 
      85                 :            : }  // namespace quantifiers
      86                 :            : }  // namespace theory
      87                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14