LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/decision - assertion_list.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2025-01-24 13:39:29 Functions: 1 2 50.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Andrew Reynolds, Mathias Preiner
       4                 :            :  *
       5                 :            :  * This file is part of the cvc5 project.
       6                 :            :  *
       7                 :            :  * Copyright (c) 2009-2025 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                 :            :  * Assertion list
      14                 :            :  */
      15                 :            : 
      16                 :            : #include "cvc5_private.h"
      17                 :            : 
      18                 :            : #ifndef CVC5__DECISION__ASSERTION_LIST_H
      19                 :            : #define CVC5__DECISION__ASSERTION_LIST_H
      20                 :            : 
      21                 :            : #include <iosfwd>
      22                 :            : #include <unordered_set>
      23                 :            : #include <vector>
      24                 :            : 
      25                 :            : #include "context/cdlist.h"
      26                 :            : #include "context/cdo.h"
      27                 :            : #include "expr/node.h"
      28                 :            : 
      29                 :            : namespace cvc5::internal {
      30                 :            : namespace decision {
      31                 :            : 
      32                 :            : /**
      33                 :            :  * For monitoring activity of assertions
      34                 :            :  */
      35                 :            : enum class DecisionStatus
      36                 :            : {
      37                 :            :   // not currently watching status of the current assertion
      38                 :            :   INACTIVE,
      39                 :            :   // no decision was made considering the assertion
      40                 :            :   NO_DECISION,
      41                 :            :   // a decision was made considering the assertion
      42                 :            :   DECISION,
      43                 :            :   // we backtracked while considering the assertion
      44                 :            :   BACKTRACK
      45                 :            : };
      46                 :            : const char* toString(DecisionStatus s);
      47                 :            : std::ostream& operator<<(std::ostream& out, DecisionStatus s);
      48                 :            : 
      49                 :            : /**
      50                 :            :  * An assertion list used by the justification heuristic. This tracks a list
      51                 :            :  * of formulas that we must justify.
      52                 :            :  */
      53                 :            : class AssertionList
      54                 :            : {
      55                 :            :  public:
      56                 :            :   /**
      57                 :            :    * @param ac The context on which the assertions depends on. This is the
      58                 :            :    * user context for assertions. It is the SAT context for assertions that
      59                 :            :    * are dynamically relevant based on what is asserted, e.g. lemmas
      60                 :            :    * corresponding to skolem definitions.
      61                 :            :    * @param ic The context on which the current index of the assertions
      62                 :            :    * depends on. This is typically the SAT context.
      63                 :            :    * @param dyn Whether to use a dynamic ordering of the assertions. If this
      64                 :            :    * flag is true, then getNextAssertion will return the most important next
      65                 :            :    * assertion to consider based on heuristics in response to notifyStatus.
      66                 :            :    */
      67                 :            :   AssertionList(context::Context* ac,
      68                 :            :                 context::Context* ic,
      69                 :            :                 bool useDyn = false);
      70                 :      81528 :   virtual ~AssertionList() {}
      71                 :            :   /** Presolve, which clears the dynamic assertion order */
      72                 :            :   void presolve();
      73                 :            :   /** Add the assertion n */
      74                 :            :   void addAssertion(TNode n);
      75                 :            :   /**
      76                 :            :    * Get the next assertion and increment d_assertionIndex.
      77                 :            :    */
      78                 :            :   TNode getNextAssertion();
      79                 :            :   /** Get the number of assertions */
      80                 :            :   size_t size() const;
      81                 :            :   /**
      82                 :            :    * Notify status, which indicates the status of the assertion n, where n
      83                 :            :    * is the assertion last returned by getNextAssertion above (independent of
      84                 :            :    * the context). The status s indicates what happened when we were trying to
      85                 :            :    * justify n. This impacts its order if useDyn is true.
      86                 :            :    */
      87                 :            :   void notifyStatus(TNode n, DecisionStatus s);
      88                 :            : 
      89                 :            :  private:
      90                 :            :   /** The list of assertions */
      91                 :            :   context::CDList<Node> d_assertions;
      92                 :            :   /** The index of the next assertion to satify */
      93                 :            :   context::CDO<size_t> d_assertionIndex;
      94                 :            :   // --------------------------- dynamic assertions
      95                 :            :   /** are we using dynamic assertions? */
      96                 :            :   bool d_usingDynamic;
      97                 :            :   /** The list of assertions */
      98                 :            :   std::vector<TNode> d_dlist;
      99                 :            :   /** The set of assertions for fast membership testing in the above vector */
     100                 :            :   std::unordered_set<TNode> d_dlistSet;
     101                 :            :   /** The index of the next assertion to satify */
     102                 :            :   context::CDO<size_t> d_dindex;
     103                 :            : };
     104                 :            : 
     105                 :            : }  // namespace decision
     106                 :            : }  // namespace cvc5::internal
     107                 :            : 
     108                 :            : #endif /* CVC5__DECISION__ASSERTION_LIST_H */

Generated by: LCOV version 1.14