LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/arith - arith_preprocess.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2026-02-27 11:41:18 Functions: 1 2 50.0 %
Branches: 0 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                 :            :  * Arithmetic preprocess.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "cvc5_private.h"
      14                 :            : 
      15                 :            : #ifndef CVC5__THEORY__ARITH__ARITH_PREPROCESS_H
      16                 :            : #define CVC5__THEORY__ARITH__ARITH_PREPROCESS_H
      17                 :            : 
      18                 :            : #include "context/cdhashmap.h"
      19                 :            : #include "smt/env_obj.h"
      20                 :            : #include "theory/arith/operator_elim.h"
      21                 :            : #include "theory/logic_info.h"
      22                 :            : 
      23                 :            : namespace cvc5::internal {
      24                 :            : namespace theory {
      25                 :            : 
      26                 :            : class SkolemLemma;
      27                 :            : 
      28                 :            : namespace arith {
      29                 :            : 
      30                 :            : class InferenceManager;
      31                 :            : class OperatorElim;
      32                 :            : 
      33                 :            : /**
      34                 :            :  * This module can be used for (on demand) elimination of extended arithmetic
      35                 :            :  * operators like div, mod, to_int, is_int, sqrt, and so on. It uses the
      36                 :            :  * operator elimination utility for determining how to reduce formulas. It
      37                 :            :  * extends that utility with the ability to generate lemmas on demand via
      38                 :            :  * the provided inference manager.
      39                 :            :  */
      40                 :            : class ArithPreprocess : protected EnvObj
      41                 :            : {
      42                 :            :  public:
      43                 :            :   ArithPreprocess(Env& env,
      44                 :            :                   InferenceManager& im,
      45                 :            :                   OperatorElim& oe);
      46                 :      49607 :   ~ArithPreprocess() {}
      47                 :            :   /**
      48                 :            :    * Call eliminate operators on formula n, return the resulting trust node,
      49                 :            :    * which is of TrustNodeKind REWRITE and whose node is the result of
      50                 :            :    * eliminating extended operators from n.
      51                 :            :    *
      52                 :            :    * @param n The node to eliminate operators from
      53                 :            :    * @param partialOnly Whether we are eliminating partial operators only.
      54                 :            :    * @return the trust node proving (= n nr) where nr is the return of
      55                 :            :    * eliminating operators in n, or the null trust node if n was unchanged.
      56                 :            :    */
      57                 :            :   TrustNode eliminate(TNode n,
      58                 :            :                       std::vector<SkolemLemma>& lems,
      59                 :            :                       bool partialOnly = false);
      60                 :            :   /**
      61                 :            :    * Reduce assertion. This sends a lemma via the inference manager if atom
      62                 :            :    * contains any extended operators. When applicable, the lemma is of the form:
      63                 :            :    *   atom == d_opElim.eliminate(atom)
      64                 :            :    * This method returns true if a lemma of the above form was added to
      65                 :            :    * the inference manager. Note this returns true even if this lemma was added
      66                 :            :    * on a previous call.
      67                 :            :    */
      68                 :            :   bool reduceAssertion(TNode atom);
      69                 :            :   /**
      70                 :            :    * Is the atom reduced? Returns true if a call to method reduceAssertion was
      71                 :            :    * made for the given atom and returned a lemma. In this case, the atom
      72                 :            :    * can be ignored.
      73                 :            :    */
      74                 :            :   bool isReduced(TNode atom) const;
      75                 :            : 
      76                 :            :  private:
      77                 :            :   /** Reference to the inference manager */
      78                 :            :   InferenceManager& d_im;
      79                 :            :   /** The operator elimination utility */
      80                 :            :   OperatorElim& d_opElim;
      81                 :            :   /** The set of assertions that were reduced */
      82                 :            :   context::CDHashMap<Node, bool> d_reduced;
      83                 :            : };
      84                 :            : 
      85                 :            : }  // namespace arith
      86                 :            : }  // namespace theory
      87                 :            : }  // namespace cvc5::internal
      88                 :            : 
      89                 :            : #endif

Generated by: LCOV version 1.14