mirror of
https://github.com/Z3Prover/z3
synced 2026-07-25 00:12:34 +00:00
Add symbolic-modulus congruence rule to nla_divisions (#10119)
Implement check_mod_congruence in nla_divisions: for two mod-atoms sharing a (possibly symbolic) divisor y, emit the model-guided tautology div(x,y) - div(s,y) = delta => mod(x,y) - mod(s,y) = (x - s) - delta*y. This discharges linear congruences over a symbolic modulus that the nonlinear core did not otherwise isolate. Thread the div(x,y) variable through add_divisibility (nla_core/nla_solver/nla_divisions) and register it in theory_lra for symbolic-divisor mod terms. Solves FStar.BitVector-1 (0.7s) and FStar.Matrix-1 (1.6s), previously 300s timeouts; all 92 unit tests pass. Copilot-Session: 726c4e71-03ff-45f6-8322-5253254e1d7e --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
This commit is contained in:
parent
82a0d42970
commit
2f48e355d8
6 changed files with 74 additions and 13 deletions
|
|
@ -489,13 +489,17 @@ class theory_lra::imp {
|
|||
// register mod(x, y) with variable divisor for divisibility reasoning
|
||||
ensure_nla();
|
||||
if (m_nla) {
|
||||
app_ref div(a.mk_idiv(n1, n2), m);
|
||||
ctx().internalize(div, false);
|
||||
internalize_term(to_app(div));
|
||||
internalize_term(to_app(n1));
|
||||
internalize_term(to_app(n2));
|
||||
internalize_term(t);
|
||||
theory_var d = mk_var(div);
|
||||
theory_var x = mk_var(n1);
|
||||
theory_var y = mk_var(n2);
|
||||
theory_var rv = mk_var(n);
|
||||
m_nla->add_divisibility(register_theory_var_in_lar_solver(rv), register_theory_var_in_lar_solver(x), register_theory_var_in_lar_solver(y));
|
||||
m_nla->add_divisibility(register_theory_var_in_lar_solver(rv), register_theory_var_in_lar_solver(x), register_theory_var_in_lar_solver(y), register_theory_var_in_lar_solver(d));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue