LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/quantifiers - inst_strategy_enumerative.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2026-03-01 11:40:25 Functions: 2 2 100.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                 :            :  * Enumerative instantiation.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "cvc5_private.h"
      14                 :            : 
      15                 :            : #ifndef CVC5__INST_STRATEGY_ENUMERATIVE_H
      16                 :            : #define CVC5__INST_STRATEGY_ENUMERATIVE_H
      17                 :            : 
      18                 :            : #include "theory/quantifiers/quant_module.h"
      19                 :            : 
      20                 :            : namespace cvc5::internal {
      21                 :            : namespace theory {
      22                 :            : namespace quantifiers {
      23                 :            : 
      24                 :            : class RelevantDomain;
      25                 :            : 
      26                 :            : /** Enumerative instantiation
      27                 :            :  *
      28                 :            :  * This class implements enumerative instantiation described
      29                 :            :  * in Reynolds et al., "Revisiting Enumerative Instantiation".
      30                 :            :  *
      31                 :            :  * It is an instance of QuantifiersModule, whose main
      32                 :            :  * task is to make calls to QuantifiersEngine during
      33                 :            :  * calls to QuantifiersModule::check(...).
      34                 :            :  *
      35                 :            :  * This class adds instantiations based on enumerating
      36                 :            :  * well-typed terms that occur in the current context
      37                 :            :  * based on a heuristically determined ordering on
      38                 :            :  * tuples of terms. This ordering incorporates
      39                 :            :  * reasoning about the relevant domain of quantified
      40                 :            :  * formulas (see theory/quantifiers/relevant_domain.h).
      41                 :            :  * We consider only ground terms that occur in the
      42                 :            :  * context due to Theorem 1 of "Revisiting Enumerative
      43                 :            :  * Instantiation". Notice this theorem holds only for theories
      44                 :            :  * with compactness. For theories such as arithmetic,
      45                 :            :  * this class may introduce "default" terms that are
      46                 :            :  * used in instantiations, say 0 for arithmetic, even
      47                 :            :  * when the term 0 does not occur in the context.
      48                 :            :  *
      49                 :            :  * This strategy is not enabled by default, and
      50                 :            :  * is enabled by the option:
      51                 :            :  *   --full-saturate-quant
      52                 :            :  *
      53                 :            :  * It is generally called with lower priority than
      54                 :            :  * other instantiation strategies, although this
      55                 :            :  * option interleaves it with other strategies
      56                 :            :  * during quantifier effort level QEFFORT_STANDARD:
      57                 :            :  *   --fs-interleave
      58                 :            :  */
      59                 :            : class InstStrategyEnum : public QuantifiersModule
      60                 :            : {
      61                 :            :  public:
      62                 :            :   InstStrategyEnum(Env& env,
      63                 :            :                    QuantifiersState& qs,
      64                 :            :                    QuantifiersInferenceManager& qim,
      65                 :            :                    QuantifiersRegistry& qr,
      66                 :            :                    TermRegistry& tr,
      67                 :            :                    RelevantDomain* rd);
      68                 :        660 :   ~InstStrategyEnum() {}
      69                 :            :   /** Presolve */
      70                 :            :   void presolve() override;
      71                 :            :   /** Needs check. */
      72                 :            :   bool needsCheck(Theory::Effort e) override;
      73                 :            :   /** Reset round. */
      74                 :            :   void reset_round(Theory::Effort e) override;
      75                 :            :   /** Check.
      76                 :            :    * Adds instantiations for all currently asserted
      77                 :            :    * quantified formulas via calls to process(...)
      78                 :            :    */
      79                 :            :   void check(Theory::Effort e, QEffort quant_e) override;
      80                 :            :   /** Identify. */
      81                 :            :   std::string identify() const override;
      82                 :            : 
      83                 :            :  private:
      84                 :            :   /** Pointer to the relevant domain utility of quantifiers engine */
      85                 :            :   RelevantDomain* d_rd;
      86                 :            :   /** process quantified formula
      87                 :            :    *
      88                 :            :    * q is the quantified formula we are constructing instances for.
      89                 :            :    * fullEffort is whether we are called at full effort.
      90                 :            :    *
      91                 :            :    * If this function returns true, then one instantiation
      92                 :            :    * (determined by an enumeration) was added via a successful
      93                 :            :    * call to QuantifiersEngine::addInstantiation(...).
      94                 :            :    *
      95                 :            :    * If fullEffort is true, then we may introduce a "default"
      96                 :            :    * well-typed term *not* occurring in the current context.
      97                 :            :    * This handles corner cases where there are no well-typed
      98                 :            :    * ground terms in the current context to instantiate with.
      99                 :            :    *
     100                 :            :    * The flag isRd indicates whether we are trying relevant domain
     101                 :            :    * instantiations. If this flag is false, we are trying arbitrary ground
     102                 :            :    * term instantiations.
     103                 :            :    */
     104                 :            :   bool process(Node q, bool fullEffort, bool isRd);
     105                 :            :   /**
     106                 :            :    * A limit on the number of rounds to apply this strategy, where a value < 0
     107                 :            :    * means no limit. This value is set to the value of fullSaturateLimit()
     108                 :            :    * during presolve.
     109                 :            :    */
     110                 :            :   int32_t d_enumInstLimit;
     111                 :            : }; /* class InstStrategyEnum */
     112                 :            : 
     113                 :            : }  // namespace quantifiers
     114                 :            : }  // namespace theory
     115                 :            : }  // namespace cvc5::internal
     116                 :            : 
     117                 :            : #endif

Generated by: LCOV version 1.14