LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/expr - beta_reduce_converter.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 10 40.0 %
Date: 2026-03-19 10:41:11 Functions: 1 1 100.0 %
Branches: 3 18 16.7 %

           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                 :            :  * Implementation of beta reduction node conversion
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "expr/beta_reduce_converter.h"
      14                 :            : 
      15                 :            : namespace cvc5::internal {
      16                 :            : 
      17                 :            : /** convert node n as described above during post-order traversal */
      18                 :         24 : Node BetaReduceNodeConverter::postConvert(Node n)
      19                 :            : {
      20                 :         72 :   if (n.getKind() == Kind::APPLY_UF
      21 [ -  + ][ -  - ]:         24 :       && n.getOperator().getKind() == Kind::LAMBDA)
         [ -  + ][ -  + ]
                 [ -  - ]
      22                 :            :   {
      23                 :          0 :     Node lam = n.getOperator();
      24                 :          0 :     std::vector<Node> vars(lam[0].begin(), lam[0].end());
      25                 :          0 :     std::vector<Node> subs(n.begin(), n.end());
      26                 :            :     // only reduce if arity is correct
      27         [ -  - ]:          0 :     if (vars.size() == subs.size())
      28                 :            :     {
      29                 :            :       return lam[1].substitute(
      30                 :          0 :           vars.begin(), vars.end(), subs.begin(), subs.end());
      31                 :            :     }
      32 [ -  - ][ -  - ]:          0 :   }
                 [ -  - ]
      33                 :         24 :   return n;
      34                 :            : }
      35                 :            : 
      36                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14