LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/quantifiers/cegqi - nested_qe.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2026-07-22 10:35:40 Functions: 1 1 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                 :            :  * Methods for counterexample-guided quantifier instantiation
      11                 :            :  * based on nested quantifier elimination.
      12                 :            :  */
      13                 :            : 
      14                 :            : #include "cvc5_private.h"
      15                 :            : 
      16                 :            : #ifndef CVC5__THEORY__QUANTIFIERS__CEQGI__NESTED_QE_H
      17                 :            : #define CVC5__THEORY__QUANTIFIERS__CEQGI__NESTED_QE_H
      18                 :            : 
      19                 :            : #include <unordered_set>
      20                 :            : 
      21                 :            : #include "context/cdhashmap.h"
      22                 :            : #include "expr/node.h"
      23                 :            : 
      24                 :            : namespace cvc5::internal {
      25                 :            : 
      26                 :            : class Env;
      27                 :            : 
      28                 :            : namespace theory {
      29                 :            : namespace quantifiers {
      30                 :            : 
      31                 :            : class NestedQe
      32                 :            : {
      33                 :            :   using NodeNodeMap = context::CDHashMap<Node, Node>;
      34                 :            : 
      35                 :            :  public:
      36                 :            :   NestedQe(Env& env);
      37                 :         50 :   ~NestedQe() {}
      38                 :            :   /**
      39                 :            :    * Process quantified formula. If this returns true, then q was processed
      40                 :            :    * via nested quantifier elimination (either during this call or previously
      41                 :            :    * in this user context). If q was processed in this call, the lemma:
      42                 :            :    *   (= q qqe)
      43                 :            :    * is added to lem, where qqe is the result of nested quantifier elimination
      44                 :            :    * on q.
      45                 :            :    */
      46                 :            :   bool process(Node q, std::vector<Node>& lems);
      47                 :            :   /**
      48                 :            :    * Have we processed q using the above method?
      49                 :            :    */
      50                 :            :   bool hasProcessed(Node q) const;
      51                 :            : 
      52                 :            :   /**
      53                 :            :    * Get nested quantification. Returns true if q has nested quantifiers.
      54                 :            :    * Adds each nested quantifier in the body of q to nqs.
      55                 :            :    */
      56                 :            :   static bool getNestedQuantification(Node q, std::unordered_set<Node>& nqs);
      57                 :            :   /**
      58                 :            :    * Does quantified formula q have nested quantification?
      59                 :            :    */
      60                 :            :   static bool hasNestedQuantification(Node q);
      61                 :            :   /**
      62                 :            :    * Do nested quantifier elimination. Returns a formula that is equivalent to
      63                 :            :    * q and has no nested quantification. If keepTopLevel is false, then the
      64                 :            :    * returned formula is quantifier-free. Otherwise, it is a quantified formula
      65                 :            :    * with no nested quantification.
      66                 :            :    */
      67                 :            :   static Node doNestedQe(Env& env, Node q, bool keepTopLevel = false);
      68                 :            :   /**
      69                 :            :    * Run quantifier elimination on quantified formula q, where q has no nested
      70                 :            :    * quantification. This method invokes a subsolver for performing quantifier
      71                 :            :    * elimination.
      72                 :            :    */
      73                 :            :   static Node doQe(Env& env, Node q);
      74                 :            : 
      75                 :            :  private:
      76                 :            :   /** Reference to the env */
      77                 :            :   Env& d_env;
      78                 :            :   /**
      79                 :            :    * Mapping from quantified formulas q to the result of doNestedQe(q, true).
      80                 :            :    */
      81                 :            :   NodeNodeMap d_qnqe;
      82                 :            : };
      83                 :            : 
      84                 :            : }  // namespace quantifiers
      85                 :            : }  // namespace theory
      86                 :            : }  // namespace cvc5::internal
      87                 :            : 
      88                 :            : #endif

Generated by: LCOV version 1.14