LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/prop - lemma_inprocess.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 1 100.0 %
Date: 2025-03-15 12:03:33 Functions: 2 2 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Andrew Reynolds
       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                 :            :  * Learner for literals asserted at level zero.
      14                 :            :  */
      15                 :            : 
      16                 :            : #include "cvc5_private.h"
      17                 :            : 
      18                 :            : #ifndef CVC5__PROP__LEMMA_INPROCESS_H
      19                 :            : #define CVC5__PROP__LEMMA_INPROCESS_H
      20                 :            : 
      21                 :            : #include <unordered_set>
      22                 :            : 
      23                 :            : #include "context/cdhashset.h"
      24                 :            : #include "context/cdo.h"
      25                 :            : #include "expr/node.h"
      26                 :            : #include "prop/cnf_stream.h"
      27                 :            : #include "smt/env_obj.h"
      28                 :            : #include "theory/trust_substitutions.h"
      29                 :            : 
      30                 :            : namespace cvc5::internal {
      31                 :            : 
      32                 :            : class TheoryEngine;
      33                 :            : 
      34                 :            : namespace prop {
      35                 :            : 
      36                 :            : class ZeroLevelLearner;
      37                 :            : 
      38                 :            : /**
      39                 :            :  * Lemma inprocess, which heuristically simplifies lemmas to an equivalent
      40                 :            :  * form based on the current simplifications stored by the zero level learner.
      41                 :            :  *
      42                 :            :  * The intution of this class is to increase the likelihood that literals in the
      43                 :            :  * SAT solver are reused. For example if a = 0 is learned at decision level
      44                 :            :  * zero, and there is a SAT literal P(0), if P(a) is introduced as a new literal
      45                 :            :  * in a lemma, we may replace it by P(0).
      46                 :            :  *
      47                 :            :  * As another example, if we learn a=b, c=b and we have a literal P(a), then
      48                 :            :  * we may replace P(c) with P(a).
      49                 :            :  *
      50                 :            :  * This simplification is done selectively and will never replace a known SAT
      51                 :            :  * literal by a new SAT literal. Further policies are determined by
      52                 :            :  * lemma-inprocess-mode.
      53                 :            :  *
      54                 :            :  * Generally this method can only be applied to lemmas where the structure of
      55                 :            :  * the lemma is not important. This includes quantifier instantiation lemmas
      56                 :            :  * for example.
      57                 :            :  */
      58                 :            : class LemmaInprocess : protected EnvObj
      59                 :            : {
      60                 :            :   using NodeSet = context::CDHashSet<Node>;
      61                 :            : 
      62                 :            :  public:
      63                 :            :   LemmaInprocess(Env& env, CnfStream* cs, ZeroLevelLearner& zll);
      64                 :         10 :   ~LemmaInprocess() {}
      65                 :            :   /** Inprocess lemma */
      66                 :            :   TrustNode inprocessLemma(TrustNode& trn);
      67                 :            : 
      68                 :            :  private:
      69                 :            :   /**
      70                 :            :    * Process internal, returns an equivalent formula to lem, assuming d_tsmap.
      71                 :            :    */
      72                 :            :   Node processInternal(const Node& lem);
      73                 :            :   /** Pointer to CNF stream */
      74                 :            :   CnfStream* d_cs;
      75                 :            :   /** Reference to the current available simplification */
      76                 :            :   theory::TrustSubstitutionMap& d_tsmap;
      77                 :            :   /** Mapping from simplified literals to a known SAT literal */
      78                 :            :   context::CDHashMap<Node, Node> d_subsLitMap;
      79                 :            :   /** Equivalent literal lemmas we have sent */
      80                 :            :   context::CDHashSet<Node> d_eqLitLemmas;
      81                 :            : };
      82                 :            : 
      83                 :            : }  // namespace prop
      84                 :            : }  // namespace cvc5::internal
      85                 :            : 
      86                 :            : #endif

Generated by: LCOV version 1.14