LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/sets - theory_sets.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 3 4 75.0 %
Date: 2026-03-05 11:40:39 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                 :            :  * Sets theory.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "cvc5_private.h"
      14                 :            : 
      15                 :            : #ifndef CVC5__THEORY__SETS__THEORY_SETS_H
      16                 :            : #define CVC5__THEORY__SETS__THEORY_SETS_H
      17                 :            : 
      18                 :            : #include <memory>
      19                 :            : 
      20                 :            : #include "smt/logic_exception.h"
      21                 :            : #include "theory/care_pair_argument_callback.h"
      22                 :            : #include "theory/sets/inference_manager.h"
      23                 :            : #include "theory/sets/proof_checker.h"
      24                 :            : #include "theory/sets/skolem_cache.h"
      25                 :            : #include "theory/sets/solver_state.h"
      26                 :            : #include "theory/sets/theory_sets_rewriter.h"
      27                 :            : #include "theory/theory.h"
      28                 :            : #include "theory/theory_eq_notify.h"
      29                 :            : 
      30                 :            : namespace cvc5::internal {
      31                 :            : namespace theory {
      32                 :            : namespace sets {
      33                 :            : 
      34                 :            : class TheorySetsPrivate;
      35                 :            : class TheorySetsScrutinize;
      36                 :            : 
      37                 :            : class TheorySets : public Theory
      38                 :            : {
      39                 :            :   friend class TheorySetsPrivate;
      40                 :            :   friend class TheorySetsRels;
      41                 :            :  public:
      42                 :            :   /** Constructs a new instance of TheorySets w.r.t. the provided contexts. */
      43                 :            :   TheorySets(Env& env, OutputChannel& out, Valuation valuation);
      44                 :            :   ~TheorySets() override;
      45                 :            : 
      46                 :            :   //--------------------------------- initialization
      47                 :            :   /** get the official theory rewriter of this theory */
      48                 :            :   TheoryRewriter* getTheoryRewriter() override;
      49                 :            :   /** get the proof checker of this theory */
      50                 :            :   ProofRuleChecker* getProofChecker() override;
      51                 :            :   /**
      52                 :            :    * Returns true if we need an equality engine. If so, we initialize the
      53                 :            :    * information regarding how it should be setup. For details, see the
      54                 :            :    * documentation in Theory::needsEqualityEngine.
      55                 :            :    */
      56                 :            :   bool needsEqualityEngine(EeSetupInfo& esi) override;
      57                 :            :   /** finish initialization */
      58                 :            :   void finishInit() override;
      59                 :            :   //--------------------------------- end initialization
      60                 :            : 
      61                 :            :   //--------------------------------- standard check
      62                 :            :   /** Post-check, called after the fact queue of the theory is processed. */
      63                 :            :   void postCheck(Effort level) override;
      64                 :            :   /** Notify fact */
      65                 :            :   void notifyFact(TNode atom, bool pol, TNode fact, bool isInternal) override;
      66                 :            :   //--------------------------------- end standard check
      67                 :            :   /** Collect model values in m based on the relevant terms given by termSet */
      68                 :            :   bool collectModelValues(TheoryModel* m,
      69                 :            :                           const std::set<Node>& termSet) override;
      70                 :            :   void computeCareGraph() override;
      71                 :            :   TrustNode explain(TNode) override;
      72                 :            :   Node getCandidateModelValue(TNode) override;
      73                 :          0 :   std::string identify() const override { return "THEORY_SETS"; }
      74                 :            :   void preRegisterTerm(TNode node) override;
      75                 :            :   /**
      76                 :            :    * If the sets-ext option is not set and we have an extended operator,
      77                 :            :    * we throw an exception. Additionally, we expand operators like choose
      78                 :            :    * and is_singleton.
      79                 :            :    */
      80                 :            :   TrustNode ppRewrite(TNode n, std::vector<SkolemLemma>& lems) override;
      81                 :            :   bool ppAssert(TrustNode tin, TrustSubstitutionMap& outSubstitutions) override;
      82                 :            :   void presolve() override;
      83                 :            :   bool isEntailed(Node n, bool pol);
      84                 :            : 
      85                 :            :  private:
      86                 :            :   /**
      87                 :            :    * Overrides to handle a special case of set membership.
      88                 :            :    */
      89                 :            :   void processCarePairArgs(TNode a, TNode b) override;
      90                 :            :   /** Functions to handle callbacks from equality engine */
      91                 :            :   class NotifyClass : public TheoryEqNotifyClass
      92                 :            :   {
      93                 :            :    public:
      94                 :      49982 :     NotifyClass(TheorySetsPrivate& theory, TheoryInferenceManager& im)
      95                 :      49982 :         : TheoryEqNotifyClass(im), d_theory(theory)
      96                 :            :     {
      97                 :      49982 :     }
      98                 :            :     void eqNotifyNewClass(TNode t) override;
      99                 :            :     void eqNotifyMerge(TNode t1, TNode t2) override;
     100                 :            :     void eqNotifyDisequal(TNode t1, TNode t2, TNode reason) override;
     101                 :            : 
     102                 :            :    private:
     103                 :            :     TheorySetsPrivate& d_theory;
     104                 :            :   };
     105                 :            :   /** The skolem cache */
     106                 :            :   SkolemCache d_skCache;
     107                 :            :   /** The state of the sets solver at full effort */
     108                 :            :   SolverState d_state;
     109                 :            :   /** The theory rewriter for this theory. */
     110                 :            :   TheorySetsRewriter d_rewriter;
     111                 :            :   /** The inference manager */
     112                 :            :   InferenceManager d_im;
     113                 :            :   /** The care pair argument callback, used for theory combination */
     114                 :            :   CarePairArgumentCallback d_cpacb;
     115                 :            :   /** The internal theory */
     116                 :            :   std::unique_ptr<TheorySetsPrivate> d_internal;
     117                 :            :   /** The proof checker */
     118                 :            :   SetsProofRuleChecker d_checker;
     119                 :            :   /** Instance of the above class */
     120                 :            :   NotifyClass d_notify;
     121                 :            : }; /* class TheorySets */
     122                 :            : 
     123                 :            : }  // namespace sets
     124                 :            : }  // namespace theory
     125                 :            : }  // namespace cvc5::internal
     126                 :            : 
     127                 :            : #endif /* CVC5__THEORY__SETS__THEORY_SETS_H */

Generated by: LCOV version 1.14