LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/fp - theory_fp.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2025-02-18 13:42:10 Functions: 0 1 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Andrew Reynolds, Aina Niemetz, Martin Brain
       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                 :            :  * Theory of floating-point arithmetic.
      14                 :            :  */
      15                 :            : 
      16                 :            : #include "cvc5_private.h"
      17                 :            : 
      18                 :            : #ifndef CVC5__THEORY__FP__THEORY_FP_H
      19                 :            : #define CVC5__THEORY__FP__THEORY_FP_H
      20                 :            : 
      21                 :            : #include <string>
      22                 :            : #include <utility>
      23                 :            : 
      24                 :            : #include "context/cdhashset.h"
      25                 :            : #include "context/cdo.h"
      26                 :            : #include "theory/fp/theory_fp_rewriter.h"
      27                 :            : #include "theory/theory.h"
      28                 :            : #include "theory/theory_eq_notify.h"
      29                 :            : #include "theory/theory_inference_manager.h"
      30                 :            : #include "theory/theory_state.h"
      31                 :            : #include "theory/uf/equality_engine.h"
      32                 :            : 
      33                 :            : namespace cvc5::internal {
      34                 :            : namespace theory {
      35                 :            : namespace fp {
      36                 :            : 
      37                 :            : class FpWordBlaster;
      38                 :            : 
      39                 :            : class TheoryFp : public Theory
      40                 :            : {
      41                 :            :  public:
      42                 :            :   /** Constructs a new instance of TheoryFp w.r.t. the provided contexts. */
      43                 :            :   TheoryFp(Env& env, OutputChannel& out, Valuation valuation);
      44                 :            : 
      45                 :            :   //--------------------------------- initialization
      46                 :            :   /** Get the official theory rewriter of this theory. */
      47                 :            :   TheoryRewriter* getTheoryRewriter() override;
      48                 :            :   /** get the proof checker of this theory */
      49                 :            :   ProofRuleChecker* getProofChecker() override;
      50                 :            :   /**
      51                 :            :    * Returns true if we need an equality engine. If so, we initialize the
      52                 :            :    * information regarding how it should be setup. For details, see the
      53                 :            :    * documentation in Theory::needsEqualityEngine.
      54                 :            :    */
      55                 :            :   bool needsEqualityEngine(EeSetupInfo& esi) override;
      56                 :            :   /** Finish initialization. */
      57                 :            :   void finishInit() override;
      58                 :            :   //--------------------------------- end initialization
      59                 :            : 
      60                 :            :   void preRegisterTerm(TNode node) override;
      61                 :            :   TrustNode ppRewrite(TNode node, std::vector<SkolemLemma>& lems) override;
      62                 :            : 
      63                 :            :   //--------------------------------- standard check
      64                 :            :   /** Do we need a check call at last call effort? */
      65                 :            :   bool needsCheckLastEffort() override;
      66                 :            :   /** Post-check, called after the fact queue of the theory is processed. */
      67                 :            :   void postCheck(Effort level) override;
      68                 :            :   /** Pre-notify fact, return true if processed. */
      69                 :            :   bool preNotifyFact(TNode atom,
      70                 :            :                      bool pol,
      71                 :            :                      TNode fact,
      72                 :            :                      bool isPrereg,
      73                 :            :                      bool isInternal) override;
      74                 :            :   //--------------------------------- end standard check
      75                 :            : 
      76                 :            :   bool collectModelInfo(TheoryModel* m,
      77                 :            :                         const std::set<Node>& relevantTerms) override;
      78                 :            :   bool collectModelValues(TheoryModel* m,
      79                 :            :                           const std::set<Node>& termSet) override;
      80                 :            : 
      81                 :          0 :   std::string identify() const override { return "THEORY_FP"; }
      82                 :            : 
      83                 :            :   TrustNode explain(TNode n) override;
      84                 :            : 
      85                 :            :   Node getCandidateModelValue(TNode node) override;
      86                 :            : 
      87                 :            :   EqualityStatus getEqualityStatus(TNode a, TNode b) override;
      88                 :            : 
      89                 :            :  private:
      90                 :            :   using ConversionAbstractionMap = context::CDHashMap<TypeNode, Node>;
      91                 :            :   using AbstractionMap = context::CDHashMap<Node, Node>;
      92                 :            : 
      93                 :            :   void notifySharedTerm(TNode n) override;
      94                 :            : 
      95                 :            :   /** General utility. */
      96                 :            :   void registerTerm(TNode node);
      97                 :            :   bool isRegistered(TNode node);
      98                 :            : 
      99                 :            :   /** The word-blaster. Translates FP -> BV. */
     100                 :            :   std::unique_ptr<FpWordBlaster> d_wordBlaster;
     101                 :            : 
     102                 :            :   void wordBlastAndEquateTerm(TNode node);
     103                 :            : 
     104                 :            :   /** Interaction with the rest of the solver **/
     105                 :            :   void handleLemma(Node node, InferenceId id);
     106                 :            :   /**
     107                 :            :    * Called when literal node is inferred by the equality engine. This
     108                 :            :    * propagates node on the output channel.
     109                 :            :    */
     110                 :            :   bool propagateLit(TNode node);
     111                 :            :   /**
     112                 :            :    * Called when two constants t1 and t2 merge in the equality engine. This
     113                 :            :    * sends a conflict on the output channel.
     114                 :            :    */
     115                 :            :   void conflictEqConstantMerge(TNode t1, TNode t2);
     116                 :            : 
     117                 :            :   bool refineAbstraction(TheoryModel* m, TNode abstract, TNode concrete);
     118                 :            : 
     119                 :            :   /** The terms registered via registerTerm(). */
     120                 :            :   context::CDHashSet<Node> d_registeredTerms;
     121                 :            : 
     122                 :            :   /** Map abstraction skolem to abstracted FP_TO_REAL/FP_FROM_REAL node. */
     123                 :            :   AbstractionMap d_abstractionMap;  // abstract -> original
     124                 :            : 
     125                 :            :   /** The theory rewriter for this theory. */
     126                 :            :   TheoryFpRewriter d_rewriter;
     127                 :            :   /** A (default) theory state object. */
     128                 :            :   TheoryState d_state;
     129                 :            :   /** A (default) inference manager. */
     130                 :            :   TheoryInferenceManager d_im;
     131                 :            :   /** The notify class for equality engine. */
     132                 :            :   TheoryEqNotifyClass d_notify;
     133                 :            : 
     134                 :            :   /** Cache of word-blasted facts. */
     135                 :            :   context::CDHashSet<Node> d_wbFactsCache;
     136                 :            : 
     137                 :            :   /** Flag indicating whether `d_modelCache` should be invalidated. */
     138                 :            :   context::CDO<bool> d_invalidateModelCache;
     139                 :            : 
     140                 :            :   /**
     141                 :            :    * Cache for getValue() calls.
     142                 :            :    *
     143                 :            :    * Is cleared at the beginning of a getValue() call if the
     144                 :            :    * `d_invalidateModelCache` flag is set to true.
     145                 :            :    */
     146                 :            :   std::unordered_map<Node, Node> d_modelCache;
     147                 :            : 
     148                 :            :   /** True constant. */
     149                 :            :   Node d_true;
     150                 :            : };
     151                 :            : 
     152                 :            : }  // namespace fp
     153                 :            : }  // namespace theory
     154                 :            : }  // namespace cvc5::internal
     155                 :            : 
     156                 :            : #endif /* CVC5__THEORY__FP__THEORY_FP_H */

Generated by: LCOV version 1.14