3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-24 17:45:32 +00:00

add proposed query interface

This commit is contained in:
Jakob Rath 2023-07-18 15:07:53 +02:00
parent bac52313da
commit 4742985906
2 changed files with 25 additions and 41 deletions

View file

@ -16,54 +16,21 @@ Author:
/*
(x=y)
x <=========== y
/ \ / \
x[7:4] x[3:0] y[3:0]
<==========
(by x=y)
Try later:
Congruence closure with "virtual concat" terms
x = x[7:4] ++ x[3:0]
y = y[7:4] ++ y[3:0]
x[7:4] = y[7:4]
x[3:0] = y[3:0]
=> x = y
Recycle the z3 egraph?
- x = x[7:4] ++ x[3:0]
- Add instance euf_egraph.h
- What do we need from the egraph?
- backtracking trail to check for new equalities
Example:
(1) x = y
(2) z = y[3:0]
(3) explain(x[3:0] == z)? should be { (1), (2) }
(1)
x ========================> y
/ \ / \ (2)
x[7:4] x[3:0] y[7:4] y[3:0] ===========> z
TODO:
- track fixed bits along with enodes
- notify solver about equalities discovered by congruence
- implement query functions
*/

View file

@ -253,9 +253,26 @@ namespace polysat {
/** Extract reason for x == y */
void explain_equal(pvar x, pvar y, sat::literal_vector& out_lits, unsigned_vector& out_vars);
// TODO:
// Query for a given variable v:
// - set of variables that share at least one slice with v (need variable, offset/width relative to v)
/// Example:
/// - assume query_var has segments 11122233 and var has segments 2224
/// - then the overlapping region "222" is given by width = 3, offset_var = 1, offset_query = 2.
/// (First version will probably only support offset 0.)
struct var_overlap {
pvar var;
/// number of overlapping bits
unsigned width;
/// offset of overlapping region in var
unsigned offset_var;
/// offset of overlapping region in query variable
unsigned offset_query;
};
using var_overlap_vector = svector<var_overlap>;
/** For a given variable v, find the set of variables that share at least one slice with v. */
void query_overlaps(pvar v, var_overlap_vector& out);
/** Query fixed portions of the variable v */
void query_fixed(pvar v, rational& mask, rational& value);
std::ostream& display(std::ostream& out) const;
std::ostream& display_tree(std::ostream& out) const;