Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * Top contributors (to current version): 3 : : * Andrew Reynolds, Mudathir Mohamed, Gereon Kremer 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 : : * Implementation of the builtin theory. 14 : : */ 15 : : 16 : : #include "theory/builtin/theory_builtin.h" 17 : : 18 : : #include "expr/kind.h" 19 : : #include "proof/proof_node_manager.h" 20 : : #include "theory/builtin/theory_builtin_rewriter.h" 21 : : #include "theory/theory_model.h" 22 : : #include "theory/uf/theory_uf_rewriter.h" 23 : : #include "theory/valuation.h" 24 : : 25 : : namespace cvc5::internal { 26 : : namespace theory { 27 : : namespace builtin { 28 : : 29 : 49898 : TheoryBuiltin::TheoryBuiltin(Env& env, OutputChannel& out, Valuation valuation) 30 : : : Theory(THEORY_BUILTIN, env, out, valuation), 31 : 49898 : d_rewriter(env.getNodeManager()), 32 : 49898 : d_checker(env.getNodeManager(), env.getRewriter(), env), 33 : 49898 : d_state(env, valuation), 34 : 99796 : d_im(env, *this, d_state, "theory::builtin::") 35 : : { 36 : : // indicate we are using the default theory state and inference managers 37 : 49898 : d_theoryState = &d_state; 38 : 49898 : d_inferManager = &d_im; 39 : 49898 : } 40 : : 41 : 49898 : TheoryRewriter* TheoryBuiltin::getTheoryRewriter() { return &d_rewriter; } 42 : : 43 : 18858 : ProofRuleChecker* TheoryBuiltin::getProofChecker() { return &d_checker; } 44 : : 45 : 0 : std::string TheoryBuiltin::identify() const 46 : : { 47 : 0 : return std::string("TheoryBuiltin"); 48 : : } 49 : : 50 : 49898 : void TheoryBuiltin::finishInit() 51 : : { 52 : : // Notice that choice is an unevaluated kind belonging to this theory. 53 : : // However, it should be set as an unevaluated kind where it is used, e.g. 54 : : // in the quantifiers theory. This ensures that a logic like QF_LIA, which 55 : : // includes the builtin theory, does not mark any kinds as unevaluated and 56 : : // hence it is easy to check for illegal eliminations via TheoryModel 57 : : // (see TheoryModel::isLegalElimination) since there are no unevaluated kinds 58 : : // present. 59 : 49898 : } 60 : : 61 : 11 : TrustNode TheoryBuiltin::ppStaticRewrite(TNode n) 62 : : { 63 [ + + ]: 11 : if (n.getKind() == Kind::DISTINCT) 64 : : { 65 : 8 : Node bn = uf::TheoryUfRewriter::blastDistinct(nodeManager(), n); 66 : 8 : return TrustNode::mkTrustRewrite(n, bn); 67 : 8 : } 68 : 3 : return TrustNode::null(); 69 : : } 70 : : 71 : : } // namespace builtin 72 : : } // namespace theory 73 : : } // namespace cvc5::internal