LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/arith/nl/coverings - projections.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 5 5 100.0 %
Date: 2026-03-05 11:40:39 Functions: 2 2 100.0 %
Branches: 2 2 100.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                 :            :  * Implements utilities for coverings projection operators.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "cvc5_private.h"
      14                 :            : 
      15                 :            : #ifndef CVC5__THEORY__ARITH__NL__COVERINGS_PROJECTIONS_H
      16                 :            : #define CVC5__THEORY__ARITH__NL__COVERINGS_PROJECTIONS_H
      17                 :            : 
      18                 :            : #ifdef CVC5_USE_POLY
      19                 :            : 
      20                 :            : #include <poly/polyxx.h>
      21                 :            : 
      22                 :            : #include <vector>
      23                 :            : 
      24                 :            : namespace cvc5::internal {
      25                 :            : namespace theory {
      26                 :            : namespace arith {
      27                 :            : namespace nl {
      28                 :            : namespace coverings {
      29                 :            : 
      30                 :            : /**
      31                 :            :  * A simple wrapper around std::vector<poly::Polynomial> that ensures that all
      32                 :            :  * polynomials are properly factorized and pruned when added to the list.
      33                 :            :  */
      34                 :            : class PolyVector : public std::vector<poly::Polynomial>
      35                 :            : {
      36                 :            :  private:
      37                 :            :   /** Disable all emplace() */
      38                 :            :   void emplace() {}
      39                 :            :   /** Disable all emplace_back() */
      40                 :            :   void emplace_back() {}
      41                 :            :   /** Disable all insert() */
      42                 :            :   void insert() {}
      43                 :            :   /** Disable all push_back() */
      44                 :            :   void push_back() {}
      45                 :            : 
      46                 :            :  public:
      47                 :      67210 :   PolyVector() {}
      48                 :            :   /** Construct from a set of polynomials */
      49                 :        258 :   PolyVector(std::initializer_list<poly::Polynomial> i)
      50                 :        258 :   {
      51         [ +  + ]:        602 :     for (const auto& p : i) add(p);
      52                 :        258 :   }
      53                 :            :   /**
      54                 :            :    * Adds a polynomial to the list of projection polynomials.
      55                 :            :    * Before adding, it factorizes the polynomials and removed constant factors.
      56                 :            :    */
      57                 :            :   void add(const poly::Polynomial& poly, bool assertMain = false);
      58                 :            :   /** Sort and remove duplicates from the list of polynomials. */
      59                 :            :   void reduce();
      60                 :            :   /** Make this list of polynomials a finest square-free basis. */
      61                 :            :   void makeFinestSquareFreeBasis();
      62                 :            :   /** Push polynomials with a lower main variable to another PolyVector. */
      63                 :            :   void pushDownPolys(PolyVector& down, poly::Variable var);
      64                 :            : };
      65                 :            : 
      66                 :            : /**
      67                 :            :  * Computes McCallum's projection operator.
      68                 :            :  */
      69                 :            : PolyVector projectionMcCallum(const std::vector<poly::Polynomial>& polys);
      70                 :            : 
      71                 :            : }  // namespace coverings
      72                 :            : }  // namespace nl
      73                 :            : }  // namespace arith
      74                 :            : }  // namespace theory
      75                 :            : }  // namespace cvc5::internal
      76                 :            : 
      77                 :            : #endif
      78                 :            : 
      79                 :            : #endif

Generated by: LCOV version 1.14