LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/arith - arith_preprocess.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 6 27 22.2 %
Date: 2024-09-25 12:15:45 Functions: 2 4 50.0 %
Branches: 0 8 0.0 %

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Andrew Reynolds, Mathias Preiner, Andres Noetzli
       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                 :            :  * Arithmetic preprocess.
      14                 :            :  */
      15                 :            : 
      16                 :            : #include "theory/arith/arith_preprocess.h"
      17                 :            : 
      18                 :            : #include "theory/arith/inference_manager.h"
      19                 :            : #include "theory/skolem_lemma.h"
      20                 :            : 
      21                 :            : namespace cvc5::internal {
      22                 :            : namespace theory {
      23                 :            : namespace arith {
      24                 :            : 
      25                 :      49223 : ArithPreprocess::ArithPreprocess(Env& env,
      26                 :            :                                  InferenceManager& im,
      27                 :            :                                  ProofNodeManager* pnm,
      28                 :      49223 :                                  OperatorElim& oe)
      29                 :      49223 :     : EnvObj(env), d_im(im), d_opElim(oe), d_reduced(userContext())
      30                 :            : {
      31                 :      49223 : }
      32                 :     836073 : TrustNode ArithPreprocess::eliminate(TNode n,
      33                 :            :                                      std::vector<SkolemLemma>& lems,
      34                 :            :                                      bool partialOnly)
      35                 :            : {
      36                 :     836073 :   return d_opElim.eliminate(n, lems, partialOnly);
      37                 :            : }
      38                 :            : 
      39                 :          0 : bool ArithPreprocess::reduceAssertion(TNode atom)
      40                 :            : {
      41                 :          0 :   context::CDHashMap<Node, bool>::const_iterator it = d_reduced.find(atom);
      42         [ -  - ]:          0 :   if (it != d_reduced.end())
      43                 :            :   {
      44                 :            :     // already computed
      45                 :          0 :     return (*it).second;
      46                 :            :   }
      47                 :          0 :   std::vector<SkolemLemma> lems;
      48                 :          0 :   TrustNode tn = eliminate(atom, lems);
      49         [ -  - ]:          0 :   for (const SkolemLemma& lem : lems)
      50                 :            :   {
      51                 :          0 :     d_im.trustedLemma(lem.d_lemma, InferenceId::ARITH_PP_ELIM_OPERATORS_LEMMA);
      52                 :            :   }
      53         [ -  - ]:          0 :   if (tn.isNull())
      54                 :            :   {
      55                 :            :     // did not reduce
      56                 :          0 :     d_reduced[atom] = false;
      57                 :          0 :     return false;
      58                 :            :   }
      59                 :          0 :   Assert(tn.getKind() == TrustNodeKind::REWRITE);
      60                 :            :   // tn is of kind REWRITE, turn this into a LEMMA here
      61                 :          0 :   TrustNode tlem = TrustNode::mkTrustLemma(tn.getProven(), tn.getGenerator());
      62                 :            :   // send the trusted lemma
      63                 :          0 :   d_im.trustedLemma(tlem, InferenceId::ARITH_PP_ELIM_OPERATORS);
      64                 :            :   // mark the atom as reduced
      65                 :          0 :   d_reduced[atom] = true;
      66                 :          0 :   return true;
      67                 :            : }
      68                 :            : 
      69                 :          0 : bool ArithPreprocess::isReduced(TNode atom) const
      70                 :            : {
      71                 :          0 :   context::CDHashMap<Node, bool>::const_iterator it = d_reduced.find(atom);
      72         [ -  - ]:          0 :   if (it == d_reduced.end())
      73                 :            :   {
      74                 :          0 :     return false;
      75                 :            :   }
      76                 :          0 :   return (*it).second;
      77                 :            : }
      78                 :            : 
      79                 :            : }  // namespace arith
      80                 :            : }  // namespace theory
      81                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14