Skip to content

Commit 499268a

Browse files
Fix matching logic in solver to ensure correct field comparisons and simplify equality checks.
1 parent 5e01002 commit 499268a

File tree

2 files changed

+14
-17
lines changed

2 files changed

+14
-17
lines changed

src/st/stsolver.cpp

+13-16
Original file line numberDiff line numberDiff line change
@@ -431,15 +431,15 @@ namespace ratio
431431
else if (auto lhs_xpr = dynamic_cast<riddle::atom_term *>(&lhs))
432432
{ // we are dealing with atoms..
433433
auto rhs_xpr = static_cast<riddle::atom_term *>(&rhs);
434-
if (&lhs_xpr->get_type().get_scope() != &rhs_xpr->get_type().get_scope().get_core() && !match(*lhs_xpr->get(riddle::this_kw), *rhs_xpr->get(riddle::this_kw)))
434+
if (&lhs_xpr->get_type().get_scope() != &rhs_xpr->get_type().get_scope().get_core() && !match(*lhs_xpr->get(riddle::tau_kw), *rhs_xpr->get(riddle::tau_kw)))
435435
return false; // the atoms are not in the same scope, so they cannot match..
436436
// we check if the atoms' fields match..
437437
std::queue<riddle::predicate *> q;
438438
q.push(static_cast<riddle::predicate *>(&lhs_xpr->get_type()));
439439
while (!q.empty())
440440
{
441441
for (const auto &[f_name, f] : q.front()->get_fields())
442-
if (!f->is_synthetic() && !match(*lhs_xpr->get(f_name), *rhs_xpr->get(f_name)))
442+
if (!match(*lhs_xpr->get(f_name), *rhs_xpr->get(f_name)))
443443
return false;
444444
for (const auto &pp : q.front()->get_parents())
445445
q.push(&*pp);
@@ -518,8 +518,7 @@ namespace ratio
518518
while (!q.empty())
519519
{
520520
for (const auto &[f_name, f] : q.front()->get_fields())
521-
if (!f->is_synthetic())
522-
make_eq(*lhs_xpr->get(f_name), *rhs_xpr->get(f_name), p);
521+
make_eq(*lhs_xpr->get(f_name), *rhs_xpr->get(f_name), p);
523522
for (const auto &pp : q.front()->get_parents())
524523
q.push(&*pp);
525524
q.pop();
@@ -580,12 +579,11 @@ namespace ratio
580579
while (!q.empty())
581580
{
582581
for (const auto &[f_name, f] : q.front()->get_fields())
583-
if (!f->is_synthetic())
584-
{
585-
auto neq = utils::lit(mk_var());
586-
make_neq(*lhs_at_xpr->get(f_name), *rhs_at_xpr->get(f_name), neq);
587-
clause.push_back(neq);
588-
}
582+
{
583+
auto neq = utils::lit(mk_var());
584+
make_neq(*lhs_at_xpr->get(f_name), *rhs_at_xpr->get(f_name), neq);
585+
clause.push_back(neq);
586+
}
589587
for (const auto &pp : q.front()->get_parents())
590588
q.push(&*pp);
591589
q.pop();
@@ -602,12 +600,11 @@ namespace ratio
602600
while (!q.empty())
603601
{
604602
for (const auto &[f_name, f] : q.front()->get_fields())
605-
if (!f->is_synthetic())
606-
{
607-
auto neq = utils::lit(mk_var());
608-
make_neq(*lhs_c_xpr->get(f_name), *rhs_c_xpr->get(f_name), neq);
609-
clause.push_back(neq);
610-
}
603+
{
604+
auto neq = utils::lit(mk_var());
605+
make_neq(*lhs_c_xpr->get(f_name), *rhs_c_xpr->get(f_name), neq);
606+
clause.push_back(neq);
607+
}
611608
for (const auto &pp : q.front()->get_parents())
612609
q.push(&*pp);
613610
q.pop();

0 commit comments

Comments
 (0)