From 5e545c8f86b9a82c09dba062b2e73e0c0348c10c Mon Sep 17 00:00:00 2001 From: Jakob Rath Date: Wed, 7 Feb 2024 15:26:15 +0100 Subject: [PATCH] Add merge_level --- src/sat/smt/polysat_egraph.cpp | 9 +++++++++ src/sat/smt/polysat_solver.h | 1 + 2 files changed, 10 insertions(+) diff --git a/src/sat/smt/polysat_egraph.cpp b/src/sat/smt/polysat_egraph.cpp index 56246c97b..f55d25088 100644 --- a/src/sat/smt/polysat_egraph.cpp +++ b/src/sat/smt/polysat_egraph.cpp @@ -23,6 +23,15 @@ Author: namespace polysat { + unsigned solver::merge_level(euf::enode* a, euf::enode* b) { + sat::literal_vector r; + ctx.get_eq_antecedents(a, b, r); + unsigned level = 0; + for (sat::literal lit : r) + level = std::max(level, s().lvl(lit)); + return level; + } + // walk the egraph starting with pvar for suffix overlaps. void solver::get_bitvector_suffixes(pvar pv, offset_slices& out) { uint_set seen; diff --git a/src/sat/smt/polysat_solver.h b/src/sat/smt/polysat_solver.h index c70a89989..321b807fd 100644 --- a/src/sat/smt/polysat_solver.h +++ b/src/sat/smt/polysat_solver.h @@ -111,6 +111,7 @@ namespace polysat { sat::check_result intblast(); + unsigned merge_level(euf::enode* a, euf::enode* b); void explain_slice(pvar v, pvar w, unsigned offset, std::function const& consume); void explain_fixed(pvar v, fixed_slice const& s, std::function const& consume_eq);