-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
143 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
/****************************************************************************** | ||
* Top contributors (to current version): | ||
* Andrew Reynolds | ||
* | ||
* This file is part of the cvc5 project. | ||
* | ||
* Copyright (c) 2009-2024 by the authors listed in the file AUTHORS | ||
* in the top-level source directory and their institutional affiliations. | ||
* All rights reserved. See the file COPYING in the top-level source | ||
* directory for licensing information. | ||
* **************************************************************************** | ||
* | ||
* Utilities for monomials. | ||
*/ | ||
|
||
#include "theory/arith/nl/ext/arith_nl_compare_proof_gen.h" | ||
|
||
#include "theory/arith/arith_utilities.h" | ||
#include "theory/arith/nl/ext/monomial_check.h" | ||
|
||
namespace cvc5::internal { | ||
namespace theory { | ||
namespace arith { | ||
namespace nl { | ||
|
||
ArithNlCompareProofGenerator::ArithNlCompareProofGenerator(Env& env) : EnvObj(env), d_absConv(env) {} | ||
ArithNlCompareProofGenerator::~ArithNlCompareProofGenerator() {} | ||
|
||
std::shared_ptr<ProofNode> ArithNlCompareProofGenerator::getProofFor(Node fact) | ||
{ | ||
Assert (fact.getKind()==Kind::IMPLIES); | ||
std::vector<Node> exp; | ||
if (fact[0].getKind()==Kind::AND) | ||
{ | ||
exp.insert(exp.end(), fact[0].begin(), fact[0].end()); | ||
} | ||
else | ||
{ | ||
exp.emplace_back(fact[0]); | ||
} | ||
Node conc = fact[1]; | ||
CDProof cdp(d_env); | ||
cdp.addStep(conc, ProofRule::MACRO_ARITH_NL_COMPARISON, exp, {conc}); | ||
cdp.addStep(fact, ProofRule::SCOPE, {conc}, exp); | ||
return cdp.getProofFor(fact); | ||
} | ||
|
||
std::string ArithNlCompareProofGenerator::identify() const { return "ArithNlCompareProofGenerator"; } | ||
|
||
Node ArithNlCompareProofGenerator::mkLit(NodeManager* nm, Kind k, Node a, Node b, bool isAbsolute) | ||
{ | ||
if (isAbsolute) | ||
{ | ||
a = nm->mkNode(Kind::ABS, a); | ||
b = nm->mkNode(Kind::ABS, b); | ||
} | ||
if (k==Kind::EQUAL) | ||
{ | ||
return mkEquality(a, b); | ||
} | ||
return nm->mkNode(k, a, b); | ||
} | ||
|
||
} // namespace nl | ||
} // namespace arith | ||
} // namespace theory | ||
} // namespace cvc5::internal | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/****************************************************************************** | ||
* Top contributors (to current version): | ||
* Andrew Reynolds | ||
* | ||
* This file is part of the cvc5 project. | ||
* | ||
* Copyright (c) 2009-2024 by the authors listed in the file AUTHORS | ||
* in the top-level source directory and their institutional affiliations. | ||
* All rights reserved. See the file COPYING in the top-level source | ||
* directory for licensing information. | ||
* **************************************************************************** | ||
* | ||
* Utilities for monomials. | ||
*/ | ||
|
||
#ifndef CVC5__THEORY__ARITH__NL__EXT__ARITH_NL_COMPARE_PROOF_GEN_H | ||
#define CVC5__THEORY__ARITH__NL__EXT__ARITH_NL_COMPARE_PROOF_GEN_H | ||
|
||
#include "smt/env_obj.h" | ||
#include "proof/proof_generator.h" | ||
#include "proof/conv_proof_generator.h" | ||
|
||
namespace cvc5::internal { | ||
namespace theory { | ||
namespace arith { | ||
namespace nl { | ||
|
||
class ArithNlCompareProofGenerator : protected EnvObj, public ProofGenerator | ||
{ | ||
public: | ||
ArithNlCompareProofGenerator(Env& env); | ||
virtual ~ArithNlCompareProofGenerator(); | ||
/** | ||
*/ | ||
std::shared_ptr<ProofNode> getProofFor(Node fact) override; | ||
/** identify */ | ||
std::string identify() const override; | ||
/** Make literal */ | ||
static Node mkLit(NodeManager* nm, Kind k, Node a, Node b, bool isAbsolute); | ||
private: | ||
/** Converter for absolute value literals */ | ||
TConvProofGenerator d_absConv; | ||
}; | ||
|
||
} // namespace nl | ||
} // namespace arith | ||
} // namespace theory | ||
} // namespace cvc5::internal | ||
|
||
#endif /* CVC5__THEORY__ARITH__NL_MONOMIAL_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters