-
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.
Add proof support in rewrite and extended rewrite preprocessing passes (
cvc5#11271) These passes did not have proof support; reconstruction would automatically determine that the steps they added corresponded to rewrites. Due to forthcoming changes that are more pedantic about tracking trusted steps, it is better if they have explicit support. A utility is added for this purpose. --------- Co-authored-by: Haniel Barbosa <[email protected]>
- Loading branch information
Showing
10 changed files
with
165 additions
and
11 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
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
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
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,59 @@ | ||
/****************************************************************************** | ||
* 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. | ||
* **************************************************************************** | ||
* | ||
* Rewrite proof generator utility. | ||
*/ | ||
|
||
#include "proof/rewrite_proof_generator.h" | ||
|
||
#include "proof/proof_node_manager.h" | ||
#include "smt/env.h" | ||
|
||
namespace cvc5::internal { | ||
|
||
RewriteProofGenerator::RewriteProofGenerator(Env& env, MethodId id) | ||
: EnvObj(env), ProofGenerator(), d_id(id) | ||
{ | ||
// initialize the proof args | ||
addMethodIds(d_pargs, MethodId::SB_DEFAULT, MethodId::SBA_SEQUENTIAL, d_id); | ||
} | ||
RewriteProofGenerator::~RewriteProofGenerator() {} | ||
|
||
std::shared_ptr<ProofNode> RewriteProofGenerator::getProofFor(Node fact) | ||
{ | ||
if (fact.getKind() != Kind::EQUAL) | ||
{ | ||
Assert(false) << "Expected an equality in RewriteProofGenerator, got " | ||
<< fact; | ||
return nullptr; | ||
} | ||
ProofNodeManager* pnm = d_env.getProofNodeManager(); | ||
const Node& t = fact[0]; | ||
Node tp = d_env.rewriteViaMethod(t, d_id); | ||
if (tp != fact[1]) | ||
{ | ||
Assert(false) << "Could not prove " << fact << " via RewriteProofGenerator"; | ||
return nullptr; | ||
} | ||
std::vector<Node> pargs{t}; | ||
pargs.insert(pargs.end(), d_pargs.begin(), d_pargs.end()); | ||
std::shared_ptr<ProofNode> pf = | ||
pnm->mkNode(ProofRule::MACRO_SR_EQ_INTRO, {}, pargs, fact); | ||
return pf; | ||
} | ||
|
||
std::string RewriteProofGenerator::identify() const | ||
{ | ||
return "RewriteProofGenerator"; | ||
} | ||
|
||
} // 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,64 @@ | ||
/****************************************************************************** | ||
* 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. | ||
* **************************************************************************** | ||
* | ||
* Rewrite proof generator utility. | ||
*/ | ||
|
||
#include "cvc5_private.h" | ||
|
||
#ifndef CVC5__PROOF__REWRITE_PROOF_GENERATOR_H | ||
#define CVC5__PROOF__REWRITE_PROOF_GENERATOR_H | ||
|
||
#include "proof/method_id.h" | ||
#include "proof/proof_generator.h" | ||
#include "smt/env_obj.h" | ||
|
||
namespace cvc5::internal { | ||
|
||
class ProofNode; | ||
class ProofNodeManager; | ||
|
||
/** | ||
* This class is used as a (lazy) proof generator for macro rewrite steps | ||
* (e.g. proof rule MACRO_SR_EQ_INTRO). Its getProofFor method is assumed to | ||
* always prove equalities by rewrites for the given method id. | ||
*/ | ||
class RewriteProofGenerator : protected EnvObj, public ProofGenerator | ||
{ | ||
public: | ||
/** | ||
* @param env Reference to the environment | ||
* @param id The method id, which determines the method of rewriting this | ||
* proof generator proves equalites for. | ||
*/ | ||
RewriteProofGenerator(Env& env, MethodId id = MethodId::RW_REWRITE); | ||
virtual ~RewriteProofGenerator(); | ||
/** | ||
* Get proof for fact. It should be that fact is an equality of the form | ||
* t = t', where t' is d_env.rewriteViaMethod(t, d_id). | ||
* If this is not the case, nullptr is returned and an assertion is thrown | ||
* in debug mode. | ||
*/ | ||
std::shared_ptr<ProofNode> getProofFor(Node fact) override; | ||
/** identify */ | ||
std::string identify() const override; | ||
|
||
private: | ||
/** The method id */ | ||
MethodId d_id; | ||
/** Proof args */ | ||
std::vector<Node> d_pargs; | ||
}; | ||
|
||
} // namespace cvc5::internal | ||
|
||
#endif /* CVC5__PROOF__REWRITE_PROOF_GENERATOR_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