LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/theory/arith - pp_rewrite_eq.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 19 19 100.0 %
Date: 2024-10-12 11:38:19 Functions: 2 2 100.0 %
Branches: 9 18 50.0 %

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Andrew Reynolds, Gereon Kremer, Aina Niemetz
       4                 :            :  *
       5                 :            :  * This file is part of the cvc5 project.
       6                 :            :  *
       7                 :            :  * Copyright (c) 2009-2024 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                 :            :  * Preprocess equality rewriter for arithmetic
      14                 :            :  */
      15                 :            : 
      16                 :            : #include "theory/arith/pp_rewrite_eq.h"
      17                 :            : 
      18                 :            : #include "options/arith_options.h"
      19                 :            : #include "smt/env.h"
      20                 :            : #include "theory/builtin/proof_checker.h"
      21                 :            : #include "theory/rewriter.h"
      22                 :            : 
      23                 :            : namespace cvc5::internal {
      24                 :            : namespace theory {
      25                 :            : namespace arith {
      26                 :            : 
      27                 :      49264 : PreprocessRewriteEq::PreprocessRewriteEq(Env& env)
      28                 :      49264 :     : EnvObj(env), d_ppPfGen(env, context(), "Arith::ppRewrite")
      29                 :            : {
      30                 :      49264 : }
      31                 :            : 
      32                 :      58077 : TrustNode PreprocessRewriteEq::ppRewriteEq(TNode atom)
      33                 :            : {
      34 [ -  + ][ -  + ]:      58077 :   Assert(atom.getKind() == Kind::EQUAL);
                 [ -  - ]
      35         [ +  + ]:      58077 :   if (!options().arith.arithRewriteEq)
      36                 :            :   {
      37                 :      19251 :     return TrustNode::null();
      38                 :            :   }
      39 [ -  + ][ -  + ]:      38826 :   Assert(atom[0].getType().isRealOrInt());
                 [ -  - ]
      40                 :     116478 :   Node leq = NodeBuilder(Kind::LEQ) << atom[0] << atom[1];
      41                 :     116478 :   Node geq = NodeBuilder(Kind::GEQ) << atom[0] << atom[1];
      42                 :     116478 :   Node rewritten = rewrite(leq.andNode(geq));
      43         [ +  - ]:      77652 :   Trace("arith::preprocess")
      44                 :      38826 :       << "arith::preprocess() : returning " << rewritten << std::endl;
      45                 :            :   // don't need to rewrite terms since rewritten is not a non-standard op
      46         [ +  + ]:      38826 :   if (d_env.isTheoryProofProducing())
      47                 :            :   {
      48                 :      42728 :     Node t = builtin::BuiltinProofRuleChecker::mkTheoryIdNode(THEORY_ARITH);
      49                 :      21364 :     Node eq = atom.eqNode(rewritten);
      50                 :            :     return d_ppPfGen.mkTrustedRewrite(
      51                 :            :         atom,
      52                 :            :         rewritten,
      53                 :      42728 :         d_env.getProofNodeManager()->mkTrustedNode(
      54                 :      42728 :             TrustId::THEORY_INFERENCE, {}, {}, eq));
      55                 :            :   }
      56                 :      17462 :   return TrustNode::mkTrustRewrite(atom, rewritten, nullptr);
      57                 :            : }
      58                 :            : 
      59                 :            : }  // namespace arith
      60                 :            : }  // namespace theory
      61                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14