450 likes | 580 Views
Solving Non-linear Arithmetic. Dejan Jovanovic and Leonadro de Moura Presented by Boris Trayvas. Outline. Background - Introduction - Conflict-Driven Clause Learning - Definitions An Abstract Decision Procedure - States and Well Formed States - Search, Clause & Conflict Rules
E N D
Solving Non-linear Arithmetic DejanJovanovic and Leonadro de Moura Presented by Boris Trayvas
Outline • Background - Introduction - Conflict-Driven Clause Learning - Definitions • An Abstract Decision Procedure - States and Well Formed States - Search, Clause & Conflict Rules • Producing Explanations - More Definitions - Intro to Cylindrical Algebraic Decomposition - Projection Based Explanations • Experimental Results
Introduction I • Everyone loves polynomials! • Tarski (1951) showed a decision procedure for elimination of quantifiers over the reals, which shows the existence of an (impractical) decision procedure for solving polynomial constraints. • Collins (1975) first showed a procedure using cylindrical algebraic decomposition (CAD).
Introduction II • CAD projects the polynomials from the initial problem onto connected components, eliminating variables. • The size of the projection set grows exponentially in the number of variables. • The paper presents a procedure that uses these projections conservatively.
Conflict-Driven Clause Learning • The Algorithm: • Black boxes: - PickBranchingVariable() – What variable to “guess” next? - UnitPropagation() – What can I learn from the new assignment? - ConflictAnalysis() – What clause should I add to prevent the conflict?
CDCL Example • Consider the formula written as , and the assignment x=0: unit propagation: unit propagation: conflict! conflict analysis adds • Note that unit propagation can eliminate variables.
Definitions I • We denoteℤ,ℚ,ℝ,ℂ as usual. • For a vector ,…,) and a set , we denote by all the polynomials with coefficients in and variables in . • is of the form where . We call the top variable, and refer to as variables of lower level. Unless stated otherwise, we assume . • Denote by the variables in polynomial . is univariate if for some , otherwise is multivariate or constant.
Definitions II • A number is the root of iff . • A number is algebraic iff it is a root of some . Denote the field of all algebraic numbers by . Note that we can represent any algebraic number as for , where is the only root of in the interval . For example, consider the univariate polynomial , the only root in the interval is , thus . • Given a set of variables ,…, we call a variable assignment. is the value of a polynomial under . If then vanishes under . • We update an assignment to map a variable to using .
Definitions III • A polynomial constraint is either a basic or an extended polynomial constraint. • A basic polynomial constraint is of the form where is a polynomial and▽. We identify the polynomial and the variables of using and , respectively. • Extended polynomial constraints are similar, but will be defined later. • is the evaluation of the constraint to if is a constant, or to a new constraint (with algebraic coefficients).
Definitions IV • Given a set of polynomial constraints , we say that the variable assignment satisfies if it satisfies each constraint in . If such exists we say is satisfiable. • A clause of polynomial constraints is of the form , where each is a polynomial constraint. is satisfied under if for some . • . Note that our literals are polynomials and not boolean variables. • For example, .
Polynomial Constraint Problem • A polynomial constraint problem is a set of clauses , and is satisfiable if for some all the clauses are satisfied. • Let be the variables of . Denote by the clauses that only contain variables .
An Abstract Decision Procedure • Although the algorithm is a CDCL-style algorithm, we will present it as an abstract transition system. • This system can be generalized to apply to theories other than non-linear arithmetic.
Trail and Trail Elements • States are indexed pairs where is the trail (formally a sequence), made of trail elements, and is a set of clauses. is the current stage. • Trail elements can be one of the following: - A decided literal, which is a constraint , which represents a constraint we assume to be true. - A propagated literal of the form with , which means is implied to be true by . - A trail variable assignment written as . This is a partial assignment. • If or appear in the sequence we write . • We say is non redundant if no appears in twice (in either form).
Trail Examples I • Consider the (abstract) examples • We have, and is redundant. • and is non redundant. • and is non redundant.
The Implied Assignment • denotes the empty assignment. • Given a trail containing variable assignments we can construct the appropriate partial assignment from , denoted as . • For example,
Stage Increasing • M is stage increasing if it is of the form where every contains no variable assignments and • We extract n using . • Note that does not contain an assignment for . • Intuitively, we are building one variable at a time, and we justify our decisions in between. • We say for a constraint if can be extended to an assignment satisfying .
Trail Examples II • Which of the following is stage increasing? Assume • ? No. is assigned before . • ? No. is assigned but is not. • ? Yes.
Value • For a polynomial and of stage . • For a clause , we have if any of the literals evaluate to true, false if all of them evaluate to false, and undef otherwise. • For a set of clauses , we have if all of the clauses evaluate to true, false if any of them evaluate to false, and undef otherwise.
Well-Formed State • We say state is well-formed when is non redundant, stae increasing and: - Clauses up to stage n are satisfied. That is, . - There exists an assignment extension of satisfying . - Propagated literals are implied, that means for all .
The Transition System • The starting state will be for a constraint problem . • The system will have two end states: - , indicating that is satisfiable with the assignment . - unsat, indicating that is unsatisfiable. • We will have three groups of rules: search rules, clause satisfaction rules and conflict analysis rules.
Search Rules I • Search rules: These select the clause to process, select a variable assignment to lift the stage and detect conflicts. • They operate on well formed states, moving to another well formed state, a conflict analysis state ⊢ for a clause , or a clause processing state ⊨ for a clause . • To move to the next stage, the current state needs to satisfy all .
Search Rules – Select-Clause • The Select-Clause rule selects a clause from the current stage for which the value is undefined and moves to the clause processing mode to satisfy it.
Search Rules - Conflict • The Conflict rule detects a clause from the current stage that is inconsistent and tries to resolve the conflict it by moving to the conflict analysis mode.
Search Rules Lift-Level • If neither Select-Clause or Conflict apply then all the clauses in the current stage are satisfied. We can move to the next stage using Lift-Level by adding the assignment for an which solves
Search Rules - SAT • How is it possible that • This line assumes some “magical” order on the variables. I prefer the condition .
Search Rules - Forget • The last rule is the Forget rule, that allows us to eliminate a clause that was added while analyzing conflicts.
Search Rules II • Note that once we move to the next stage, all the clauses of the previous stages are satisfied, and they will not be selected by the Select-Clause or Conflict rules.
Clause Processing Rules • These rules start from a state of the form ⊨ and use one of the rules to satisfy a literal of the currently unsatisfied . • Once a rule is applied, we immediately switch back to the search rules.
Processing Rules – B-Propagate • We try to use Boolean propagation to find a literal that needs to be satisfied. means that there exists an assignment that satisfies .
Processing Rules – R-Propagate • The function, returns a clause that is valid in and implies (that is, is the only literal in that is not false). Explain may add new clauses, but only using variables from lower levels, so their truth value can not change.
Processing Rules – Decide-Literal • If neither of the propagate rules works, we assume that some literal is true for a compatible literal.
Conflict Analysis Rules • These rules start from an initial state ⊢ where is the conflicting clause. • The goal is to construct a new resolvant that will allow the search rules to move forward. • The rules move us to a new conflict analysis state, to a clause satisfaction state or the unsat state. • If we backtrack to the initial state with a conflicting literal, this means the original problem is unsatisfiable and we return unsat.
Conflict Rules– Resolve-Propagation • Resolve returns a clause that is the resolution of . We abort the last step that explains , and try to resolve . • This is why we care about having an explanation for some literals.
Conflict Rules – Resolve Decision • We eliminate the last step which assumes (with no explanation) and try to satisfy the clause , which we might do by assuming .
Conflict Rules - Consume • Note that in this operation . • This might happen if we guessed the wrong literal during a search step. • We cancel the last step, and try to resolve again.
Conflict Rules – Drop-Stage • If the last stage was an assignment we can’t use the other rules, so we have to cancel it. • If and (before the last assignment) conflict, we will again return to a conflicting state and will try to solve it. • If they do not conflict, we try to satisfy .
Conflict Rules - Unsat • Finally, if we backtrack all the way to the beginning with a conflict, we will return unsat.
Termination Theorem • Finite basis explanation function is a function that only adds constraints taken from a finite set .
The Explain Procedure • All we are missing now is the procedure. We will show the general outline of this procedure, but will not go into details. • Given a polynomial constraint with and a trail such that are not compatible (that is, no assignment satisfies ), the procedure returns an explanation that implies in the current state. • This can be done for any theory that admits quantifier elimination. We will show how to do this for the theor of the reals, using cylindrical algebraic decomposition.
Definitions V • An extended polynomial constraint is of the form where , s.t.. ) is the root index. is a free variable that cannot be used outside . • Define ,x). Note that was replaced with . • under iff 1. is univariate, and assigns . 2. has roots , 3.
A much needed example • Consider the extended polynomial constraint and .We have ; with roots 0<1.Thus, for we get and for k=2 we get .
Intro to CAD • A subset will be called connected if it is not the union of two open disjoint nonempty subsets. Intuitively this means that it is possible to move between any two points in without leaving it. We will refer such an as a region. • A set of polynomials with will be called delineable in a region if for every the following properties are invariant for any : - the total number of roots of , which is equal to ) - the number of distinct complex roots of - the number of common complex roots of with . Example: when is not delineable.
Projection-Based Explanations • Suppose we are in a state such that with . • The procedure consists of the following steps: - Isolate Core: Find a conflicting core that contains . That is, a set of literals such that has no solution for . - Project: Construct a region of where is delineable. This implies that is not compatible with . - Explain: Define the region S using (new) extended polynomial constraints . Return .
Experimental Results • The algorithm (nlsat) did overall better than other algorithms. Each other algorithm was generally good at one or two problem sets and not so good on the others, but this algorithm was pretty good on all the problem sets.