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