LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/bags - infer_info.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 19 42 45.2 %
Date: 2026-04-04 10:40:52 Functions: 3 7 42.9 %
Branches: 3 18 16.7 %

           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 inference information utility.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "theory/bags/infer_info.h"
      14                 :            : 
      15                 :            : #include "theory/bags/inference_manager.h"
      16                 :            : #include "theory/inference_manager_buffered.h"
      17                 :            : 
      18                 :            : namespace cvc5::internal {
      19                 :            : namespace theory {
      20                 :            : namespace bags {
      21                 :            : 
      22                 :      77482 : InferInfo::InferInfo(InferenceManagerBuffered* im, InferenceId id)
      23                 :      77482 :     : TheoryInference(id), d_im(im)
      24                 :            : {
      25                 :      77482 : }
      26                 :            : 
      27                 :      77482 : TrustNode InferInfo::processLemma(CVC5_UNUSED LemmaProperty& p)
      28                 :            : {
      29                 :      77482 :   Node lemma = getLemma();
      30                 :            : 
      31         [ +  - ]:      77482 :   Trace("bags::InferInfo::process") << (*this) << std::endl;
      32                 :      77482 :   d_im->addPendingLemma(lemma, getId());
      33                 :     154964 :   return TrustNode::mkTrustLemma(lemma, nullptr);
      34                 :      77482 : }
      35                 :            : 
      36                 :      77482 : Node InferInfo::getLemma() const
      37                 :            : {
      38                 :      77482 :   NodeManager* nm = d_im->getNodeManager();
      39                 :      77482 :   std::vector<Node> nodes;
      40                 :      77482 :   Node premises = nm->mkAnd(d_premises);
      41                 :     154964 :   Node lemma = nm->mkNode(Kind::IMPLIES, premises, d_conclusion);
      42                 :      77482 :   nodes.push_back(lemma);
      43                 :            :   // send lemmas corresponding to the skolems introduced
      44         [ -  + ]:      77482 :   for (const auto& pair : d_skolems)
      45                 :            :   {
      46                 :          0 :     Node n = pair.first.eqNode(pair.second);
      47                 :          0 :     nodes.push_back(n);
      48                 :          0 :   }
      49         [ +  - ]:      77482 :   if (nodes.size() == 1)
      50                 :            :   {
      51                 :      77482 :     return lemma;
      52                 :            :   }
      53                 :          0 :   return nm->mkNode(Kind::AND, nodes);
      54                 :      77482 : }
      55                 :            : 
      56                 :          0 : bool InferInfo::isTrivial() const
      57                 :            : {
      58                 :          0 :   Assert(!d_conclusion.isNull());
      59 [ -  - ][ -  - ]:          0 :   return d_conclusion.isConst() && d_conclusion.getConst<bool>();
      60                 :            : }
      61                 :            : 
      62                 :          0 : bool InferInfo::isConflict() const
      63                 :            : {
      64                 :          0 :   Assert(!d_conclusion.isNull());
      65 [ -  - ][ -  - ]:          0 :   return d_conclusion.isConst() && !d_conclusion.getConst<bool>();
      66                 :            : }
      67                 :            : 
      68                 :          0 : bool InferInfo::isFact() const
      69                 :            : {
      70                 :          0 :   Assert(!d_conclusion.isNull());
      71                 :            :   TNode atom =
      72         [ -  - ]:          0 :       d_conclusion.getKind() == Kind::NOT ? d_conclusion[0] : d_conclusion;
      73                 :          0 :   return !atom.isConst() && atom.getKind() != Kind::OR;
      74                 :          0 : }
      75                 :            : 
      76                 :          0 : std::ostream& operator<<(std::ostream& out, const InferInfo& ii)
      77                 :            : {
      78                 :          0 :   out << "(infer ;id " << std::endl << ii.getId() << std::endl;
      79                 :          0 :   out << ";conclusion " << std::endl << ii.d_conclusion << std::endl;
      80         [ -  - ]:          0 :   if (!ii.d_premises.empty())
      81                 :            :   {
      82                 :          0 :     out << " ;premise" << std::endl << ii.d_premises << std::endl;
      83                 :            :   }
      84                 :          0 :   out << ";skolems " << ii.d_skolems << std::endl;
      85                 :          0 :   out << ")";
      86                 :          0 :   return out;
      87                 :            : }
      88                 :            : 
      89                 :            : }  // namespace bags
      90                 :            : }  // namespace theory
      91                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14