Skip to content

Commit

Permalink
fixing processing of alpha-equiv
Browse files Browse the repository at this point in the history
  • Loading branch information
HanielB committed Feb 8, 2024
1 parent 381a6ed commit 4b3a87a
Showing 1 changed file with 22 additions and 27 deletions.
49 changes: 22 additions & 27 deletions src/proof/alethe/alethe_post_processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1557,20 +1557,25 @@ bool AletheProofPostprocessCallback::update(Node res,
// ... (zn An)) G*sigma)
//
//
// ----- ----- REFL ----- REFL
// VP1 .... VPn VP
// -------------------------- BIND, ((:= (y1 A1) z1) ... (:= (yn An) zn))
// (= F F*sigma)
//
// VPi: (cl (= yi zi))^
// VP: (cl (= G G*sigma))
// ------------------ REFL
// (cl (= G G*sigma))
// -------------------- BIND, ((= y1 z1) ... (= yn zn))
// (= F F*sigma)
//
// ^ the corresponding proof node is F*sigma
case ProofRule::ALPHA_EQUIV:
{
std::vector<Node> varEqs;
// performance optimization
// If y1 ... yn are mapped to y1 ... yn it suffices to use a refl step
if (res[0].toString() == res[1].toString())
bool allSame = true;
for (size_t i = 0, size = res[0][0].getNumChildren(); i < size; ++i)
{
Node v0 = res[0][0][i], v1 = res[1][0][i];
allSame = allSame && v0.getName() == v1.getName();
varEqs.push_back(v0.eqNode(v1));
}
if (allSame)
{
return addAletheStep(AletheRule::REFL,
res,
Expand All @@ -1579,27 +1584,17 @@ bool AletheProofPostprocessCallback::update(Node res,
{},
*cdp);
}

std::vector<Node> new_children;
bool success = true;
for (size_t i = 1, size = args.size(); i < size; i++)
{
Node vpi = nm->mkNode(Kind::SEXPR, d_cl, args[i]);
new_children.push_back(vpi);
success&& addAletheStep(AletheRule::REFL, vpi, vpi, {}, {}, *cdp);
}
// Reflexivity over the quantified bodies
Node vp = nm->mkNode(
Kind::SEXPR, d_cl, nm->mkNode(Kind::EQUAL, res[0][1], res[1][1]));
success&& addAletheStep(AletheRule::REFL, vp, vp, {}, {}, *cdp);
new_children.push_back(vp);
new_args.insert(new_args.begin(), args.begin() + 1, args.end());
return success
&& addAletheStep(AletheRule::ANCHOR_BIND,
res,
nm->mkNode(Kind::SEXPR, d_cl, res),
new_children,
new_args,
*cdp);
addAletheStep(AletheRule::REFL, vp, vp, {}, {}, *cdp);
new_args.insert(new_args.end(), varEqs.begin(), varEqs.end());
return addAletheStep(AletheRule::ANCHOR_BIND,
res,
nm->mkNode(Kind::SEXPR, d_cl, res),
{vp},
new_args,
*cdp);
}
//================================================= Arithmetic rules
// ======== Adding Scaled Inequalities
Expand Down

0 comments on commit 4b3a87a

Please sign in to comment.