3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-27 19:05:51 +00:00

User Propagator: Return if propagated lemma is redundant (#6791)

* Give users ability to see if propagation failed

* Skip propagations in the new core if they are already satisfied
This commit is contained in:
Clemens Eisenhofer 2023-07-07 18:58:41 +02:00 committed by GitHub
parent f5c069f899
commit 4cb158a79b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 48 additions and 31 deletions

View file

@ -252,21 +252,29 @@ namespace Microsoft.Z3
/// <summary>
/// Propagate consequence
/// <returns>
/// <see langword="true" /> if the propagated expression is new for the solver;
/// <see langword="false" /> if the propagation was ignored
/// </returns>
/// </summary>
public void Propagate(IEnumerable<Expr> terms, Expr conseq)
public bool Propagate(IEnumerable<Expr> terms, Expr conseq)
{
Propagate(terms, new EqualityPairs(), conseq);
return Propagate(terms, new EqualityPairs(), conseq);
}
/// <summary>
/// Propagate consequence
/// <returns>
/// <see langword="true" /> if the propagated expression is new for the solver;
/// <see langword="false" /> if the propagation was ignored
/// </returns>
/// </summary>
public void Propagate(IEnumerable<Expr> terms, EqualityPairs equalities, Expr conseq)
public bool Propagate(IEnumerable<Expr> terms, EqualityPairs equalities, Expr conseq)
{
var nTerms = Z3Object.ArrayToNative(terms.ToArray());
var nLHS = Z3Object.ArrayToNative(equalities.LHS.ToArray());
var nRHS = Z3Object.ArrayToNative(equalities.RHS.ToArray());
Native.Z3_solver_propagate_consequence(ctx.nCtx, this.callback, (uint)nTerms.Length, nTerms, (uint)equalities.Count, nLHS, nRHS, conseq.NativeObject);
return Native.Z3_solver_propagate_consequence(ctx.nCtx, this.callback, (uint)nTerms.Length, nTerms, (uint)equalities.Count, nLHS, nRHS, conseq.NativeObject) != 0;
}