This adds proofs for sets purification lemmas, which are of the form (= t (skolem t)) and (member t (skolem (singleton t))). Each can be trivially justified in the internal calculus by MACRO_SR_PRED_INTRO.
std::map<SkolemId, Node>::iterator it = d_skolemCache[a][b].find(id);
if (it == d_skolemCache[a][b].end())
{
- Node sk = mkTypedSkolem(tn, c);
+ SkolemManager* sm = NodeManager::currentNM()->getSkolemManager();
+ Node sk;
+ if (id == SkolemId::SK_PURIFY)
+ {
+ Assert(a.getType() == tn);
+ sk = sm->mkPurifySkolem(a, c);
+ }
+ else
+ {
+ sk = sm->mkDummySkolem(c, tn, "sets skolem");
+ }
d_skolemCache[a][b][id] = sk;
+ d_allSkolems.insert(sk);
return sk;
}
return it->second;
TermRegistry::TermRegistry(SolverState& state,
InferenceManager& im,
- SkolemCache& skc)
+ SkolemCache& skc,
+ ProofNodeManager* pnm)
: d_im(im),
d_skCache(skc),
d_proxy(state.getUserContext()),
- d_proxy_to_term(state.getUserContext())
+ d_proxy_to_term(state.getUserContext()),
+ d_epg(
+ pnm ? new EagerProofGenerator(pnm, nullptr, "sets::TermRegistry::epg")
+ : nullptr)
{
}
NodeManager* nm = NodeManager::currentNM();
Node k = d_skCache.mkTypedSkolemCached(
n.getType(), n, SkolemCache::SK_PURIFY, "sp");
+
d_proxy[n] = k;
d_proxy_to_term[k] = n;
Node eq = k.eqNode(n);
- Trace("sets-lemma") << "Sets::Lemma : " << eq << " by proxy" << std::endl;
- d_im.lemma(eq, InferenceId::SETS_PROXY);
+ sendSimpleLemmaInternal(eq, InferenceId::SETS_PROXY);
if (nk == SINGLETON)
{
Node slem = nm->mkNode(MEMBER, n[0], k);
- Trace("sets-lemma") << "Sets::Lemma : " << slem << " by singleton"
- << std::endl;
- d_im.lemma(slem, InferenceId::SETS_PROXY_SINGLETON);
+ sendSimpleLemmaInternal(slem, InferenceId::SETS_PROXY_SINGLETON);
}
return k;
}
}
}
+void TermRegistry::sendSimpleLemmaInternal(Node n, InferenceId id)
+{
+ Trace("sets-lemma") << "Sets::Lemma : " << n << " by " << id << std::endl;
+ if (d_epg.get() != nullptr)
+ {
+ TrustNode teq =
+ d_epg->mkTrustNode(n, PfRule::MACRO_SR_PRED_INTRO, {}, {n});
+ d_im.trustedLemma(teq, id);
+ }
+ else
+ {
+ d_im.lemma(n, id);
+ }
+}
+
} // namespace sets
} // namespace theory
} // namespace cvc5
#include <vector>
#include "context/cdhashmap.h"
+#include "theory/eager_proof_generator.h"
#include "theory/sets/inference_manager.h"
#include "theory/sets/skolem_cache.h"
#include "theory/sets/solver_state.h"
typedef context::CDHashMap<Node, Node, NodeHashFunction> NodeMap;
public:
- TermRegistry(SolverState& state, InferenceManager& im, SkolemCache& skc);
+ TermRegistry(SolverState& state,
+ InferenceManager& im,
+ SkolemCache& skc,
+ ProofNodeManager* pnm);
/** Get type constraint skolem
*
* The sets theory solver outputs equality lemmas of the form:
void debugPrintSet(Node s, const char* c) const;
private:
+ /** Send simple lemma internal */
+ void sendSimpleLemmaInternal(Node n, InferenceId id);
/** The inference manager */
InferenceManager& d_im;
/** Reference to the skolem cache */
std::map<TypeNode, Node> d_emptyset;
/** Map from types to universe set of that type */
std::map<TypeNode, Node> d_univset;
+ /** Eager proof generator for purification lemmas */
+ std::unique_ptr<EagerProofGenerator> d_epg;
}; /* class TheorySetsPrivate */
} // namespace sets
d_skCache(),
d_state(c, u, valuation, d_skCache),
d_im(*this, d_state, nullptr),
- d_internal(new TheorySetsPrivate(*this, d_state, d_im, d_skCache)),
+ d_internal(new TheorySetsPrivate(*this, d_state, d_im, d_skCache, pnm)),
d_notify(*d_internal.get(), d_im)
{
// use the official theory state and inference manager objects
TheorySetsPrivate::TheorySetsPrivate(TheorySets& external,
SolverState& state,
InferenceManager& im,
- SkolemCache& skc)
+ SkolemCache& skc,
+ ProofNodeManager* pnm)
: d_deq(state.getSatContext()),
d_termProcessed(state.getUserContext()),
d_fullCheckIncomplete(false),
d_state(state),
d_im(im),
d_skCache(skc),
- d_treg(state, im, skc),
+ d_treg(state, im, skc, pnm),
d_rels(new TheorySetsRels(state, im, skc, d_treg)),
d_cardSolver(new CardinalityExtension(state, im, d_treg)),
d_rels_enabled(false),
TheorySetsPrivate(TheorySets& external,
SolverState& state,
InferenceManager& im,
- SkolemCache& skc);
+ SkolemCache& skc,
+ ProofNodeManager* pnm);
~TheorySetsPrivate();