LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/proof/alethe - alethe_node_converter.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 8 50.0 %
Date: 2026-03-12 10:42:46 Functions: 2 6 33.3 %
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                 :            :  * Alethe node conversion
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "cvc5_private.h"
      14                 :            : 
      15                 :            : #ifndef CVC5__PROOF__ALETHE__ALETHE_NODE_CONVERTER_H
      16                 :            : #define CVC5__PROOF__ALETHE__ALETHE_NODE_CONVERTER_H
      17                 :            : 
      18                 :            : #include "expr/node.h"
      19                 :            : #include "expr/node_converter.h"
      20                 :            : #include "proof/alf/alf_node_converter.h"
      21                 :            : 
      22                 :            : namespace cvc5::internal {
      23                 :            : namespace proof {
      24                 :            : 
      25                 :            : /**
      26                 :            :  * This is a helper class for the Alethe post-processor that converts nodes into
      27                 :            :  * their expected form in Alethe.
      28                 :            :  */
      29                 :            : class AletheNodeConverter : public BaseAlfNodeConverter
      30                 :            : {
      31                 :            :  public:
      32                 :            :   /** Constructor
      33                 :            :    *
      34                 :            :    * @param nm The node manager
      35                 :            :    * @param defineSkolems Whether Skolem definitions will be saved to be printed
      36                 :            :    * separately.
      37                 :            :    */
      38                 :       2124 :   AletheNodeConverter(NodeManager* nm, bool defineSkolems = false)
      39                 :       2124 :       : BaseAlfNodeConverter(nm), d_defineSkolems(defineSkolems)
      40                 :            :   {
      41                 :       2124 :   }
      42                 :       2124 :   ~AletheNodeConverter() {}
      43                 :            : 
      44                 :            :   /** convert at post-order traversal */
      45                 :            :   Node postConvert(Node n) override;
      46                 :            : 
      47                 :            :   /** A wrapper for convert that checks whether there was an error during
      48                 :            :    * conversion.
      49                 :            :    *
      50                 :            :    * @param n The node to be converted
      51                 :            :    * @param isAssumption Whether the n is an assumption
      52                 :            :    * @return The converted node if there was no error, otherwise Node::null().
      53                 :            :    */
      54                 :            :   Node maybeConvert(Node n, bool isAssumption = false);
      55                 :            : 
      56                 :            :   /** Retrieve the saved error message, if any. */
      57                 :            :   const std::string& getError();
      58                 :            : 
      59                 :            :   /** Return original assumption, if any, for a given (converted) node. */
      60                 :            :   Node getOriginalAssumption(Node n);
      61                 :            : 
      62                 :            :   /** Retrieve a mapping between Skolems and their converted definitions.
      63                 :            :    */
      64                 :            :   const std::map<Node, Node>& getSkolemDefinitions();
      65                 :            : 
      66                 :            :   /** Retrieve ordered list of Skolems.  This list is ordered so that a Skolem
      67                 :            :    * whose definition depends on another Skolem will come after that Skolem.
      68                 :            :    */
      69                 :            :   const std::vector<Node>& getSkolemList();
      70                 :            : 
      71                 :            :   Node mkInternalSymbol(const std::string& name,
      72                 :            :                         TypeNode tn,
      73                 :            :                         bool useRawSym = true) override;
      74                 :            : 
      75                 :          0 :   Node getOperatorOfTerm(CVC5_UNUSED Node n) override { return Node::null(); };
      76                 :            : 
      77                 :          0 :   Node typeAsNode(CVC5_UNUSED TypeNode tni) override { return Node::null(); };
      78                 :            : 
      79                 :          0 :   Node mkInternalApp(CVC5_UNUSED const std::string& name,
      80                 :            :                      CVC5_UNUSED const std::vector<Node>& args,
      81                 :            :                      CVC5_UNUSED TypeNode ret,
      82                 :            :                      CVC5_UNUSED bool useRawSym = true) override
      83                 :            :   {
      84                 :          0 :     return Node::null();
      85                 :            :   };
      86                 :            : 
      87                 :            :  private:
      88                 :            :   /** Error message saved during failed conversion. */
      89                 :            :   std::string d_error;
      90                 :            :   /** Whether Skolem definitions will be saved to be printed separately. */
      91                 :            :   bool d_defineSkolems;
      92                 :            : 
      93                 :            :   /**
      94                 :            :    * As above but uses the s-expression type.
      95                 :            :    */
      96                 :            :   Node mkInternalSymbol(const std::string& name);
      97                 :            : 
      98                 :            :   /** Maps from internally generated symbols to the built nodes. */
      99                 :            :   std::map<std::pair<TypeNode, std::string>, Node> d_symbolsMap;
     100                 :            : 
     101                 :            :   /** Map from converted node to original (used only for assumptions). */
     102                 :            :   std::map<Node, Node> d_convToOriginalAssumption;
     103                 :            : 
     104                 :            :   /** Map between Skolems and their converted definitions. */
     105                 :            :   std::map<Node, Node> d_skolems;
     106                 :            :   /** Ordered Skolems such that a given entry does not have subterms occurring
     107                 :            :    * in subsequent entries. */
     108                 :            :   std::vector<Node> d_skolemsList;
     109                 :            : };
     110                 :            : 
     111                 :            : }  // namespace proof
     112                 :            : }  // namespace cvc5::internal
     113                 :            : 
     114                 :            : #endif

Generated by: LCOV version 1.14