0% found this document useful (0 votes)
11 views101 pages

Combinations of Boolean Groebner Bases and SAT Solvers

Uploaded by

Gautham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views101 pages

Combinations of Boolean Groebner Bases and SAT Solvers

Uploaded by

Gautham
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 101

Combinations of Boolean Gröbner Bases

and SAT Solvers

Thanh Hung Nguyen

Vom Fachbereich Mathematik der Technischen Universität Kaiserslautern


zur Verleihung des akademischen Grades Doktor der Naturwissenschaften
(Doctor rerum naturalium, Dr. rer. nat.) genehmigte Dissertation.

1. Gutachter: Prof. Dr. Gerhard Pfister


2. Gutachter: Prof. Dr. Martin Kreuzer

Datum der Disputation: 12.12.2014

D386
To my family
Acknowledgments
I would like to express my deep gratitude to Professor Gerhard Pfister, my supervisor, for his
patient guidance, enthusiastic encouragement of this thesis. I would also like to thank Dr.
Alexander Dreyer and Dr. Michael Brickenstein for their advice and assistance during my
research progress. My grateful thanks are also extended to Dipl.-Ing. Oliver Marx for his help
in hardware description language VHDL. I would like to express my very great appreciation
to Dr. Avi Yadgar for sharing his source code with me.
I would also like to offer my special thanks to the department SYS in ITWM for their
financial support and an excellent research environment.
Finally, I wish to thank my family.
ii
Contents
List of Algorithms v

List of Figures vii

List of Tables ix

Introduction 1

1 Boolean Satisfiability and Boolean Gröbner bases 3


1.1 Boolean Satisfiability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.1 The satisfiability problem . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.1.2 DPLL SAT Solver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.1.3 Conflict Driven Clause Learning SAT Solver . . . . . . . . . . . . . . . 6
1.2 Gröbner bases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.2.1 Monomial ordering . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
1.2.2 Normal forms and Gröbner bases . . . . . . . . . . . . . . . . . . . . . 10
1.3 Boolean Gröbner bases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3.1 Boolean polynomials . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
1.3.2 Boolean Gröbner bases . . . . . . . . . . . . . . . . . . . . . . . . . . . 13

2 Relations between Boolean polynomials and CNFs 15


2.1 Converting Boolean polynomials to CNFs . . . . . . . . . . . . . . . . . . . . 15
2.2 Converting CNFs to Boolean polynomials . . . . . . . . . . . . . . . . . . . . 17
2.3 Some relations between Boolean polynomials and CNFs . . . . . . . . . . . . . 19

3 Extending clause learning of SAT Solvers 23


3.1 Extending clause learning of SAT Solvers . . . . . . . . . . . . . . . . . . . . . 23
3.2 Implementation and Benchmarks . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.3 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26

4 Elimination by all-solutions SAT and interpolation 29


4.1 Gröbner bases and Elimination . . . . . . . . . . . . . . . . . . . . . . . . . . 29
4.2 All-SAT Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
4.3 The Buchberger-Möller Algorithm for Boolean Polynomials . . . . . . . . . . . 30
4.4 Ideal of points by interpolation . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.5 SAT and Interpolation approach . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.6 Experimental results . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
4.7 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39

5 Verification by abstraction and computer algebra techniques 43


5.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
5.2 VHDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44

iii
5.3 Algebraic models . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.4 Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.4.1 Multiplier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
5.4.2 FIR Filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
5.5 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 52

A Designs of a multiplier and a filter 53


A.1 Multiplier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
A.2 FIR filter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54

B Implementation source codes 61


B.1 Codes used in Chapter 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
B.2 Codes used in Chapter 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
B.3 Codes used in Chapter 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74

iv
List of Algorithms
1.1.1 DPLL algorithm, DPLL(F ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.1.2 Typical CDCL algorithm, CDCL(F, ν) . . . . . . . . . . . . . . . . . . . . . . 7
1.2.1 Normal form, N F (f | G) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.2.2 Reduced normal form, redN F (f | G) . . . . . . . . . . . . . . . . . . . . . . . 11
1.2.3 Gröbner basis of S ⊂ K[x], K is field . . . . . . . . . . . . . . . . . . . . . . . 11
1.2.4 Gröbner basis of S ⊂ R[x], R is principal ring . . . . . . . . . . . . . . . . . . 12

2.1.1 ANF to CNF conversion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16

4.3.1 Classical Buchberger-Möller Algorithm . . . . . . . . . . . . . . . . . . . . . . 31


4.3.2 Optimize BMA for lexicographical ordering . . . . . . . . . . . . . . . . . . . . 32
4.3.3 gen sorted cand stdmonos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3.4 gen sorted cand stdmonos bool . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.4.1 interpolate smallest lex(bOZ) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
4.4.2 Reduced lexicographical normal form against variety . . . . . . . . . . . . . . 36
4.4.3 Standard monomials of I(P): standard monomials variety(P) . . . . . . . . . . 37
4.4.4 Leading monomials of a minimal Gröbner basis of I(P) . . . . . . . . . . . . . 37
4.4.5 lex groebner basis points(P ) . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
4.5.1 SATElim . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38

v
vi
List of Figures
1.1 Implication graphs with 1-UIP cuts . . . . . . . . . . . . . . . . . . . . . . . . 8

3.1 SAT solving time in seconds. . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27

5.1 Clock signal in form of a square wave . . . . . . . . . . . . . . . . . . . . . . . 44

vii
viii
List of Tables
1.1 First decisions of CDCL Algorithm . . . . . . . . . . . . . . . . . . . . . . . . 8

3.1 Compare two BGB learning schemes. . . . . . . . . . . . . . . . . . . . . . . . 25


3.2 Analyze affects of density upper-bounds. . . . . . . . . . . . . . . . . . . . . . 26
3.3 Affects of density upper-bounds on solving time . . . . . . . . . . . . . . . . . 26
3.4 Compare solving time. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
3.5 Analyze binary clause learned by BGBs. . . . . . . . . . . . . . . . . . . . . . 27

4.1 BMA example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33


4.2 BMAlex example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3 Compare BDA and BMAlex . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38
4.4 Comapre two approaches on some Automata benchmarks. . . . . . . . . . . . 40
4.5 Comapre two approaches on some simplified benchmarks. . . . . . . . . . . . . 41

5.1 Verify multiplier by abstraction and computer algebra . . . . . . . . . . . . . . 49


5.2 Signal names and their corresponding variable names . . . . . . . . . . . . . . 50
5.3 Transformations of all asynchronous assignments . . . . . . . . . . . . . . . . . 50
5.4 Transformations of all synchronous assignments . . . . . . . . . . . . . . . . . 50

ix
x
Introduction
In this thesis, we will combine Gröbner basis with SAT Solver in different manners. The
Boolean satisfiability (SAT) problem is the problem of finding an assignment of a set of Boolean
variables V such that a Boolean formula F (V ) will have the value true under this assignment.
A tool that can solve a SAT problem is called a SAT Solver. The SAT problem is very
intersting not only in theory but also in practice. Although the complexity of the SAT problem
is NP-complete, many modern SAT solvers can still solve many real world problems efficiently,
including hardware verification, software verification, planning and scheduling.
On the other hand, Gröbner basis is one of the central concepts in computer algebra. It
is a specific generating set of an ideal over a polynomial ring with extremely nice properties.
Gröbner basis techniques have many applications in algebraic geometry, optimization, coding,
robotics, control theory, molecular biology, and many other fields.
Both SAT solvers and Gröbner basis techniques have their own strength and weakness.
Combining them could fix their weakness. Subsequently, several research groups made con-
siderable efforts to combine Gröbner basis techniques with SAT Solvers. Matthew Clegg at
al. [CEI96] introduced a Gröbner proof system combining Buchberger’s algorithm [Buc85] with
the backtracking technique of a SAT Solver. In contrast, Condrat and Kalla used Gröbner
basis to preprocess CNF formulæ [CK07] before giving them to a SAT solver, while Zengler
and Küchlin [ZK10] use Gröbner basis techniques to obtain additional informations for SAT
Solvers.
SAT solvers and Boolean Gröbner basis computations use different inputs. Most of the SAT
solvers use proposition formulæ in conjunctive normal form (CNF) as input. In conjunctive
normal form, only three operators, and (∧), or (∨) and negation (¬) are used to represent
a propositional formula. The input for Boolean Gröbner basis computations is a system of
Boolean polynomials. Boolean polynomial is a polynomial in Z2 [x1 , . . . , xn ], where each term
has degree at most one per variable. Therefore, to combine SAT Solvers and Gröbner basis
techniques, we need an algorithm to convert Boolean polynomials to CNFs and another one to
convert CNFs to Boolean polynomials. In this thesis, we will present some classical conversions
as well as some refinements of these conversions.
The first combination is using Gröbner techniques to learn additional binary clauses for
CDCL SAT solver from a selection of clauses. This combination is first proposed by Zengler
and Küchlin [ZK10]. However, in our experiments, about 80 percent Gröbner basis computa-
tions give no new binary clauses. By selecting smaller and more compact input for Gröbner
basis computations, we can significantly reduce the number of inefficient Gröbner basis com-
putations, learn much more binary clauses. In addition, the new strategy can reduce the
solving time of a SAT Solver in general, especially for large and hard problems.
The second combination is using all-solution SAT solver (find all satisfying assignments for
given formula) and interpolation to compute Boolean Gröbner bases of Boolean elimination
ideals of a given ideal. Computing Boolean Gröbner basis of the given ideal is the classical
method to compute Boolean elimination ideals. However, this method is inefficient in case we
want to eliminate most of the variables from a big system of Boolean polynomials. Therefore,
we propose a more efficient approach to handle such cases. In this approach, we combine

1
all-solutions SAT Solver and interpolation to compute a Boolean Gröbner basis of elimination
ideals. This means that we do not compute a Gröbner basis of the given ideal but only
a Gröbner basis of the ideal corresponding to the projection given by elimination of some
variables. The given ideal is translated to the CNF formula. Then an all-solution SAT Solver
is used to find a finite set of points, the projection of all solutions of the given ideal. Finally, an
algorithm, e.g. Buchberger-Moeller Algorithm, is used to associate the reduced Gröbner basis
to this set of points. We also optimize the Buchberger-Moeller Algorithm for lexicographical
ordering and compare it with the algorithm from [BD13], an alternative to the Buchberger-
Moeller Algorithm for Boolean polynomials.
Finally, we combine Gröbner basis and abstraction techniques to the verification of some
digital designs that contain complicated data paths, such as multiplier and filter. Firstly,
abstraction techniques are used to lift bit operations to word operations whenever possible.
By this way, we can construct an abstract model. Then, we reformulate it as a system of
polynomials in the ring Z2k [x1 , . . . , xn ]. The variables are ordered in a way such that the
system has already been a Gröbner basis w.r.t lexicographical monomial ordering. Finally,
the normal form is employed to prove the desired properties. To evaluate our approach, we
verify the global property of a multiplier and a FIR filter using the computer algebra system
Singular [DGPS12]. The result shows that our approach is much faster than the commercial
verification tool from Onespin [One] on these benchmarks.
We structure the thesis as follows. Basic knowledge about SAT Solvers and Gröbner bases
is given in chapter 1. In chapter 2, we discuss about the relations between Boolean polynomials
(the input for Boolean Gröbner basis computations) and conjunctive normal forms (the input
for SAT Solvers). Chapter 3 shows how to learn additional binary clauses for SAT solvers
using Boolean Gröbner bases efficiently. Using all-solution SAT solver and interpolation to
compute a Boolean Gröbner basis of elimination ideals is presented in chapter 4. In the
final chapter, we combine Gröbner basis and abstraction techniques to verify digital designs
containing complicated data paths.

2
Chapter 1
Boolean Satisfiability and Boolean
Gröbner bases
1.1 Boolean Satisfiability
The Boolean Satisfiability problem is very intersting not only in theory but also in practice.
It is the first problem to be proven NP-complete. However, modern SAT solvers can still solve
many real world problems efficiently, including hardware verification, software verification,
planning and scheduling.
Some classical notions as well as algorithms for state-of-the-art solving of the satisfiability
problem will be given in this section, for more details see – for instance – [BHvMW09].

1.1.1 The satisfiability problem


The Boolean satisfiability (SAT) problem is the problem of finding an assignment ν of a set of
Boolean variables V such that a given Boolean formula F (V ) will have the value true under
this assignment. Then ν is called a satisfying assignment, or a solution, for F . The formula
F is called satisfiable if it has a solution, otherwise F is called unsatisfiable.
The Boolean formula used in SAT problem usually in conjunctive normal form (CNF).
Definition 1.1.1. The Boolean formula is said to be in conjunctive normal form if it is a
conjunction of clauses, while each clause is a disjunction of literals over V , and each literal l
is an instance of a variable or its negation.
For convenience, we represent a CNF formula as a set of clauses and each clause as a set
of literals. In addition, we also use literals to represent variable assignment. The assignment
x = true is denoted by literal x, and x = f alse by literal ¬x.
By definition of CNF, a clause C is satisfied under an assignment ν if and only if C has
at least one literal which is true under the assignment, and a CNF formula is satisfied if and
only if all of its clauses are satisfied.
Definition 1.1.2. We call C a conflict clause if all literals of C are false, a unit clause if C
has only one literal, a binary clause if C consists of two literals.
Example 1.1.3. F = (¬x ∨ y) ∧ (x ∨ ¬y ∨ z) is a CNF formula. This CNF consists of 2 clauses

C1 := ¬x ∨ y and C2 := x ∨ ¬y ∨ z

and 3 variables x, y, z. The clause C1 consists of 2 literals ¬x and y. The CNF can be rewritten
as
F = {{¬x, y}, {x, ¬y, z}}.

3
and the assignment ν = {x, y, ¬z}, e.g x = true, y = true, z = f alse, is a solution for F .
Therefore, F is satisfiable.

We can easily determine if a Boolean formula of 3 or 4 variables is satisfiable or unsatisfiable


by testing all the possible variable assignments. However, Boolean formulaæ in pratice are
very large. They could have several thousands variables and millions of clauses. Therefore,
the testing approach is infeasible in practice, a more efficient approach is in demand. A tool
that can solve the SAT problems is called SAT Solver.

1.1.2 DPLL SAT Solver


Most of SAT Solvers are based on the DPLL Algorithm. It is a decision procedure proposed
by Davis, Logemann and Loveland [DLL62] in 1962. This procedure refined the DP Algorithm
proposed by Davis and Putnam [DP60] in 1960. Therefore, it is called the DPLL Algorithm.
The DP algorithm make use of the resolution rule while the DPLL algorithm bases on the
conditioning operation and existential quantification.

Definition 1.1.4. Two literals are said to be complements if one is the negation of the other.
Let C1 and C2 be clauses containing complementary literals. Assume that

C1 = x ∨ l1 ∨ · · · ∨ lk1 , C2 = ¬x ∨ l10 ∨ · · · ∨ lk0 2

where x is a variable, l1 , . . . , lk1 , l10 , . . . , lk0 2 are literals. The the resolvent of C1 and C2 is defined
to be
C := l1 ∨ . . . lk1 ∨ l10 ∨ · · · ∨ lk0 2 .
The rule that replaces C1 and C2 by their resolvent C is called the resolution rule.

The resolution rule in propositional logic is a single valid inference rule that produces a
new clause implied by two clauses containing complementary literals.
The result of conditioning a CNF formula F on a literal l is the CNF formula, denoted by
F | l, which can be obtained from F by

• removing all clauses which contain literal l, and

• removing the literal ¬l from all clauses containing ¬l.

In notation, F | l = {C − {l} | C ∈ F, l ∈ C}
The result of existentially quantifying a variable x from a formula F is denoted by ∃xF
and defined as follows:
∃xF := F | x ∨ F | ¬x.
The most important property of existential quantification is that F is satisfiable if and only
if ∃xF is satisfiable. Notice that ∃xF has one variable less than F (if F involves x).
Whenever there exists a unit clause in the CNF F , we could simplify F by conditioning it
on the only literal of that unit clause. We continue this process until the result CNF contains
no unit clauses. This technique is called unit resolution (or unit propagation).
The Algorithm 1.1.1 represents the DPLL Algorithm in pseudocode. It will call at first the
function unit-resolution. This function will return

• I, a list of literals that is either presented as a unit clause in F or is derived from F by


unit resolution.

4
• G, a new CNF which results from conditioning F on literals in I.

Then, the algorithm will check for termination based on G.

• if G = { }, i.e. all clauses in F are satisfied, it returns I as solution for F

• if { } ∈ G, i.e F contains a conflict clause, it returns unsatisfiable.

In case the two termination conditions above fail, the algorithm will pick a literal l in G, and
solves two SAT problems with the new CNFs G | l and G | ¬l. If one of them are satisfiable,
it will return a solution for F , otherwise it will return unsatisfiable.

Algorithm 1.1.1 DPLL algorithm, DPLL(F )


Input: a CNF formula F .
Output: a set of literals representing a solution for F or UNSATISFIABLE.
1: (I, G) = unit-resolution(F ).
2: if G = { } then
3: Return I
4: else if { } ∈ G then
5: Return unsatisfiable
6: else
7: Choose a literal l in G
8: if L = DP LL(G | l) 6= unsatisfiable then
9: Return L ∪ I ∪ {l}
10: else if L = DP LL(G | ¬l) 6= unsatisfiable then
11: Return L ∪ I ∪ {¬l}
12: else
13: Return unsatisfiable
14: end if
15: end if

Example 1.1.5. Consider the CNF

F = {{x, y, z}, {¬x, ¬y}, {y, ¬z}}.

We will use the algorithm 1.1.1 to check the satisfiability of F . Initially, there is no unit clause
in F . In addition, the formula F is neither empty nor containing empty set. Therefore, the
algorithm takes a literal x, and conditions F on x:

F | x = {{¬y}, {y, ¬z}}.

Now, DPLL is applied again to check satisfiability of F |x. The formula F |x contains a unit
clause {¬y}. Hence, the function unit-resolution(F | x) is called, and return I = {¬y, ¬z}
and G = { }. The DP LL(F | x) will return {¬y, ¬z} since G is empty. As a result, the
DP LL(F ) will return {x, ¬y, ¬z} which is a solution for F , that means F is satisfiable.

Among all DPLL-based SAT Solvers, the Conflict Driven Clause Learning (CDCL) SAT
solver is the most efficient one. It can solve a lot of practical SAT problems. The power of
the CDCL Solver comes from the ability of learning from conflicts. Some famous CDCL SAT
Solvers are MiniSat [ES04], Glucose [AS09] and CryptoMiniSat [SNC09].

5
1.1.3 Conflict Driven Clause Learning SAT Solver
Algorithm 1.1.2 shows the standard organization of a Conflict Driven Clause Learning SAT
solver. With respect to DPLL, the main differences are the call to function ConflictAnal-
ysis each time a conflict is identified, and the call to Backtrack when backtracking takes
place. Moreover, the Backtrack procedure allows for backtracking non-chronologically. The
following functions are used in algorithm 1.1.2:

1. UnitPropagation consists of the iterated application of the unit clause rule. If all
literals in a clause are f alse except one literal l, the literal l must be true to make the
clause satisfy. This rule is called unit clause rule. If an unsatisfied clause is identified
during unit propagation, then a conflict indication is returned.

2. PickBranchingVariable consists of selecting a variable to assign and the respective


value.

3. ConflictAnalysis consists of analyzing the most recent conflict and learning a new
clause from the conflict.

4. Backtrack backtracks to the decision level computed by ConflictAnalysis.

5. AllVariablesAssigned tests whether all variables have been assigned, in which case
the algorithm terminates indicating that the CNF formula is satisfiable.

In the conflict analysis step, there are several learning schemes used to learn new clauses. To
understand these learning schemes, we need the implication graph. This graph reflects the
unit propagation process and conflicts (if they exists).

Definition 1.1.6. The implication graph G at a given state of DPLL is a directed acyclic
graph with edges labeled with sets of clauses. It is constructed as follows:

1. Create a node for each decision literal, labeled with that literal.

2. While there exists a clause C = {l1 , . . . , lk , l} such that all nodes with lables ¬l1 , . . . , ¬lk
are in G, but neither l nor ¬l labels a node in G,
(a) add a node with label l to G, and
(b) add directed edges from li to l with label C, 1 ≤ i ≤ k.

3. While there exists a clause C = {l1 , . . . , lk } such that all nodes with labels ¬l1 , . . . , ¬lk
are in G,
(a) add a node with label K to G, and
(b) add directed edges from li to K with label C, 1 ≤ i ≤ k.

The graph G contains a conflict if it contains a node K. Note that an implication graph
can contain no conflict or one conflict or several conflicts. The Figure 1.1.3 shows 2 examples
of implication graph.
In the rest of this section, we only consider the implication graph at a stage where there is
at least one conflict and fix a conflict if there are several ones. Pick any cut in the implication
graph that has all decision variables on one side, called reason side and the conflict node K
on the other side, called conflict side. All nodes on the reason side that has an edge going to

6
the conflict side form a cause of the conflict. Let C be the clause which contains the negations
of literals labeling nodes in the cause. C is called the learned clause associated to the cut.
The First Unit Implication Point is one of the best learning schemes and commonly used
in most of modern CDCL SAT solvers. A unique implication points (UIP) [MSSSS96] of an
implication graph G is a node of G such that all the paths from latest decision node to the
conflict node K go through it. The first UIP (or 1-UIP ) is the one that is closest to the conflict
node K. The 1-UIP cut is the cut of the implication graph such that all nodes reachable from
the 1-UIP are on conflict side and the rest nodes are on reason side. The learned clause
associated with 1-UIP cut is called 1-UIP clause.
Modern CDCL SAT solvers also often use search restart techniques [GSK98, BMS00] to
avoid getting too deep into spaces with no solutions. Search restart causes the algorithm to
restart itself, all assignments are taken back, but learned clauses are preserved.

Algorithm 1.1.2 Typical CDCL algorithm, CDCL(F, ν)


1: if (UnitPropagation(F, ν) == CONFLICT) then
2: Return UNSAT
3: end if
4: dl ← 0 // Decision level
5: while (not AllVariablesAssigned (F, ν)) do
6: (x, v) = PickBranchingVariable (F, ν) // Decide stage
7: dl ← dl + 1 // Increment decision level
8: ν ← ν ∪ {x, v}
9: if ( UnitPropagation(F, ν) == CONFLICT) // Deduce stage then
10: β = ConflictAnalysis(F, ν) // Diagnose stage
11: if (β < 0) then
12: Return UNSAT
13: else
14: Backtrack(F, ν, β)
15: dl ← β // decrement decision level
16: end if
17: end if
18: end while

The following example will help the reader understand in details how CDCL solve a SAT
problem.

Example 1.1.7. Let F be the CNF consisting of the following clauses r1 = {x1 , x2 }, r2 =
{¬x1 , ¬x4 , ¬x5 }, r3 = {x2 , x5 }, r4 = {¬x3 , x4 }, r5 = {x3 , x4 }, r6 = {x3 , ¬x4 }, r7 = {¬x4 , x5 }.
The Algorithm 1.1.2 solves this SAT problem as follows. At first, it performs unit propagation
on F , but F has no unit clause, hence there is nothing to propagate. It sets decision level to
zero and continues as in Table 1.1. The implied literals are new assignments obtained from
the unit propagation process. The corresponding implication graph is on the left hand side of
Figure 1.1.3. Conflict occurs at this level, hence the graph contains the node K. There are two
UIPs in this graph. The first UIP is x4 and the second UIP is x3 . The 1-UIP cut will generate
the 1-UIP clause r8 = {¬x1 , ¬x4 }. Add r8 to F as learned clause. The backtrack level is the
maximal level of variable in the 1-UIP clause without 1-UIP. In this case, the backtrack level
is 1 which is the level of the variable x1 . The algorithm backtrack to level 1, and clear all
assignments x2 , x3 , x4 and x5 .

7
Table 1.1: First decisions of CDCL Algorithm
Decision literal decision level implied literals conflict
x1 1 none no
x2 2 none no
x3 3 x4 , x5 {¬x1 , ¬x4 , ¬x5 }

Figure 1.1: Implication graphs with 1-UIP cuts


x1

r2 x1 ¬x4 ¬x3
x2
K r8 r4
r5
r5
r2 r2
x3 x4 K
x5
r4 r7

Now, the learned clause r8 becomes an unit clause. Unit progation on F leads to another
conflict. The implication graph on the right hand side of Figure 1.1.3 shows the situation of
this conflict. Analyzing this conflict using 1-UIP learning scheme as before, the second learned
clause r9 = {x4 } is added to F . The backtrack level for this conflict is 0. All assignment are
clear. The CNF F has a unit clause r9 = {x4 }. Perform unit propagation on F , the following
assignments (literals) are implied: x4 , x3 , x5 , ¬x1 and x2 . At this point, there is no conflict
and all variable are assigned, hence the algorithm terminates and returns a solution of F :

¬x1 , x2 , x3 , x4 , x5 .

We can see that all clauses in F are satisfied under these variable assignments.

1.2 Gröbner bases


In this section, we give some basic notions about Gröbner basis. For more details about
Gröbner bases, the readers are referred to [zGG03, GP02].
A Gröbner basis is a specific generating set of an ideal over a polynomial ring. It has
extremely nice properties and has many applications in algebraic geometry, optimization,
coding, robotics, control theory, molecular biology, and many other fields. Bruno Buchberger
(1965) invented the concept Gröbner bases, together with an algorithm to compute them, in
his PhD thesis, and named it after his thesis advisor Wolfgang Gröbner. A Gröbner basis of an
ideal depends on the monomial ordering, a special total ordering on the set of all monomials.

8
1.2.1 Monomial ordering
Let R be any principal ideal ring with 1. Let R[x] := R[x1 , . . . , xn ] be the polynomial ring
over R in variables x1 , . . . , xn . We denote

xα := xα1 1 xα2 2 . . . xαnn

for any α = (α1 , . . . , αn ) ∈ Nn .

Definition 1.2.1. We say > is a monomial ordering on a polynomial ring R[x] if it is a total
ordering on the set of monomials M onn = {xα | α ∈ Nn } satisfying

xα > xβ =⇒ xγ xα > xγ xβ

for all α, β, γ in Nn .
We call a monomial ordering > is global if xα > 1 for all α 6= (0, . . . , 0).

In this thesis, we only consider global monomial ordering. Examples for global orderings
are the lexicographical ordering (denoted by lex), the degree lexicographical ordering (denoted
by deglex). They are defined as follows:

xα >lex xβ :⇐⇒∃1 ≤ i ≤ n : α1 = β1 , . . . , αi−1 = βi−1 , and αi = βi


xα >deglex xβ :⇐⇒deg(xα ) > deg(xβ )
or deg(xα ) = deg(xβ ) and xα >lex xβ

Some basic concepts in computer algebra are defined as follows:

Definition 1.2.2. Let > be a fixed monomial ordering on R[x]. Let I ⊂ R[x] be an ideal and
f ∈ R[x] a non-zero polynomial. The polynomial f can be written in a unique way as sum of
non-zero terms
f = aα xα + aβ xβ + · · · + aγ xγ
where aα , aβ , aγ ∈ R and xα > xβ > · · · > xγ . We defined

1. LT (f ) := aα xα , the leading term of f ,

2. LM (f ) := xα , the leading monomial of f ,

3. LC(f ) := aα , the leading coefficient of f ,

4. tail(f ) := f − LT (f ), the tail of f ,

5. L(I) := hLT (f ) | f ∈ Ii, the leading ideal of I,

6. LM (I) := hLM (f ) | f ∈ Ii, the leading monomial ideal of I

7. V (I) := {x ∈ Rn | f (x) = 0 for all f ∈ I}, the common zeros or variety of I.

8. I(V ) := {f | f (x) = 0 for all x ∈ V }, the vanishing ideal of V ⊂ Rn

9
1.2.2 Normal forms and Gröbner bases
Normal forms of a polynomial with respect to a system of polynomials are defined as follows:
Definition 1.2.3. Let T denote the set of all finite subsets of R[x],
N F : R[x] × T −→ R[x], (f, G) 7→ N F (f, G)
is called a normal form on R if
1. N F (0 | G) = 0 for all G ∈ T ,
2. N F (f | G) 6= 0 ⇒ LT (N F (f | G)) ∈
/ L(G) for all f ∈ R and all G ∈ T ,
3. If G = {g1 , . . . , gs }, then, for any f ∈ R, r := f −N F (f |G) has a standard representation
with respect to G, that is,
s
X
r = f − N F (f | G) = ai gi , ai ∈ R, s ≥ 0,
i=1

satisfying LM (r) ≥ LM (ai gi ) for all i such that ai gi 6= 0.


N F is called a reduced normal form if N F (f | G) is reduced with respect to G, that is, leading
terms of elements in G do not divide any terms of N F (f | G).
The Algorithm 1.2.1, is called Buchberger normal form, computes a normal form of a
polynomial with respect to G ⊂ R[x]. The reduce normal form can be computed by the
Algorithm 1.2.2.
The concept of s-polynomials used in the Algorithm 1.2.1 is defined as follows:
Definition 1.2.4. Let f, g ∈ R[x] \ {0}. The s-polynomial of f and g is defined to be
lcm(LT (f ), LT (g)) lcm(LT (f ), LT (g))
spoly(f, g) := f− g
LT (f ) LT (g)

Algorithm 1.2.1 Normal form, N F (f | G)


Input: f ∈ R[x], G ⊂ R[x], and a global monomial ordering >.
Output: h ∈ R[x], a normal form of f with respect to G.
h := f
while h 6= 0 and there exists a g ∈ G such that LT (g) divides LT (h) do
h = spoly(h, g)
end while
Return h

The polynomial ring R[x] is Noetherian, since R is Noetherian. Hence, every ideal in R[x]
has a finite generating set. A Gröbner basis of an ideal is a particular generating set which
has some extremely nice properties.
Definition 1.2.5. Let I ⊂ R[x] be an ideal. A finite set G ⊂ R[x] is called a Gröbner basis
of I if
G ⊂ I, and L(G) = L(I).
A Gröbner basis G of I is called reduced if LC(f ) = 1 for any f ∈ G, and for any f 6= g ∈ G,
LM (g) does not divides any monomial of f .

10
Algorithm 1.2.2 Reduced normal form, redN F (f | G)
Input: f ∈ R[x], G ⊂ R[x], and a global monomial ordering >.
Output: h ∈ R[x], a reduced normal form of f with respect to G.
if f = 0 then
Return f
end if
f := N F (f | G)
Return LT (f ) + redN F (tail(f ) | G)

A Gröbner basis of an ideal in R[x] always exists, but the reduced Gröbner basic not
necessarily. With a fixed monomial ordering, a Gröbner basis of an ideal I is still not unique,
but the reduced Gröbner basis (if it exists) is unique.
Let I be an ideal in K[x], where K is a field, and let > be a global ordering on K[x].
Assume that I is generated by a finite set S. A Gröbner basis of I can be computed by the
Buchberger Algorithm, the Algorithm 1.2.3.

Algorithm 1.2.3 Gröbner basis of S ⊂ K[x], K is field


Input: S ⊂ K[x], and > a global ordering on K[x].
Output: G ⊂ K[x], a Gröbner basis of ideal generated by S in K[x].
G := S
P := {(f, g) | f, g ∈ G, f 6= g}, the pair-set.
while P 6= ∅ do
Choose (f, g) ∈ P
P := P \ {(f, g)}
h := N F (spoly(f, g) | G)
if h 6= 0 then
P := P ∪ {(h, f ) | f ∈ G}
G := G ∪ {h}
end if
end while
Return G

Consider the case R being a principal ring (i.e every ideal in R can be generated by one
element), e.g. Zm := Z/mZ. Gröbner basis computation over any principal ring is treated in
[BDG+ 09]. Here, we revise some basic notations
Definition 1.2.6. Let R be a principal ring and a ∈ R. The annihilator of a, Ann(a) = {b ∈
R | a · b = 0} is an ideal in R is generated by one element, which we denote by N T (a).
Because of zero divisors, we need to extend the definition of an s-polynomial.
Definition 1.2.7. Let f ∈ R \ {0}. We define the extended s-polynomial of f to be

spoly(f, 0) := spoly(0, f ) := N T (LC(f )).f

The Algorithm 1.2.4 will return a Gröbner basis of an ideal in R[x], where R is a principal
ring.
The following theorem ensures the correctness of the Algorithm 1.2.3 and 1.2.4. It is called
Buchberger’s criterion.

11
Algorithm 1.2.4 Gröbner basis of S ⊂ R[x], R is principal ring
Input: S ⊂ R[x], where R a principal ring, and > a global ordering on R[x].
Output: G ⊂ R[x], a Gröbner basis of ideal generated by S in R[x].
G := S
P := {(f, g) | f, g ∈ G, f 6= g} ∪ {(0, f ) | f ∈ G}, the pair-set.
while P 6= ∅ do
Choose (f, g) ∈ P
P := P \ {(f, g)}
h := N F (spoly(f, g) | G)
if h 6= 0 then
P := P ∪ {(h, f ) | f ∈ G} ∪ {(0, h)}
G := G ∪ {h}
end if
end while
Return G

Theorem 1.2.8. Let G = {f0 , f1 , . . . , fk } be a set of generators of an ideal I ⊂ R[x] with


f0 = 0. If
N F (spoly(fi , fj ) | G) = 0 for 0 ≤ i ≤ j ≤ k
then G is a Gröbner basis of I.

1.3 Boolean Gröbner bases


We adopt Brickenstein’s notations for Boolean Gröbner bases [Bri10].

1.3.1 Boolean polynomials


In this section, we consider the polynomial ring Z2 [x] = Z2 [x1 , . . . , xn ]. The equations x2 = x
are always satisfied for every x ∈ Z2 . Therefore, it is reasonable to consider the polynomials
over Z2 modulo the so-called field polynomials
FP = {x21 − x1 , x22 − x2 , . . . , x2n − xn }
and obtain polynomials of degree at most 1 with respect to every variable.
Definition 1.3.1. A (multivariate) polynomial in Z2 [x1 , . . . , xn ], such that each term has
degree at most one with respect to every variable, is called a Boolean polynomial :
degxi (f ) ≤ 1 ∀i ∈ {1, . . . , n} .
The set of all Boolean polynomials is denoted by B.
Theorem 1.3.2. The composition B ,→ Z2 [x]  Z2 [x]/hFPi is a bijection. That is, the
Boolean polynomials are a canonical system of representatives of residue classes in the quotient
ring Z2 [x] modulo the ideal generated by the field polynomials. Moreover, this bijection also
provides B the structure of a Z2 -algebra.
Example 1.3.3. Let f1 = x1 x2 + x3 and f2 = x3 be two Boolean polynomials in B '
Z2 [x1 , x2 , x3 ]/hFPi. Let f4 and f5 be the product and the sum of f1 and f2 , respectively, then
f4 = x1 x2 x3 + x3 and f5 = x1 x2 are also Boolean polynomials.

12
Definition 1.3.4. A function F : Zn2 −→ Z2 is called a Boolean function.

Theorem 1.3.5. The map from B to the set of Boolean functions by mapping a polynomial
to its polynomial function is an isomorphism of Z2 -vector spaces.

Proof. For a proof, we refer to [BDG+ 09]

Corollary 1.3.6. Let p and q be two Boolean polynomials in Z2 [x1 , . . . , xn ]. If p and q have
the same zero-set then p = q.

Proof. Follows using Theorem 1.3.5.

1.3.2 Boolean Gröbner bases


If G is a Gröbner basis of an ideal I with respect to some monomial ordering, then any G0 ⊂ I
containing G is also a Gröbner basis of I. However, we can simplify a Gröbner basis to obtain
a reduced Gröbner basis. The reduced Gröbner basis of an ideal is unique for a given monomial
ordering. Therefore, it can be considered as a canonical representation of the ideal.

Definition 1.3.7. For any subset H ⊂ Z2 [x], we define

BI(H) := hH, FPi

the Boolean ideal of H. Let G be a finite set of Boolean polynomials in Z2 [x]. We call G a
Boolean Gröbner basis of hHi if G ∪ FP is a Gröbner basis of BI(H). We call G a reduced
Boolean Gröbner basis of hHi, BGB(H) for short, if there exists a subset S ⊂ FP such that
G ∪ S is a reduced Gröbner basis of BI(H).

By definition, the Buchberger algorithm can be used to compute the reduced Boolean
Gröbner basis of an ideal in Z2 [x]. Besides the chain criterion and the product criterion, there
is a new criterion for Boolean Gröbner bases. It is called Linear lead factor criterion which is
stated in the following theorem.

Theorem 1.3.8. Let f ∈ B. If f can be written as f = g.h, where the leading monomial of g
is xi for some i, then the reduced normal form of spoly(f, x2i + xi ) with respect to {f } ∪ FP
is zero.

Boolean polynomials manipulations as well as the reduced Gröbner basis of a Boolean ideal
in Z2 [x] can be computed efficiently in PolyBoRi software developed by Brickenstein and
Dreyer [BD09, Bri10]. See [Bri10] for more details.

Example 1.3.9. Let I be the ideal generated by f1 = x1 x2 + x1 and f2 = x1 x2 x3 . Let


H := h{f1 , f2 } ∪ FPi be the Boolean ideal of I. Consider the lexicographical monomial
ordering with x1 > x2 > x3 . The reduced Gröbner basis H is {f1 , f2 , f3 } ∪ FP, where
f3 = x1 x3 By Definition 1.3.7, the reduced Boolean Gröbner basis of I is {f1 , f2 , f3 }.

13
14
Chapter 2
Relations between Boolean polynomials
and CNFs
Formulæ in CNF are the main input for most SAT solvers, while Boolean Gröbner basis
computation performs on Boolean polynomials. To cooperate the SAT solvers and Boolean
Gröbner bases, we need a good conversion between Boolean polynomials and CNFs as well as
understanding the relation between operations on these two objects.

2.1 Converting Boolean polynomials to CNFs


Let ψ : {0, 1} −→ {T rue, F alse} be the bijective map. The conversion must satisfy the
condition (x1 = a1 , . . . , xn = an ) fullfiles the equation p = 0 if and only if the assignment
x1 = ψ(a1 ), . . . , xn = ψ(an ) satisfies the CNF of p.
Let ψ1 be the map from the set of Boolean polynomials to the Boolean algebra that maps
1 to T rue and 0 to F alse, and ψ0 be an alternative of ψ1 , it maps 0 to T rue and 1 to F alse.
The following statements are true for all Boolean polynomials p and q.
1. ψ1 (x + y) = ψ1 (x) ⊕ ψ1 (y)
2. ψ1 (x · y) = ψ1 (x) ∧ ψ1 (y)
3. ψ0 (x + y) = ψ0 (x) ∧ ψ0 (y)
4. ψ0 (x · y) = ψ0 (x) ∨ ψ0 (y).
Proof. These statements can be proven using truth tables.
Both maps can map Boolean polynomials to formulæ in Boolean logic. However, we need
to convert Boolean polynomials to CNFs. Brickenstein has proposed a method to convert a
Boolean polynomial to a CNF without introducing auxiliary variables. The CNF F associated
with an ideal I = hg1 , . . . , gm i generated by Boolean polynomials, is the conjunction of CNFs
associated with each Boolean polynomial in {g1 , . . . , gm }.
Let p be a Boolean polynomial and let O be the set of points in Zn2 where the polynomial
evaluates to one. The set O is so called the one set of p. The usual approach for CNF
generation is finding prime blocks of O, which is defined as follows:
Definition 2.1.1. A set B ⊂ V ⊂ Zn2 is called a block of V , if there exists sets ∅ =
6
A1 , . . . , An ⊂ {0, 1}, such that

B = {(a1 , . . . , an ) | ai ∈ Ai }.

B is called a prime block of V , if B is not a proper subset of any block of V .

15
With the map ψ1 , each prime block B = {(a1 , . . . , an ) | ai ∈ Ai } of O will be associated
with the clause that contains xi if Ai = {0}, and ¬xi if Ai = {1}. With the map ψ0 , each
prime block B = {(a1 , . . . , an ) | ai ∈ Ai } of O will be associated with the clause that contains
xi if Ai = {1}, and ¬xi if Ai = {0}. Conjunction of all clauses associated with all prime blocks
forms a CNF of p.
The original CNF encoder in [Bri10] uses the map ψ1 . However, we prefer the map ψ0 .
In the rest of this thesis, we only use the map ψ0 . The Algorithm 2.1.1 is a variant of the
algorithm given in [Bri10]. It replaces ψ1 by ψ0 .

Algorithm 2.1.1 ANF to CNF conversion


Input: p a Boolean polynomial
Output: F a CNF of p.
V := ones(p, Zn2 )
T := V
F := ∅
i := 0
while T 6= ∅ do
i := i + 1
Choose o ∈ T
H := {o}
for j ∈ {1, . . . , n} do
c := ∅ {Try to enlarge the set by adding the j-th unit vector to each element}
H 0 := {h | h ∈ H} ∪ {h + ej | h ∈ H}
if H 0 ⊂ V then
H := H 0
else
if oj = 1 then
c := c ∪ {xj }
else
c := c ∪ {¬xj }
end if
end if
if c 6= ∅ then
F := F ∪ {c}
end if
end for
T := T \H
end while
Return F

Example 2.1.2. Let p = x1 + x2 · x3 . To find the CNF of p, the algorithm 2.1.1 will find ones
of p:
T := V := ones(p) = {(0, 1, 1), (1, 0, 0), (1, 0, 1), (1, 1, 0)}.
After that, it sets H as a block of V that contains only one point in T , e.g (0, 1, 1), then tries
to extend this block to a prime block of V by adding j − th unit vector to each element of H.
The following prime blocks give a cover of V :
H1 = {(0, 1, 1)},

16
H2 = {(1, 0, 0), (1, 1, 0)},
H3 = {(1, 0, 1), (1, 0, 0)}.

The corresponding clauses are

c1 = {¬x1 , x2 , x3 }
c2 = {x1 , ¬x3 }
c3 = {x1 , ¬x2 }

The algorithm would return F = {c1 , c2 , c3 } which is the CNF of p.

When there are several polynomials in I concerning the same set S of variables, we can
convert them to a CNF at the same time. This conversion can further simplify the CNF of I.
It can be done as follows: when converting a Boolean polynomial p to a CNF, we also looking
for the group SV (p) of Boolean polynomials in I containing the same set of variables as p. In
the Algorithm 2.1.1, instead of setting V := ones(p, Zn2 ), we set
[
V := ones(q, Zn2 ).
q∈SV (p)

Example 2.1.3. Let I = {x1 + x2 + x3 , x1 + x2 · x3 } be a set of Boolean polynomials in


Z2 [x1 , x2 , x3 ]. The one sets of polynomials in I are

ones(x1 + x2 + x3 ) = {(0, 0, 1), (0, 1, 0), (1, 0, 0), (1, 1, 1)}


ones(x1 + x2 · x3 ) = {(0, 1, 1), (1, 0, 0), (1, 0, 1), (1, 1, 0)}

Converting polynomials in I one by one will produce the CNF F of I containing following
clauses:

{¬x1 , ¬x2 , x3 }, {¬x1 , x2 , ¬x3 }, {x1 , ¬x2 , ¬x3 },


{x1 .x2 , x3 }, {¬x1 , x2 , x3 }, {x1 , ¬x3 }, {x1 , ¬x2 }.

However, polynomials in I having the same set of variables can be converted to a CNF at
the same time. The resulting CNF of I in this case is G = {{x1 }, {x2 }, {x3 }}.

2.2 Converting CNFs to Boolean polynomials


Let φ : {0, 1} −→ {T rue, F alse} be the bijective map. The conversion must satisfy the
condition x1 = a1 , . . . , xn = an satisfies the CNF F if and only if (φ(a1 ), . . . , φ(an )) is a zero
of the Boolean polynomial of F .
Let φ1 be the map from formulæ in propositional logic to Boolean polynomials mapping
T rue to 1 and F alse to 0. Let φ0 be an alternative of φ1 , mapping T rue to 0 and F alse to 1.

Lemma 2.2.1. The following statements are true for every Boolean polynomials p and q.

1. φ1 (p ∨ q) = φ1 (p) · φ1 (q) + φ1 (p) + φ1 (q)

2. φ1 (p ∧ q) = φ1 (p) · φ1 (q)

3. φ1 (¬p) = φ1 (p) + 1

17
4. φ0 (p ∨ q) = φ0 (p) · φ0 (q)

5. φ0 (p ∧ q) = φ0 (p) · φ0 (q) + φ0 (p) + φ0 (q)

6. φ0 (¬p) = φ0 (p) + 1.
Proof. These statements can be proven by truth tables.
With one of the map φ0 or φ1 , we can convert the whole CNF formula to a single Boolean
polynomial, but usually the result is too complicated. For practical reasons, it is recommended
to map each clause in the CNF to a Boolean polynomial and the whole CNF is mapped to a
system of Boolean polynomials.
We prefer the map φ0 since it is more natural to map x1 ∨ x2 to x1 x2 than to x1 x2 + x1 + x2 .
In the rest of this thesis, we only use the map φ0
Example 2.2.2. Let F = C1 ∧ C2 be a CNF formula, where C1 = x1 ¬x2 and C2 = ¬x3 ∨ x4 ,
then

f1 := φ0 (C1 ) = φ0 (x1 ) · φ0 (¬x2 )


= φ0 (x1 ) · (φ0 (x2 ) + 1)
= x1 (x2 + 1)
= x1 x2 + x1

and, similarly, f2 := φ0 (C2 ) = x3 x4 + x4 . Let f3 := φ0 (C1 ∧ C2 ), then

f 3 = x1 x2 x3 x4 + x 1 x2 x3 + x1 x3 x4 + x1 x2 + x 1 x3 + x3 x4 + x1 + x3 .

In practice, we would convert F to the system of Boolean polynomials {f1 , f2 } instead of only
one Boolean polynomials f3 .
Lemma 2.2.3. Let C1 and C2 be clauses satisfying the condition: there exist a literal l in C1
such that ¬l is in C2 , then φ(C1 ) · φ(C2 ) = 0
Proof. By definition,

φ0 (C1 ) = φ0 (C1 \ {l}) · φ0 (l), and φ0 (C2 ) = φ0 (C1 \ {l}) · (φ0 (l) + 1).

Hence, the product of the two Boolean polynomials φ(C1 ) and φ(C2 ) is zero.
Remark 2.2.4. It holds that ψ(φ(C)) = C for any clause C. However, the equality φ(ψ(p)) =
p is not true for any Boolean polynomial p.
In case there exists a CNF sub-formula S containing clauses of the same variable, we propose
converting S to one Boolean polynomial. This method can not only reduce the number of
polynomials, but also reduce the degree of the polynomial. The following lemma allow simplify
the conversion of the and operation in this case.
Lemma 2.2.5. Let S := {C1 , . . . , Cm } ⊂ {(l1 , . . . , lk ) | li ∈ {xi , ¬xi }, i = 1, . . . , k} and assume
that all Ci are pairwise different, then
m
^ m
X
φ0 ( Ci ) = φ0 (Ci ).
i=1 i=1

18
Proof. By definition,

φ0 (C1 ∧ C2 ) = φ0 (C1 ) · φ0 (C2 ) + φ0 (C1 ) + φ0 (C2 )


= (φ0 (C1 ) + 1)(φ0 (C2 ) + 1) + 1.

Therefore, by induction,
m
^ m
Y
φ0 ( Ci ) = (φ0 (Ci ) + 1) + 1.
i=1 i=1

However, there always exists a literal l such that l in Ci and ¬l in Cj for any i 6= j. By Lemma
2.2.3, φ0 (Ci ) · φ0 (Cj ) = 0 for any i 6= j. Hence,
m
^ m
X
φ0 ( Ci ) = φ0 (Ci ).
i=1 i=1

Example 2.2.6. The Algorithm 2.1.1 convert the Boolean polynomial p = x1 + x2 + x3 to


the CNF F consisting of following clauses

C1 := {¬x1 , ¬x2 , x3 },C2 := {¬x1 , x2 , ¬x3 },


C3 := {x1 , ¬x2 , ¬x3 },C4 := {x1 .x2 , x3 }}.

Apply the map φ0 to the whole formula F , the Boolean polynomial of F is computed as
follows:

φ0 (C1 ) = x1 x2 x3 + x1 x3 + x2 x3 + x3 ,
φ0 (C2 ) = x1 x2 x3 + x1 x2 + x2 x3 + x2 ,
φ0 (C3 ) = x1 x2 x3 + x1 x2 + x1 x3 + x1 ,
φ0 (C4 ) = x1 x2 x3 ,
φ0 (F ) = φ0 (C1 ) + φ0 (C2 ) + φ0 (C3 ) + φ0 (C4 ) = x1 + x2 + x3 .

Remark 2.2.7. With the new method, every linear polynomial will be recovered after forward
and backward conversions.

2.3 Some relations between Boolean polynomials and CNFs


Lemma 2.3.1. If we identify T rue with 0 and F alse with 1, then a clause C and its cor-
responding Boolean polynomial φ0 (C) have the same set of solutions. Therefore, the CNF
formula F = {Ci | i ∈ I} and the system of Boolean polynomials J = {φ0 (Ci ) | i ∈ I} have the
same solution set. Therefore, Boolean Gröbner basis techniques can solve SAT problems, but
it is in general not a practical approach.

Proof. By the identification and the property of conversion using the map φ0 , the clause C
and the Boolean polynomial φ0 (C) have the same set of solutions. Hence

Solution(F ) = ∩i∈I Solution(Ci ) = ∩i∈I Solution(φ0 (C)) = Solution(J).

19
Lemma 2.3.2. Let C be the non-trivial resolvent of two clauses, C1 and C2 , then φ(C) is
equal to the reduced normal form of the s-polynomial of φ(C1 ) and φ(C2 ) with respect to φ(C1 )
and φ(C2 ).
Proof. The resolvent C is non-trivial, hence clause C1 has exactly one literal l such that ¬l is
in C2 We may assume that
_ _
C1 = xi ∨ xt ∨ (xj + 1)
i∈I1 j∈J1
_ _
C2 = xi ∨ ¬xt ∨ (xj + 1)
i∈I1 j∈J1

For convenience, we use the following notations


Si = Ii ∪ Ji for i = 1, 2
S = S1 ∪ S2
fi = φ(Ci ) for i = 1, 2
Y
PM = xm for any finite index set M
m∈M

By definition of φ,
Y Y
f1 = xi · xt · (xj + 1)
i∈I1 j∈J1
Y Y
f2 = xi · (xt + 1) · (xj + 1)
i∈I2 j∈J2

Expand the last product in f1 and f2 , and use above notations, we can rewrite f1 and f2 as
follows
X X
f1 = PI1 · xt · PJ1 \K1 = xt PS1 \K1
K1 ⊂J1 K1
X X X
f2 = PI2 · (xt + 1) · PJ2 \K2 = xt PS2 \K2 + PS2 \K2
K2 ⊂J2 K2 K2

Here, Ki runs through the set of all subsets of Ji for i = 1, 2.


lead(f1 ) = xt PS1
lead(f2 ) = xt PS1 .
Firstly, we prove lemma 2.3.2 for the case C1 and C2 having no common literals, i.e. S1 ∩S2 = ∅
spoly(f1 , f2 ) = f1 · PS2 + f2 · PS1
X X X
= xt PS\K1 + xt PS\K2 + PS\K2
K1 K2 K2
X X X
= xt PS\K1 + xt PS\K2 + PS\K2 .
K1 6=∅ K2 6=∅ K2

We use following polynomial to reduce spoly(f1 , f2 ):


X X
f = f2 · PS\K1 + f1 · PS\K2
K1 6=∅ K2 6=∅

20
XX XX XX
= xt PS\(K1 ∪K2 ) + PS\(K1 ∪K2 ) + xt PS\(K1 ∪K2 )
K1 6=∅ K2 K1 6=∅ K2 K1 K2 6=∅
X X XX
= xt PS\K1 + xt PS\K2 + xt PS\(K1 ∪K2 )
K1 6=∅ K2 6=∅ K1 K2 6=∅

Adding f to spoly(f1 , f2 ), we obtain


XX
spoly(f1 , f2 ) + f = PS\(K1 ∪K2 )
K1 K2
X X
= PS1 \K1 PS2 \K2
K1 K2
X X
= PI 1 · PI 2 PJ1 \K1 PJ2 \K2
K1 K2
Y Y
= xi · (xj + 1)
i∈I1 ∪I2 j∈J1 ∪J2

=: g

Both f1 and f2 have xt in leading monomial, but no monomials in g contain xt . Therefore, g


is the reduced normal form of spoly(f1 , f2 ) w.r.t f1 and f2 . Moreover, φ(C) = g, so the lemma
is proven for this case.
In the general case, C1 and C2 may share some common literals, i.e. I1 ∩ I2 6= ∅ and
J1 ∩ J2 6= ∅.
Let
I := I1 ∩ I2 Ii0 := Ii \I for i = 1, 2
J := J1 ∩ J2 Ji0 := Ji \J for i = 1, 2
and
Y Y
h := xi (xj + 1)
i∈I j∈J
Y Y
f10 := xi · xt · (xj + 1)
i∈I10 j∈J10
Y Y
f20 := xi · (xt + 1) · (xj + 1)
i∈I20 j∈J20

then f1 = h · f10 and f2 = h · f20 . Apply the previous result, the reduced normal form of
spoly(f10 , f20 ) w.r.t f10 and f20 is
Y Y
g0 = xi · (xj + 1).
i∈I10 ∪I20 j∈J10 ∪J20

Since h,f10 and f20 have no commom variables,

spoly(h · f10 , h · f20 ) = h · spoly(f10 , f20 )

It follows that

RedN F (spoly(f1 , f2 ), {f1 , f2 }) = RedN F (h · spoly(f10 , f20 ), {h · f10 , h · f20 })

21
= h · RedN F (spoly(f10 , f20 ), {f10 , f20 })
= h · g0
Y Y
= xi (xj + 1)
i∈I j∈J

22
Chapter 3
Extending clause learning of SAT Solvers
We can use Boolean Gröbner bases to learn additional clauses for CDCL SAT Solvers. It is
based on the following lemma.

Lemma 3.0.3. Let F be a CNF and J be the ideal of F . Let C be a clause in the CNF of a
Boolean polynomial f ∈ BGB(J), then F implies C, or C is a valid lemma of F .

Proof. V (C) ⊃ V (φ−1 (f )) = V (f ) ⊃ V (J) = V (F ) where V(K) is standing for the solution
set of K. This shows that the CNF formula F ∧ C has the same set of solutions as F .

Example 3.0.4. Let F = {x1 ∨ ¬x2 , x1 ∨ x2 ∨ x3 , then J = φ(F ) = {x1 x2 + x1 , x1 x2 x3 }.


With the variable ordering x1 > x2 > x3 and lexicographical monomial ordering,

BGB(J) = {x1 x4 , x1 x3 + x1 , x1 x2 + x1 , x2 x3 + x2 }

The newly generated Boolean polynomial is x1 x3 . This polynomial corresponds to the clause
x1 ∨ x3 . It is a valid lemma of F .

3.1 Extending clause learning of SAT Solvers


The principal idea was first proposed by Zengler and Küchlin in [ZK10]. We denote this
original approach as ZK GB. In conflict analysis, they perform learning as usual (following
the 1-UIP strategy) and extend clause learning as follows:

1. Add all reason clauses of 2 to 8 literals, involved in the conflict to a set R.

2. If R has 4 to 6 clauses, then the corresponding system of polynomials is considered as a


good input.

3. If the number of good inputs is a multiple of 2#restarts , then they compute the BGB of
the last good input.

4. Collect all new polynomials with 2 variables from BGB and add their corresponding
clauses to the set of original clauses at next restart.

All parameters in their approach are chosen heuristically. The above parameters are not
strong enough to control the quality of the selection. For example, it is impossible to deduce
any binary clauses from a set of 6 clauses with length 8, see Lemma 3.1.1.

Lemma 3.1.1. Let m and k be natural numbers and m < k, then there are no clauses of
length k − m which can be deduced from m clauses of length k.

23
Proof. Let F = {C1 , . . . , Cm } be the set of m clauses of length k. Assume that we can deduce
from F a clause of length k − m, say lk−m+1 ∨ lk−m+2 ∨ · · · ∨ lk . Let xi be the variable of the
literal li for i = k − m + 1, · · · , k.
On the other hand, we can always choose a variable xi in Ci such that xi ∈ / Si , where
Si = {x1 , . . . , xi−1 , xk−m+1 , . . . , xk } for i from 1 to m, since Ci has k different variables and
Si has less than k variables. We assign to xi a truth value such that Ci is evaluated to true
for i = 1, . . . , m. Therefore, ν together with {x1 , . . . , xm } is a solution of F , contradictory to
above assumption.

To fix this issue, we propose a completely new strategy. To increase possibilities of getting
new binary clauses, clauses in the selection should be shorter and have more common variables.
Therefore, we select clauses of length at most 4 instead of 8 and introduce a new parameter
to adjust the number of common variables.

Definition 3.1.2. The density of variables in a set of clauses R is defined to be the quotient
of the number of variables in R and the number clauses in R. We denote it by dens(R).

Let m and n be the number of clauses and variables in the selection R, respectively. Let
a and c be the average length of the clauses and the number of occurrences of variables in R,
respectively. Let A be the average occurrences of a variable in R. Then,
c a.m a
A= = = .
n dens(R).m dens(R)

The expression above implies that A is reversely proportional to dens(R) if a is fixed. In


particular, if u is the upper bound of dens(R), then a/u will be the lower bound of A. When u
is smaller, the selection has a better quality, but it is harder to find the selection R satisfying
dens(R) ≤ u.
Computing a Gröbner basis for each conflict is expensive. Therefore, we adopt the ZK GB’s
strategy, the Gröbner basis is often computed at the beginning and seldom at the end.
Based on the above observation, we were able to improve Zengler and Küchlin’s approach.
In the same amount of time, our approach can learn much more binary clauses in each Gröbner
basis computation as well as in total. Moreover, it can reduce the total SAT solving time in
general.
We denote our approach by ND GB which is defined as follows:

1. If the number of conflicts is a multiple of 2#restarts , then extending binary clause learning
by BGB, or Gröbner-learning for short, is activated.

2. When Gröbner-learning is activated, we collect at most 7 reason clauses such that each
clause has at most 4 literals at conflict analysis and add them to a list R.

3. If R has at least 4 elements and the density of variables in R is at most 1.4, we convert
every element in R to the corresponding polynomial, compute BGB of these polynomials,
and deactivate the Gröbner-learning.

4. Only collect new polynomials with two variables and then add their corresponding clauses
to the set of original clauses at next restart.

24
Table 3.1: Compare two BGB learning schemes.
ZK GB ND GB
name k GBtime BinCls GBs GBzeros GBtime BinCls GBs GBzeros
approve 17 5236 74373 194830 77% 323 80243 18859 6%
bioinfo 20 44517 56632 1346806 98% 444 124706 27355 30%
bitverif 11 17096 629918 1045119 69% 8291 4443896 558542 30%
c32sat 4 7271 11959 171503 96% 114 67474 6241 8%
crypto 11 493 24898 18106 52% 379 210077 23354 3%
palacios/uts 6 4540 67530 138423 72% 781 122631 60696 56%
parity-games 21 49437 378742 1563407 83% 1790 252054 145230 40%
sum 90 128590 1244052 4478194 84% 12122 5301081 840277 32%

3.2 Implementation and Benchmarks


In order to experiment with our hybrid Gröbner/CDCL-SAT approach, we added Gröbner
basis functionality to the MiniSat, a famous SAT Solver by Niklas Eén et al. [ES04]. Our
experiments showed that the approach of Zengler and Küchlin works better for version 070721
of the tool. We compute Gröbner bases using the PolyBoRi framework for computations
with Boolean polynomials of Brickenstein and Dreyer [BD09, BD13]. The latter was accessed
from MiniSat by embedding the programming language Python [RD06]. This allows for fully
accessing PolyBoRi’s high-level algorithms and heuristics. All benchmarks are preprocessed
by MiniSat’s SATElite-based preprocessor [EB05] before actually solving takes place.
Like Zengler and Küchlin we select a large set of benchmarks from the SAT Competition
2009 1 in the categories aprove09, bioinfo, bitverif, c32sat, crypto, palacios/uts and parity-
games. However, they select the subsets of examples computable with respect to a given time
out. In order to avoid such a bias towards our method we used a more generic choice: We take
all benchmarks (except minxor128 in bitverif2 ) in the sets of benchmarks that MiniSat 2.1
solved in the first phase of the main track of the competition.
For convenience, we will use some abbreviations in the tables below. GBtime is the time
spent for Boolean Gröbner basis computations. BinCls is the number of binary clauses learned
by Boolean Gröbner basis computations. GBs is the number of Boolean Gröbner basis com-
putations. GBzeros is the number of Boolean Gröbner basis computations that learn no new
binary clauses. Ratio is average number of binary clauses learned in one Boolean Gröbner
basis computation.
In order to compare the strengths and the weaknesses of our methods with Zengler and
Küchlin’s approach, we used these benchmark examples for three different experiments.
First of all we evaluated the local efficiency of both clause selection strategies. For this
purpose, we computed the BGB of any set of clauses satisfying the criteria. To avoid affecting
on the search we do not add clauses learned during Gröbner basis computation to the SAT
solver. Since we throw away some useful results, this is a somewhat artificial setting. But it
allows directly comparing both methods in terms of clause selection.
Table 3.1 shows that our approach could learn more than four times the number of binary
clauses compared to ZK GB. In addition, our approach just spends about 10% of the time
1
See http://www.satcompetition.org/2009/ .
2
The benchmark minxor128 is easy for MiniSat 2.1, but it takes more than 2 days for MiniSat 070721 to
solve it.

25
Table 3.2: Analyze affects of density upper-bounds.
upper-bound GBtime BinCls GBs GBzeros Ratio
1.20 4929 3339453 306172 35% 10.9
1.25 6703 3573694 425067 34% 8.4
1.30 10154 5093819 689707 30% 7.4
1.35 10799 5184031 737096 30% 7.0
1.40 12122 5301081 840277 32% 6.3
1.45 23496 7697614 1483807 28% 5.2
1.50 28409 7972266 1818357 34% 4.4

Table 3.3: Affects of density upper-bounds on solving time


upper-bound Total time GBtime BinCls
1.25 55949 39 12715
1.30 64535 77 16812
1.35 46028 85 16633
1.40 23069 93 16348
1.45 43723 133 16752
1.50 34752 147 15925

ZK GB spends for Gröbner basis computations. The reason is that we compute fewer Boolean
Gröbner bases, but each of the Gröbner basis computation usually yields much more binary
clauses. We outperform Zengler’s and Küchlin’s approach on learning new binary clauses by
Boolean Gröbner bases.
In the second test, we want to motivate the density upper-bound setting. Therefore, we
use the same settings as above, but we vary the density upper-bound. Table 3.2 shows that
the larger density upper-bound is, the more binary clauses are learned in total, the more time
we spent in computing Gröbner bases, but the less binary clauses are learned in a Gröbner
computation. From these experiments the value of 1.4 seems to be a well-balanced setting.
To analyze the effect of our new parameter on solving time, we use our original setting,
but vary the density upper bound. Table 3.3 shows that the density upper bound has a very
strong effect on solving time. Again a density upper bound of 1.4 give the best score among
the others.
Finally, we use the original setting of both approaches. The solving time of both approaches
together with pure MiniSat is shown in Table 3.4. Our approach gets the best score among
others in 4of 7 benchmark categories (bioinfo, crypto, palacios/uts and parity-games) and also
in total solving time. The reason is that our solver can solve hard benchmarks faster, see
Fig. 3.1. Table 3.5 shows that our solver can learn more than 15 times the number of binary
clauses that Zenglin’s and Küchlin’s method can learn, but the time spent for computing
Gröbner bases is almost the same.

3.3 Conclusion
By introducing the density of variables as a criterion for the clause selection of the Gröbner
part, we significantly improved the efficiency of the hybrid Gröbner/CDCL-SAT approach.

26
Table 3.4: Compare solving time.
Name Pure ZK GB ND GB
aprove09 2569 736 3060
bioinfo 6361 7088 6057
bitverif 4950 12801 5172
c32sat 798 811 1001
crypto 3210 4587 2702
palacios/uts 1339 1253 1155
parity-games 24794 13655 3922
sum 44021 40931 23069

Table 3.5: Analyze binary clause learned by BGBs.


ZK GB ND GB
name GBtime BinCls GBs GBzeros GBtime BinCls GBs GBzeros
aprove09 11 265 365 68% 10 1917 650 12%
bioinfo 36 50 998 96% 24 1508 1310 68%
bitverif 13 228 512 67% 12 3760 751 29%
c32sat 9 5 184 98% 4 889 176 36%
crypto 2 174 133 51% 17 5091 805 9%
palacios 2 77 113 69% 12 1602 786 58%
parity 25 239 597 75% 14 1581 1021 42%
sum 98 1038 2902 80% 93 16348 5499 40%

27
Figure 3.1: SAT solving time in seconds.

Using our heuristic we learn more binary clauses per computed Gröbner basis than the state-
of-the-art approach of Zengler and Küchlin. In particular, the number of Gröbner basis com-
putations yielding no useful information is reduced. This significantly improves the overall
runtime of SAT solving for a crucial set of benchmark examples.

28
Chapter 4
Elimination by all-solutions SAT and
interpolation
Boolean Gröbner bases is the classical tool to compute Boolean elimination ideals. However,
this method is inefficient in case we want to eliminate most of the variables from a big system
of Boolean polynomials. Therefore, we propose a more efficient approach to handle such cases.
In this approach, we combine all-solutions SAT Solver and interpolation to compute a Boolean
Gröbner basis of elimination ideals. This means that we do not compute a Gröbner basis of
the given ideal but only a Gröbner basis of the ideal corresponding to the projection given
by elimination of some variables. The given ideal is translated to the CNF formula. Then an
all-solution SAT Solver is used to find a finite set of points, the projection of all solutions of
the given ideal. Finally, an algorithm, e.g. Buchberger-Möller Algorithm, is used to associate
the reduced Gröbner basis to this set of points. We also optimize the Buchberger-Möller
Algorithm for lexicographical ordering and compare it with the algorithm from [BD13], an
alternative to the Buchberger-Möller Algorithm for Boolean polynomials.

4.1 Gröbner bases and Elimination


We use the definition of an elimination ideal and the elimination theorem from [GP07]

Definition 4.1.1. Given I = hf1 , . . . , fs i ⊆ k [x1 , . . . , xn ], the i-th elimination ideal of I


defined by
Ii = I ∩ k [xi+1 , . . . , xn ] (4.1)

An i-th elimination ideal does not contain the variables x1 , . . . , xi , neither does the basis
generating it. The basis of an elimination ideal can be a Gröbner basis by using the elimination
theorem:

Theorem 4.1.2. Let I ⊆ k [x1 , . . . , xn ] be an ideal and G be a Gröbner basis of I with respect
to a lex ordering where x1  x2  · · ·  xn . Then for every 0 ≤ i ≤ n, the set

Gi = G ∩ k [xi+1 , . . . , xn ] (4.2)

is a Gröbner basis of the i-th elimination ideal Ii .

The proof for elimination theorem can be found in [GP07], page 70.

Example 4.1.3. Consider the ideal I in Z2 [x, y, z, u, v] generated by

S = {y + x + xu, v + y + yz)}

29
To eliminate x, y, z, we need to re-order variables such that all eliminated variables are greater
than the remaining variables, e.g

u≺v≺x≺y≺z

The reduced Boolean Gröbner basis of I w.r.t lexicographical ordering is

G = {xzu + xz + xu + x + v, zv, y + x + xu, xv + v, uv}

Then, by elimination theorem, G ∩ Z2 [u, v] = {uv} is a Gröbner basis of I ∩ Z2 [u, v].

4.2 All-SAT Problem


Given a Boolean formula presented in CNF, the All-SAT problem is the problem of finding all
of its solutions, as defined in the SAT problem. The all-SAT problem has many applications
in Artificial Intelligence and logic minimization.
The Blocking Clauses Method is a straight forward method to find all solutions of a formula.
Whenever the DPLL SAT Solver finds a solution, add the blocking clause describing the
negations of the solution to the solver, this can prevent the solver from reaching this solution
again. The last decision is then invalidated and the search continues normally. Continue this
proccess until no more solution is found and the algorithm will terminate.
For instances, SAT solver find the solution xi = T rue and yj = F alse for i, j ∈ {1, . . . , 100}
to a formula F of 200 variables, then the following blocking clause will be added to the solver

¬x1 ∨ ¬x2 ∨ · · · ∨ ¬x100 ∨ y1 ∨ y2 ∨ · · · ∨ y100 .

There could be millions of solutions, then millions of such a long clauses will be added to the
solver. Therefore, blocking clauses can blow up the memory and slow down the solvers.
Orna Grumberg at el. [GSY04] developed a memory-efficient All-SAT engine that can avoid
adding blocking clauses. Therefore, the speed of the solver as well as the used memory is not
affected by the number of solutions found. Moreover, this engine can find the set of all the
assignments to a subset of variables, namely important variables, which can be extended to
solutions of the formula.
Example 4.2.1. Use the CNF encoder, as explained in the first chapter, to convert the ideal
in Example 4.1.3 to a CNF formula

F = {y ∨ ¬x ∨ u, ¬y ∨ x, ¬u ∨ ¬y, y ∨ ¬v, v ∨ ¬y ∨ z, ¬v ∨ ¬z}

All assignments to (u, v) that can be extended to a solution of F are

A = {(0, 0), (0, 1), (1, 0)}

This means that any extension of (1, 1) can not satisfy F .

4.3 The Buchberger-Möller Algorithm for Boolean


Polynomials
Vanishing ideals of a finite set of points are of interest not only in mathematics, like in
coding theory and statistics, but also in molecular biology [LS04]. The Buchberger-Möller

30
Algorithm 4.3.1 Classical Buchberger-Möller Algorithm
Input: P = {P1 , ..., Pm } a set of points in K n and  a monomial ordering on K[x1 , . . . , xn ]
Output: The reduced Gröbner basis G of the vanishing ideal I(P ) and a set of standard
monomials B
1: Initialization: G = ∅, B = ∅, L = {1}, and C a 0 × m matrix
2: while L 6= ∅ do
3: Set t = min (L) and remove t from L
n
4: Compute P the evaluation vector v = (t(P1 ), . . . , t(Pm )) ∈ K
5: if v = j P aj rj , a linear combination of the rows of C then
6: add t − j aj B[j] to G, and remove all multiples of t from L.
7: else
8: add v as a new row to C, append t to B,
9: add to L those elements of {x1 t, . . . , xn t} which are neither multiples of an element
of L nor of lead(G).
10: end if
11: end while
12: Return G, B

Algorithm (BMA, for short) was proposed in [MB82] as a tool to compute these vanishing
ideals. The algorithm below is a formulation of the Classical Buchberger-Möller Algorithm as
given in [ABKR00].
The main idea of the BM Algorithm is that it evaluates monomials one by one in increasing
order (the smallest one is 1) at all points of P . Whenever the set of considered monomials can
build up a polynomial f that vanish at all points of P , adding f to G as an element of the
desired reduced Gröbner basis. Moreover, all multiples of the leading monomial of f will not
be evaluated, this will ensure that G is reduced. In Algorithm 4.3.1, the list L will be updated
m times where m is the number of points in P . Each time, the algorithm needs to check
which monomials in {x1 t, . . . , xn t} are multiples of an element of L or of lead(G). On the
other hand, the algorithm has to find the smallest monomial in a set of monomials L at least
m times. These two tasks are really time consuming. Therefore, we propose a new method
to update L and find the minimal element of L in constant time in case of the lexicographical
ordering.
Our method relates to the algorithm SM − A in [JS06]. The algorithm SM − A gener-
ates first a set of candidate standard monomials, then sorts them in increasing order. The
paper [Lun08] shows that sorting monomials is a time consuming task. Our method gen-
erates a sorted list (w.r.t lex) of candidate standard monomials. Let Bik := {u ∈ B ∩
K[xi , . . . , xn ] | degxi u = k} for k ≥ 1. Let Bi := B ∩ K[xi , . . . , xn ]. Let

L1i = {u · xi | u ∈ Bi+1 }
Lki = {u · xi | u ∈ Bik−1 }

The Algorithm 4.3.3 will return L = Lk+1 i if Bik is not empty. Otherwise, it will return
L = L1i−1 if i > 1 , and return empty list if i = 1.

Lemma 4.3.1. Bik ⊂ Lki .

Proof. Let v be an element of Bik , then v is in B ∩ K[xi , . . . , xn ] and degxi v = k. We can write
v = xi · u. Then, u is also a standard monomial of I(P ) since it is a divisor of a standard

31
monomial. Therefore, v is in Bi+1 if k = 1 or in Bik−1 if k > 1. This fact proves that Bik ⊂ Lki
for all k ≥ 1.

Lemma 4.3.2. The list L generated by the Algorithm 4.3.3 has following properties:

1. L is in increasing order, and

2. L contains no multiples of any element in lead(G) for the current G.

3. monomials in L are smaller than any candidate standard monomials not in L.

Proof. The first two properties are inherent from B and Bnew in the Algorithm 4.3.3. The
last one is true because of the lexicographical ordering.

Algorithm 4.3.2 Optimize BMA for lexicographical ordering


Input: P = {P1 , ..., Pm } a set of points in K n , X a list of variables in decreasing order
X1 > X2 > · · · > Xn .
Output: The reduced Gröbner basis G of the vanishing ideal I(P ) w.r.t lex. and the set of
standard monomials B.
Initialization: G = ∅, B = ∅, Bnew = ∅, L = [1], i = n and C a 0 × m matrix over K
while L 6= ∅ do
Set t is the first element of L, remove t from L.
Compute P the evaluation vector v = (t(P1 ), . . . , t(Pm ))
if v = j P aj rj , a linear combination of the rows of C then
add t − j aj B[j] to G, and remove all multiples of t from L.
else
add v as a new row to C, append t to the end of Bnew.
end if
if L = [ ] then
L, i = gen cand stdmonos(B, Bnew, i)
Append Bnew to the end of B
Bnew = ∅
end if
end while
Return G, B

Example 4.3.3. Consider P = {(0, 0), (0, 1), (1, 0), (1, 1)} ⊂ Q2 , and the lexicographical
ordering on Q[x, y] with x > y. The Table 4.1 and 4.2 show the steps of BMA and BMAlex
applied to P , respectively. They yield the same result G = {y 2 − y, x2 − x}, B = {1, y, x, xy}
in the same number of steps. However, the BMA needs more work than the BMAlex. The
BMA has to identify the monomials in the column check list which are neither multiples of
monomials in L nor in lead(G), then use these monomials to extend L. In addition, the BMA
has to find the minimal monomial of L while the first monomial of L in the BMAlex is already
the minimal monomial of L.

The update method for Boolean polynomials and lexicographical ordering is presented in
the Algorithm 4.3.4.

32
Algorithm 4.3.3 gen sorted cand stdmonos
Input: B, Bnew, i
Output: A list of candidate standard monomials
if Bnew = ∅ then
i=i−1
if i > 0 then
L = {u · Xi |u ∈ B}
else
L=∅
end if
else
L = {u · Xi |u ∈ Bnew}
end if
Return L, i

Table 4.1: BMA example


Step t = min(L) L − {t} Add to B Add to G Reduced L Check list Extended L
0 {1}
1 1 ∅ 1 x, y {x, y}
2 y {x} y xy, y 2 {x, y 2 }
3 y2 {x} y2 − y {x}
4 x ∅ x x2 , xy {x2 , xy}
5 xy {x2 } xy x2 y, xy 2 {x2 }
2
6 x ∅ x2 − x ∅

Table 4.2: BMAlex example


Step t = f irst(L) L − {t} Add to B Add to G Reduced L Check list Extended L
0 {1}
1 1 ∅ 1 {y}
2 y ∅ y {y 2 }
3 y2 ∅ y2 − y ∅ {x, xy}
4 x {xy} x
5 xy ∅ xy {x2 , x2 y}
6 x2 {x2 y} x2 − x ∅

Algorithm 4.3.4 gen sorted cand stdmonos bool


Input: B, Bnew, i
Output: A sorted list of candidate Boolean standard monomials
i=i−1
if i > 0 then
L = {u · Xi | u ∈ (B ∪ Bnew)}
else
L=∅
end if
Return L, i

33
4.4 Ideal of points by interpolation
In this section we revise the main algorithms in [BD13] which is used to compute the reduced
lexicographical Gröbner basis of a variety. We also add some descriptions as well as examples
to clarify the algorithms. The termination and correctness of the algorithms are proven in
[BD13].
A partial Boolean function f : Zn2 → Z2 can be defined by two disjoint subsets Z and O of
Zn2 where

• f (x) = 0 for every x ∈ Z,

• f (x) = 1 for every x ∈ O.

Therefore, we can denote f by bO O


Z . The domain of bZ is D = Z ∪ O.
We can define the sum of two partial functions as follows

(bO O2 n
Z1 + bZ2 ) : Z2 −→ Z2
1

x 7−→ bO O2
Z1 (x) + bZ2 (x)
1

By this definition, the sum of two partial functions also a partial function
(Z ∩O )∪(O ∩Z )
bO O2 1 2 1 2
Z1 + bZ2 = b(Z1 ∩Z2 )∪(O1 ∩O2 )
1

and its domain is


D = (Z1 ∪ O1 ) ∩ (Z2 ∪ O2 ) = D1 ∩ D2

Definition 4.4.1. Let > be an arbitrary monomial ordering, then we can extend > lex-
icographically to the set of Boolean polynomials (we make use the fact that all non-zero
coefficients are one) by setting p > q if and only if p 6= 0 and one of the following conditions
holds

• q=0

• q 6= 0 and lm(p) > lm(q),

• q 6= 0, lm(p) = lm(q) and tail(p)>tail(q).

Lemma 4.4.2. Let I ⊃ hx21 + x1 , . . . , x2n + xn i be an ideal in Z2 [x1 , . . . , xn ], p a Boolean


polynomial, and let G be a Gröbner basis of I with respect to a global monomial ordering.
Then the following two statements are equivalent:

• p is the lexicographically smallest Boolean polynomial in p + I

• p is reduced w.r.t G.

This lemma is proven in [BD13].


Let K be a field, X = {P1 , . . . , Pm } ⊂ K n be a finite set of points and φ : X → K be
a function on X, then there exist a polynomial f ∈ K[x1 , . . . , xn ] such that f (Pi ) = φ(Pi )
for i = 1, . . . , m. This is consequence of the Chinese Remainder Theorem. By the Chinese
remainder theorem, the map

K[x1 , . . . , Xn ]/I(X) −→ K m

34
mapping every f to (f (P1 ), . . . , f (Pm )) is an isomorphism of rings. Therefore, for each i, there
exists a polynomial hi such that hi (Pi ) = 1 and hi (Pj ) = 0 for every j 6= i. The polynomial
n
X
f= φ(Pi )hi ,
i=1

satisfies f (Pi ) = φ(Pi ) for i = 1, . . . , m.

Definition 4.4.3. A Boolean polynomial p is called an interpolation of a partial function f


if p(x) = f (x) for every x ∈ P , where P = O ∪ Z.

Algorithm 4.4.1, named interpolate smallest lex, can compute the smallest interpolation
polynomial w.r.t lexicographical monomial ordering under all polynomials interpolating the
same function on P

Algorithm 4.4.1 interpolate smallest lex(bO


Z)
O
Input: bZ a partial function definition
Output: smallest Boolean polynomial p w.r.t. lex. and fp = bO
Z on Z ∪ O
if O = ∅ then
Return 0
end if
if Z = ∅ then
Return 1
end if
i = min(top(O), top(Z))
Z1 = subset1(Z, xi )
Z0 = subset0(Z, xi )
O1 = subset1(O, xi )
O0 = subset0(O, xi )
C = (Z1 ∪ O1 ) ∩ (Z0 ∪ O0 )
f = bO
Z1
1

g = bO
Z0
0

ht = interpolate smallest lex(f + g)


F = ones(ht , (Z1 ∪ O1 )\C)
((O \C)⊕F )∪O
w = b((Z11\C)⊕F )∪Z00
he = interpolate smallest lex(w)
Return xi .ht + he

Example 4.4.4. Let Z = {(0, 0)} and O = {(0, 1), (1, 0)}. We will apply the algorithm 4.4.1
to find the smallest lex. interpolation Boolean polynomial p of bO
Z.

i=1
Z1 = ∅, Z0 = {0}, O1 = {0}, O0 = {1}
C = {0}
{0} {1} {0}
f = b∅ , g = b{0} , f + g = b∅
{0}
ht = interpolate smallest lex(b∅ ) = 1

35
{1}
F = ∅, w = b{0}
{1}
he = interpolate smallest lex(b{0} )
p = x1 + he

{1}
We apply the Algorithm 4.4.1 again to find the interpolation polynomial q of b{0}

i=2
Z1 = ∅, Z0 = {()}, O1 = {()}, O0 = ∅
C = {()}
{()} {()}
f = b∅ , g = b∅{()} , f + g = b∅
{()}
ht = interpolate smallest lex(b∅ ) = 1
F = ∅, w = b{()}
he = interpolate smallest lex(b{()} ) = 0
q = x2

The result is p = x1 + x2 .

Algorithm 4.4.2 computes the reduced lexicographical normal form of a polynomial w.r.t
vanishing ideal of a variety without Gröbner basis computation. The algorithm calls the
procedure zeros(f, P ) to find the set Z of all zeros of f in P , then the desired normal form is
P \Z
the smallest lexicographical interpolation polynomial of bZ .

Algorithm 4.4.2 Reduced lexicographical normal form against variety


Input: Boolean polynomial f, P set of points in Zn2 .
Output: nf by interpolate(f, P ) = N F (f, I(P ))
Z = zeros(f, P )
P \Z
Return interpolate smallest lex(bZ )

Example 4.4.5. We apply Algorithm 4.4.2 to find the normal form of p = x1 · x2 + x1 + x2


with respect to the variety P = {(0, 0), (0, 1), (1, 0)}. The set of zeros of p in P is Z = {(0, 0)}.
Therefore, the normal form of p with respect to P is
{(0,1),(1,0)}
interpolate smallest lex(b{(0,0)} ) = x1 + x2 .

Given a monomial ordering > and a set of points P . A monomial is called standard
monomial of ideal I if it is not in the leading ideal of I. The set of standard monomials of
I(P ) has the same cardinality as P . Based on this conclusion, Algorithm 4.4.3 is developed
to compute all standard monomials of I(P ). The algorithm takes a random subset Z of P ,
P \Z
then finds the smallest lex. interpolation polynomial p of bZ . This polynomial is reduced
w.r.t I(P ), hence its terms are not in the leading ideal of I. Therefore, all terms of p as well
as their divisors are standard monomials of I(P ). The process continues until all |P | standard
monomials of I(P ) are found. In this algorithm, the procedure random subset(P ) will return
a random subset of P , the supp(p) is the support of P defined as the set of all terms (with
non-zero coefficients) of p.

36
Algorithm 4.4.3 Standard monomials of I(P): standard monomials variety(P)
Input: P set of points in Zn2 .
Output: S = {t|∃ reduced p ∈ I(P ) : t term of p}
S=∅
while |P | =
6 |S| do
Z = random subset(P )
P \Z
p = interpolate smallest lex(bZ )
S = S ∪ supp(p)
S = {t term | ∃s ∈ S : t divides s}
end while
Return S

Example 4.4.6. Let P = {(0, 0), (0, 1), (1, 0)}, we use Algorithm 4.4.3 to find all standard
monomials of I(P ). Assume a random subset of P is Z = {(0, 0)}, then
{(0,1),(1,0)}
p = interpolate smallest lex(b{(0,0)} ) = x1 + x2 .

The support of p is {x1 , x2 }, hence S = {1, x1 , x2 }. At this point, S has 3 elements, so all the
standard monomials of I(P ) are 1, x1 , x2 .

After finding all standard monomials, we can obtain the leading monomials of the minimal
Gröbner basis by collecting all minimal elements of the remaining Boolean monomials, see
Algorithm 4.4.4

Algorithm 4.4.4 Leading monomials of a minimal Gröbner basis of I(P)


Input: P set of points in Zn2 .
Output: leading monomials variety(P ) = L(I(P ))
T = {t Boolean term in Z2 [x1 , . . . , xn ]}
R = T \standard monomial variety(P )
Return minimal elements(R)

Example 4.4.7. Consider again P = {(0, 0), (0, 1), (1, 0)}. All Boolean terms in Z2 [x1 , . . . , x2 ]
are 1, x1 , x2 and x1 x2 . Using the result from Example 4.4.6, we get R = {x1 x2 } and the leading
monomial of I(P ) is x1 x2 .

The algorithm 4.4.5 constructs the reduced lexicographical Gröbner basis from the set of
leading monomials.

Algorithm 4.4.5 lex groebner basis points(P )


Input: P a set of points in Zn2 .
Return {t + nf by interpolate(t, P )| t ∈ L(I(P ))}

Example 4.4.8. Continuing Example 4.4.7, the vanishing ideal of P has only one leading
monomial, hence the reduced lexicographical Gröbner basis of I(P ) has only one polynomial.
It is
x1 x2 + nf by interpolate(x1 x2 , P ) = x1 x2 .

37
Table 4.3: Compare BDA and BMAlex
nvars npoints BDA BMAlex nvars npoints BDA BMAlex
10 1000 0.1 2.9 100 100 0.7 0.3
20 1000 2.9 8 100 200 1.7 0.5
50 1000 11.1 8.6 100 500 10.8 2.1
100 1000 26 9 100 1000 29 7
200 1000 72 11 100 2000 86 34
500 1000 316 16 100 5000 446 637
1000 1000 929 24 100 10000 1549 9850

For a given set of points P , we presented two algorithms to compute the reduced Boolean
Gröbner basis of vanishing ideal of P . To compare these two algorithms, we generate a random
set of points P and also vary the number points and variables. From the Table 4.3, we can see
that the algorithm from Brickenstein and Dreyer (BDA) is sensitive to the number of variables
while BMAlex is sensitive to the number of points.

4.5 SAT and Interpolation approach


We propose a new method to compute the Gröbner basis of an elimination ideal of a given ideal.
In this approach, we combine the power of all-solutions SAT Solver and interpolation. Firstly,
we convert the ideal to a CNF formula F by the CNF encoder of Brickenstein. The benefit
of this encoder is that no new variables are introduced. Then, we find all satisfying partial
assignments V of F to important variables by All-SAT Solvers. Finally, we use interpolation
to construct the Gröbner basis of the vanishing ideal of V .

Algorithm 4.5.1 SATElim


Input: An ideal I in Z [x1 , . . . , xn ] containing hx21 +x1 , . . . , x2n +xn i, an integer i ∈ [0, 1, . . . , n]
Output: reduced lexicographical Boolean Gröbner basis of ith elimination ideal of I
P = all satisfying partial assignment d to CN F Encoder(I)
/* d contains only variables in {xi+1 , . . . , xn } */
Return lex groebner basis points(P )

To prove the correctness of the Algorithm 4.5.1, we need the following theorem and its
corollary proven in [BDG+ 09].
Theorem 4.5.1. Every ideal I ⊂ Z2 [x1 , . . . , xn ] with I ⊃ hx21 + x1 , . . . , x2n + xn i is radical.
For such an ideal I in Theorem 4.5.1, the algebraic set V (I) in Zn2 and in the algebraic
closure of Zn2 are the same, hence we have
Corollary 4.5.2. For an ideal I ⊂ Z2 [x1 , . . . , xn ] with I ⊃ hx21 + x1 , . . . , x2n + xn i,

I(V (I)) = I.

Now, we can prove the correctness of the Algorithm 4.5.1.


Theorem 4.5.3. The algorithm 4.5.1 computes exactly the reduced lexicographical Boolean
Gröbner basis of the ith elimination ideal of I.

38
Proof. Algorithm 4.5.1 firstly computes P , the projection of all solutions of I on Z2 [Y ], where
Y = {xi+1 , . . . , xn }, in notation P = πY (V (I)).
The set πY (V (I)) is finite, so Zariski closed (since it is algebraic). Therefore, by the Closure
Theorem,
πY (V (I)) = V (I ∩ Z2 [Y ]). (4.3)
This implies that the vanishing ideal of P is equal to I(V (I ∩ Z2 [Y ])). Applying Corollary
4.5.2 to I ∩ Z2 [Y ], we get
I(V (I ∩ Z2 [Y ])) = I ∩ Z2 [Y ]. (4.4)
This proves that Algorithm 4.5.1 returns the reduced lexicographical Boolean Gröbner basis
of I ∩ Z2 [Y ].

4.6 Experimental results


For the experiment, we use the All-SAT Solver source code from Yadgar [GSY04] and the
Boolean interpolation source code from Brickenstein [BD13]. We compare the two approaches
on the automata benchmarks. In the following, we will describe a simple automata benchmark.
Let I be an ideal in the Boolean ring generated by
signal(4) + (1 + signal(1))(1 + state(2)),
signal(5) + (1 + signal(0)) state(1),
signal(6) + (1 + signal(2))(1 + signal(4)),
signal(7) + (1 + signal(3))(1 + signal(5)),
signal(8) + (1 + signal(4))(1 + signal(5)),
signal(9) + (1 + signal(7))(1 + signal(8)),
signal(10) + (1 + state(0)) signal(9),
signal(11) + signal(0)(1 + signal(10)),
next(0) + signal(11),
next(1) + signal(10),
next(2) + signal(6)

with variables state(0), state(1), state(2), signal(0), . . . , signal(11) and next(0), next(1),
next(2).
To figure out relations between states variables and next variables, we have to eliminate
all signal variables. This can be done by computing a Gröbner basis of an elimination ideal.
The two approaches will be applied to solve this problem.
We limit time to 10 hours and memory to 50 GB. The sign × means error matrix-size
exceed.

4.7 Conclusion
We have presented an alternative approach to compute Boolen Gröbner bases of Boolean
elimination ideals. This approach is really efficient in case we want to eliminate most of
the variables. In such a case, our approach can solve many hard instances that the classical
approach can’t. Our approach is very sensitive to the number of remaining variables. Time
and memory can increase exponentially when this number increases.

39
Table 4.4: Comapre two approaches on some Automata benchmarks.
Problem informations Time (in second) Memory (in Megabyte)
name vars Ivars Gröbner basis SATElim Gröbner basis SATElim
s27 18 6 0.07 0.02 84 83
s208 97 16 5.2 0.08 94 84
s298 140 28 × 21 - 185
s344 143 30 × 363 - 1251
s349 143 30 × 403 - 1267
s382 176 42 × 121 - 337
s386 192 12 25388 0.15 1394 84
s420 205 32 × 26 - 242
s444 201 42 × 158 - 334
s510 244 12 TO 0.16 - 84
s526 252 42 × 19510 - 16866
s641 219 38 × 32775 - 15310
s713 222 38 TO 34217 - 15370
s820 410 10 TO 0.20 - 85
s832 425 10 TO 0.17 - 85
s838 421 64 × - - MO
s953 421 58 TO 1.13 - 104
s1196 528 36 TO 35116 - 20175
s1238 576 36 TO 15481 - 11544
s1423 626 148 TO - - MO
s1488 699 12 TO 0.58 - 87
s1494 709 12 TO 0.58 - 87

40
Table 4.5: Comapre two approaches on some simplified benchmarks.
name Time (in second) Memory (in Megabyte)
Gröbner basis SATElim Gröbner basis SATElim
H.S27 0.03 0.03 83 83
H.S208 0.03 0.07 84 83
H.S298 0.01 0.16 84 84
H.S344 0.12 7.32 85 154
H.S349 0.13 4.6 84 148
H.S382 17.08 2.78 217 124
H.S386 22.19 0.08 127 83
H.S420 4.94 0.12 92 84
H.S444 0.36 0.01 85 84
H.S510 4.4 0.09 109 84
H.S526 0.35 1.24 85 93
H.S641 5415 6.6 864 123
H.S713 3566 6.69 574 128
H.S820 4465 0.153 1331 85
H.S832 8215 0.16 1974 85
H.S838 47544 25 2842 253
H.S953 84 0.27 121 20.5

41
42
Chapter 5
Verification by abstraction and computer
algebra techniques
This is a joint work with Oliver Marx from the department of Electrical and Computer Engi-
neering, TU Kaiserslautern. Oliver Marx builded the abstract models on which I could build
algebraic models and use computer algebra techniques to prove the desired properties.

5.1 Introduction
Verification is very important since it ensures that the design works correctly as expected.
However, the usual methods (for example, using an instance of SAT solver, Binary Decision
Diagram, simulation) can not verify efficiently the components that contain complicated data-
paths, like multiplier and filter. Pavlenko at al [PWS+ 11] has proposed a computer algebra
approach to solve this problem. They extract bit-level informations and transform them to
polynomials in Z2k [X]/hx2 − x : x ∈ Xi. This means that coefficients of polynomials are finite
length integers, but variables are still bit variables. The number of variables and polynomials
will increase very much if the bitwidth is increasing. For instance, to model a signal of type
64 bits integer, we need 64 bit-variables.
Recent developments in abstraction techniques allow us to build abstract models at word
level. For instances, we can reformulate the following bit operation a << 1, i.e. shift a 1 bit
to right, to word operations a · 2.
Our approach is as follows. We use abstraction techniques to lift bit operations to word
operations whenever possible. This way, we can construct an abstract model. Then, we
reformulate it as a system of polynomials in ring Z2k [x1 , . . . , xn ]. We try to order the variables
such that the system has been already a Gröbner basis w.r.t lexicographical monomial ordering.
Finally, the normal form is employed to prove the desired properties.
The description of the abstraction techniques is out of the scope of this thesis. It will
appear in Oliver Marx’s thesis. Here, we focus on how to build the algebraic model from the
abstract design and prove its properties by computer algebra tools.
To evaluate our approach, we verify the global property of a multiplier and a FIR filter
using the computer algebra system Singular [DGPS12]. The result shows that our approach
is much faster than the commercial verification tool from Onespin [One].
In this chapter, digital designs will be described in Very High Speed Integrated Circuit
Hardware Description Language (VHDL) at Register Transfer Level (RTL).

43
Figure 5.1: Clock signal in form of a square wave
raising edge falling edge

a clock cycle

5.2 VHDL
VHDL is a standard language for describing the structure and function of digital electronic
systems. It also allows us to verify the behavior of the design before translating it into real
hardware.
In VHDL, a design consists of at least an entity which describes the interface and at least
an architecture which describes the function. An entity is an object in VHDL containing in-
formation about input ports and output ports. An architecture contains processes, concurrent
signal assignments, etc.
A simple signal assignments in VHDL is of the form

signal name <= expression

For example, x <= a + b.


A process is a sequence of statements. We may specify a list of signals as sensitive list of
the process. In case the sensitive list is specified, the process is only activated when an event
occurs (that is, the value of some signal in the sensitive list changes), the process suspends
after the last statement. If more than one process is activated at same time, they are executed
concurrently. The signal assignment in a process becomes effective only when the process
suspends. Before that moment, they take their old values.
A concurrent signal assignments is the process which contains only one signal assignment
statement. In this case, all signals on the left hand side of the assignment play role of the
sensitive list.
To activate a process at a fixed frequency, a clock signal is included in the sensitive list of
the process. A clock signal is a particular type of signal that oscillates between a high and
a low state in the form of a square wave. The distance between two successive raising edges
is a clock cycle, see Fig. 5.1. A statement whose execution depends on clock signal is called
synchronous statement, the others are called asynchronous statements.
Example 5.2.1. Consider the following VHDL code
c<=a ;
p r o c e x : process ( c l k )
begin
i f ( r a i s i n g e d g e ( c l k ) ) then
b<=a ;
end i f ;
end process p r o c e x ;
It consists of a process named proc ex, and a concurrent signal assignment. The process is
only sensitive to the clock signal. The signal assignment b <= a is synchronous and is executed

44
only at raising edge of clock signal. In contrast, the concurrent signal assignment c <= a is
asynchronous and is executed whenever the value of a changes.

5.3 Algebraic models


We associate the synchronous assignment a <= p(x, y, . . . ) with ai − p(xi−1 , yi−1 , . . . ), where p
is a polynomials depending on the variable x, y . . . and i is the considered state. The polyno-
mial associated to the asynchronous assignment a <= p(x, y, . . . ) should be ai − p(xi , yi , . . . ).
The range of i depends on how many clock cycles we need to prove the desired properties.

Assignment synchronous asynchronous


c <= a + b ci − ai−1 − bi−1 c i − ai − b i
c <= a ∗ b ci − ai−1 · bi−1 c i − ai · b i

When all signal assignments as well as the desired properties can be represented as polyno-
mials over Z2k , we can prove the property using Gröbner basis techniques and reduced normal
forms. Let S be the set of all polynomials associated with signal assignments at all states
involved in the proof goals, and I the ideal generated by S. Let p be the polynomial that
represents the proof goal. Compute a Gröbner basis G of the ideal I. Then the property holds
if and only if the normal form of p with respect to G is zero. Moreover, in most cases, we can
order the variables with respect to the so-called topological order, such that S is a Gröbner
basis w.r.t lexicographical monomial ordering.
The topological order of variables is computed as follows

1. Variables corresponding to the signal in the right hand side of a signal assignments are
less than the one in the left hand side.

2. If two variables correspond to the same signal, but at different state, then the variable
corresponding to the signal at higher state is greater.

With topological order of variables above and the lexicographical monomial ordering, the
leading monomials of all polynomials in S are variables. If these variables are pairwise different,
then S is a Gröbner basis of I.

5.4 Applications
We use our approach to verify the global property of a multiplier and a filter.

5.4.1 Multiplier
We consider a design of a multiplier which is used for multiplying two integers of the same
bitwidth. The verification tool Onespin [One] needs 724 seconds to verify the global property
of the original 24 bit multiplier design. Onespin also use symbolic method to verify the
property. Some preprocessing techniques are applied at first, then bit-blasting is used to
convert the problem to CNF and solved by SAT solvers. The paper [PWS+ 11] shows that
the CNF coming from bit-blasting of the design with complicated data path, like multiplier,
is very hard for SAT solver.

45
To make the verification process faster, we first build an abstract design of this multiplier.
Now, Onespin can do the job with the abstract design in 592 seconds. However, this cost is
still not feasible since we want to verify the multiplier of higher bits. Therefore, we do a next
step, building an algebraic model based on the abstract model, then using computer algebra
techniques to verify it.
Consider a multiplier whose original design is written in the VHDL language and given in
Appendix A.1. There are lots of type casting in this design. Moreover, most of the operations
are at the bit level. To have a simple algebraic model, we need to build an abstract design
of this multiplier. The new design will take 2 integers a and b as inputs and return result as
product of a and b. The other inputs (e.g clk, reset, and start) and output (e.g ready) are
used to control the multiplying process.
library i e e e ;
use i e e e . s t d l o g i c 1 1 6 4 . a l l ;
use i e e e . n u m e r i c s t d . a l l ;
use work . c o n s t . a l l ;

ENTITY m u l t i p l i e r IS
port (
clk : IN std logic ;
r e s e t : IN std logic ;

a : IN s t d l o g i c v e c t o r (BIT WIDTH−1 DOWNTO 0 ) ;


b : IN s t d l o g i c v e c t o r (BIT WIDTH−1 DOWNTO 0 ) ;
start : IN s t d l o g i c ;

ready : OUT s t d l o g i c ;
r e s u l t : OUT s t d l o g i c v e c t o r ( 2 ∗BIT WIDTH−1 DOWNTO 0 )
);
END m u l t i p l i e r ;

ARCHITECTURE b e h a v i o r OF m u l t i p l i e r IS
type s t a t e t y p e i s ( S CSM IDLE , S CSM CALCULATE ) ;
signal s t a t e : s t a t e t y p e ;
signal ready r : s t d l o g i c ;
s i g n a l r e g a : u n s i g n e d ( 2 ∗BIT WIDTH−1 DOWNTO 0 ) ;
s i g n a l r e g b : u n s i g n e d (BIT WIDTH−1 DOWNTO 0 ) ;
s i g n a l r e s u l t r : u n s i g n e d ( 2 ∗BIT WIDTH−1 DOWNTO 0 ) ;

BEGIN
FSM: PROCESS( c l k , r e s e t )
BEGIN
i f ( r e s e t = ’1 ’) then
s t a t e <= S CSM IDLE ;
r e a d y r <= ’ 0 ’ ;
e l s i f ( r i s i n g e d g e ( c l k ) ) then
i f ( s t a t e=S CSM IDLE ) and ( s t a r t = ’0 ’) then
s t a t e <= S CSM IDLE ;
r e a d y r <= ’ 0 ’ ;
e l s i f ( s t a t e=S CSM IDLE ) and ( s t a r t = ’1 ’) then
s t a t e <= S CSM CALCULATE ;
r e g a <= a ;
r e g b <= b ;
r e s u l t r <= 0 ;
r e a d y r <= ’ 0 ’ ;
e l s i f ( s t a t e = S CSM CALCULATE) and ( r e g b /= 0 ) then

46
s t a t e <= S CSM CALCULATE ;
r e g a <= r e g a ∗ 2 ;
r e g b <= r e g b / 2 ;
r e s u l t r <= r e s u l t r + r e g b ( 0 ) ∗ r e g a ;
r e a d y r <= ’ 0 ’ ;
e l s i f ( s t a t e = S CSM CALCULATE) and ( r e g b = 0 ) then
s t a t e <= S CSM IDLE ;
r e g b <= 0 ;
r e a d y r <= ’ 1 ’ ;
end i f ;
end i f ;
END PROCESS FSM;
ready <= r e a d y r ;
r e s u l t <= r e s u l t r ;
END b e h a v i o r ;

We want to prove the following property. At any state i, if readyi = 1 then ri = a · b.


However, readyi = 1 if and only if bi = 0, hence the property is equivalent to ri = a · b
whenever bi = 0. This property is called the global property of the multiplier. To prove this
property, we construct its algebraic model.
In this design, there are assignments whose right hand sides are not polynomials of word
variables. The first one contains the integer division b/2, and the second one concerns extract-
ing the least significant bit b0 of the integer b, where

k
X
b= 2j bj .
j=0

These two operations can be represented as polynomials over Z2k as follows

b0i + 2 · bi − bi−1 ,

It contains a finite set of polynomials J describing the operations in the design and the
polynomials describing the proof goals. The system J can be partitioned into an initial ideal
Init, state ideals Ji , for i from 0 to bitwidth, where

Init = {a0 − a, b0 − b, r0 },
Ji = {ai − 2 · ai−1 , b0i−1 + 2 · bi − bi−1 , ri − ri−1 − ai−1 · b0i−1 }.

The state ideal Ji represents all operations performed at state i.


We can find a topological variable order such that J as well as I = J ∪ {bi } is a Gröbner
basis w.r.t lexicographical monomial ordering, e.g

rk > · · · > r0 > ak > · · · > a0 > a > b0k > · · · > b00 > bk > · · · > b0 > b.

With above ordering, the leading terms of all polynomials are variables, and these variables
are pairwise different, hence the ideals I and J are Gröbner bases.
Polynomials for proof goal are pi = ri − a · b. We compute the normal form of all pi with
respect to the ideal I. The desired property is satisfied if and only if all the normal forms are
zero.

47
Example 5.4.1. As an illustration, we would verify the global property of a 2-bit multiplier.
The proof goal is ri = a · b whenever bi = 0 for 0 ≤ i ≤ 2. The proof goal involves 2 clock
cycles. Therefore, the system J is the union of:

Init = {a0 − a, b0 − b, r0 },
J1 = {a1 − 2 · a0 , b00 + 2 · b1 − b0 , r1 − r0 − a0 · b00 }
J2 = {a2 − 2 · a1 , b01 + 2 · b2 − b1 , r2 − r1 − a1 · b01 }.

Polynomials for the proof goal are p1 := r1 − a · b and p2 := r2 − a · b. We also add the
polynomial bi for the assumption bi = 0 to J when checking pi . The variables are ordered as
follows:
r2 > r1 > r0 > a2 > a1 > a0 > a > b01 > b00 > b2 > b1 > b0 > b.
With the lexicographical monomial ordering, the leading terms of all polynomials in J ∪ {bi }
are
a0 , b0 , r0 , a1 , b00 , r1 , a2 , b01 , r2 , and bi .
All of them are variables and pairwise different, hence J ∪ {bi } are Gröbner bases for i = 0, 1, 2
by the product criterion.
Now, we compute the normal form of p2 with respect to I2 := J ∪ {b2 }. The notation
g
f→− h means f is reduced to h by g.

r2 −r1 −a1 ·b0


1
p2 := r2 − a · b −−−−−−−→ r1 + a1 · b01 − a · b
r1 −r0 −a0 ·b0
0
−−−−−−−→ r0 + a1 · b01 + a0 · b00 − a · b
r

→0
a1 · b01 + a0 · b00 − a · b
a −2·a
1
−− 0
−−→ 2 · a0 · b01 + a0 · b00 − a · b
a −a
0
−−−→ 2 · a · b01 + a · b00 − a · b
b0 +2·b2 −b1
1
−− −−−−→ a · b00 − 4 · a · b2 + 2 · a · b1 − a · b
b0 +2·b1 −b0
0
−− −−−−→ −4 · a · b2 + a · b0 − a · b
b
2

→ a · b0 − a · b
b −b
−0−→ 0

Similarly, we can prove that

N F (pi | J ∪ {bi }) = 0, for all i = 0, 1, 2.

Hence, the global property of this multiplier is satisfied.

The Table 5.1 presents the verification time (in seconds) of the global property of the
multiplier with different bitwidths using the computer algebra system Singular [DGPS12].
The timing table shows that our approach can verify the global property of the multiplier of
up to 1024 bits while Onespin is unable to verify it from 64 bit.

48
Table 5.1: Verify multiplier by abstraction and computer algebra
bit-width nvars time
32 133 0.05
64 261 0.26
128 517 1.83
256 1029 21
512 2053 283
1024 4101 6138

5.4.2 FIR Filter


FIR filters are special digital filters used in Digital Signal Processing (DSP) applications. The
FIR stands for Finite Impulse Response. Original designs of FIR filters are not presented in
this thesis, since it is too complicated. We consider at first a small FIR filter with its abstract
design as follows:
library i e e e ;
use i e e e . s t d l o g i c 1 1 6 4 . a l l ;
use i e e e . n u m e r i c s t d . a l l ;
entity c f f i r 3 8 8 i s
port (
s i g n a l c l o c k c : in s t d l o g i c ;
s i g n a l r e s e t : in s i g n e d ( 0 downto 0 ) ;
s i g n a l data : in s i g n e d ( 7 downto 0 ) ;
s i g n a l k0 : in s i g n e d ( 7 downto 0 ) ;
s i g n a l k1 : in s i g n e d ( 7 downto 0 ) ;
s i g n a l k2 : in s i g n e d ( 7 downto 0 ) ;
s i g n a l k3 : in s i g n e d ( 7 downto 0 ) ;
s i g n a l d a t a o : out s i g n e d ( 1 7 downto 0 )
);
end entity c f f i r 3 8 8 ;

architecture r t l of c f f i r 3 8 8 i s
s i g n a l mult 0 : s i g n e d ( 1 5 downto 0 ) ;
s i g n a l mult 1 : s i g n e d ( 1 5 downto 0 ) ;
s i g n a l mult 2 : s i g n e d ( 1 5 downto 0 ) ;
s i g n a l mult 3 : s i g n e d ( 1 5 downto 0 ) ;
s i g n a l d a t a r d e l a y e d 1 : s i g n e d ( 7 downto 0 ) ;
s i g n a l d a t a r d e l a y e d 2 : s i g n e d ( 7 downto 0 ) ;
s i g n a l d a t a r d e l a y e d 3 : s i g n e d ( 7 downto 0 ) ;
s i g n a l d a t a r d e l a y e d 4 : s i g n e d ( 7 downto 0 ) ;
s i g n a l d a t a o r d e l a y e d 1 : s i g n e d ( 1 7 downto 0 ) ;
s i g n a l d a t a o r d e l a y e d 2 : s i g n e d ( 1 7 downto 0 ) ;
s i g n a l d a t a o r d e l a y e d 3 : s i g n e d ( 1 7 downto 0 ) ;
begin
mult 0 <= k0 ∗ d a t a r d e l a y e d 1 ;
mult 1 <= k1 ∗ d a t a r d e l a y e d 2 ;
mult 2 <= k2 ∗ d a t a r d e l a y e d 3 ;
mult 3 <= k3 ∗ d a t a r d e l a y e d 4 ;
d a t a o <= d a t a o r d e l a y e d 3 ;
process ( c l o c k c , r e s e t ) i s
begin
i f r e s e t = 1 then
d a t a r d e l a y e d 1 <= 0 ;

49
d a t a r d e l a y e d 2 <= 0 ;
d a t a r d e l a y e d 3 <= 0 ;
d a t a o r d e l a y e d 1 <= 0 ;
d a t a o r d e l a y e d 2 <= 0 ;
d a t a o r d e l a y e d 3 <= 0 ;
e l s i f r i s i n g e d g e ( c l o c k c ) then
d a t a r d e l a y e d 1 <= data ;
d a t a r d e l a y e d 2 <= d a t a r d e l a y e d 1 ;
d a t a r d e l a y e d 3 <= d a t a r d e l a y e d 2 ;
d a t a r d e l a y e d 4 <= d a t a r d e l a y e d 3 ;
d a t a o r d e l a y e d 1 <= mult 0 + mult 1 + mult 2 + mult 3 ;
d a t a o r d e l a y e d 2 <= d a t a o r d e l a y e d 1 ;
d a t a o r d e l a y e d 3 <= d a t a o r d e l a y e d 2 ;
end process ;
end architecture r t l ;

In this design, there are both synchronous assignments and asynchronous assignments. The
names of signals are meanful, but they are too long. Therefore, we assign to each signal a new
variable name. The Table 5.2 shows the signal names and their corresponding variable names.

Table 5.2: Signal names and their corresponding variable names


signal name variable name
data a
data r delayed j (j = 1, 2, 3, 4) bj
kj (j = 0, 1, 2, 3) kj
mult j (j = 0, 1, 2, 3) mj
data o r delayed j (j = 1, 2, 3) yj
data o z

All asynchronous and synchronous assignments together with their associated polynomials
at state i are presented in Table 5.3 and Table 5.4.

Table 5.3: Transformations of all asynchronous assignments


VHDL assignments Polynomials
mult j <= k j ∗ data r delayed (j + 1) with j = 0, 1, 2, 3 mj,i − kj,i · bj+1,i
data o <= data o r delayed 3 zi − y3,i

Table 5.4: Transformations of all synchronous assignments


VHDL assignments Polynomials
data r delayed 1 <= data b1,i − ai−1
data r delayed (j + 1) <= data r delayed j with j = 1, 2, 3 bj+1,i − bj,i−1
data o r delayed 1 <= mult 0 + mult 1 + mult 2 + mult 3 y1,i − m0,i−1 − m1,i−1 − m2,i−1 − m3,i−1
data o r delayed (j + 1) <= data o r delayed j with j = 1, 2 yj+1,i − yj,i−1

We want to prove the following property of the design.


property property h is
assume :
d u r i n g [ t −4, t ] : r e s e t = 0 ;
prove :

50
a t t : mult 0 = k 0 i ∗ prev ( data , 1 ) ;
a t t : mult 1 = k 1 i ∗ prev ( data , 2 ) ;
a t t : mult 2 = k 2 i ∗ prev ( data , 3 ) ;
a t t : mult 3 = k 3 i ∗ prev ( data , 4 ) ;
a t t : d a t a o = prev ( mult 0 + mult 1 + mult 2 + mult 3 ,3);
end p r o p e r t y ;
We may understand the property above as follows: assume that there is no reset in 5 continue
states (name these state 1, 2, 3, 4, 5), prove that
• mult 0 ( at state 5) = k0 i ( at state 5) ∗ data ( at state 4),
• mult 1 ( at state 5) = k1 i ( at state 5) ∗ data ( at state 3),
• mult 2 ( at state 5) = k2 i ( at state 5) ∗ data ( at state 2),
• mult 3 ( at state 5) = k3 i ( at state 5) ∗ data ( at state 1),
• data o ( at state 5) = mult 0 + mult 1 + mult 2 + mult 3 (at state 2).
The polynomials for these proof goals are
• p0 := m0,5 − k0,5 · a4 ,
• p1 := m1,5 − k1,5 · a3 ,
• p2 := m2,5 − k2,5 · a2 ,
• p3 := m3,5 − k3,5 · a1 ,
• p4 := z5 − m0,2 − m1,2 − m2,2 − m3,2 .
Let G be the set of all polynomials in Table 5.3 and 5.4 at five states 1, 2, 3, 4, 5. There are
total 60 polynomials in G. The topological variable order of G at state i is
zi > y3,i > · · · > y1,i > m3,i > · · · > m0,i > b3,i > · · · > b1,i > ai > k3,i > k0,i .
If some variables correspond to the same signals, but at different states, then the variable
corresponding to the signal at higher state is larger. When the variables are ordered in this
way, the leading terms (w.r.t lex) of all polynomials in G are variables and pairwise different.
Hence, G is a Gröbner basis w.r.t lexicographical ordering. Therefore, to check the proof goals,
we just need to check whether the normal form pi w.r.t G is zero. The normal form of p2 w.r.t
G is computed as follows:
m2,5 −k2,5 ·b3,5
p2 := m2,5 − k2,5 · a2 −−−−−−−−→ k2,5 · b3,5 − k2,5 · a2
b3,5 −b2,4
−−−−−→ k2,5 · b2,4 − k2,5 · a2
b2,4 −b1,3
−−−−−→ k2,5 · b1,3 − k2,5 · a2
b2,4 −a2
−−−−→ 0

So the property corresponding to p2 is satisfied. Similarly, the properties corresponding to


p0 , p1 , and p3 are also satisfied. Now, we compute the normal form of p4 w.r.t G.
z5 −y3,5
p4 := z5 − m3,2 − m2,2 − m1,2 − m0,2 −−−−→ y3,5 − m3,2 − m2,2 − m1,2 − m0,2

51
y3,5 −y2,4
−−−−−→ y2,4 − m3,2 − m2,2 − m1,2 − m0,2
y2,4 −y1,3
−−−−−→ y1,3 − m3,2 − m2,2 − m1,2 − m0,2
y1,3 −m3,2 −m2,2 −m1,2 −m0,2
−−−−−−−−−−−−−−−−→ 0

It implies that the property corresponding to p4 is also satisfied.


To compare the timing of the verification by different tools, we consider the abstract design
of a larger FIR filter presented in A.2. With this design, Singular just needs one second to
verify the algebraic model, while Onespin needs 70 seconds to verify the same property with
the abstract design, and would need approximately 600 years to verify that property with the
original design.

5.5 Conclusion
Verification by abstraction and computer algebra techniques is a promising approach. We can
verify a digital component containing a complicated data path much faster than the usual
approach. By lifting bit operations to word operations, we can reduce the number of variables
and polynomials by many order of magnitudes. As a result, the verification by algebraic
method is more efficient with the help of abstraction techniques.

52
Appendix A
Designs of a multiplier and a filter
A.1 Multiplier
library ieee ;
use ieee . std_logic_1164 . all ;
use ieee . numeric_std . all ;
use work . const . all ;

ENTITY multiplier IS
port (
clk : IN std_logic ;
reset : IN std_logic ;

a : IN std_logic_vector ( BIT_WIDTH -1 DOWNTO 0) ;


b : IN std_logic_vector ( BIT_WIDTH -1 DOWNTO 0) ;
start : IN std_logic ;

ready : OUT std_logic ;


result : OUT std_logic_vector (2* BIT_WIDTH -1 DOWNTO 0)
);
END multiplier ;

ARCHITECTURE behavior OF multiplier IS


type state_type is ( IDLE , CALCULATING , OUTPUT ) ;
signal state : state_type ;
signal valid_r : std_logic ;
signal reg_a : unsigned (2* BIT_WIDTH -1 DOWNTO 0) ;
signal reg_b : unsigned ( BIT_WIDTH -1 DOWNTO 0) ;
signal sum : unsigned (2* BIT_WIDTH -1 DOWNTO 0) ;
BEGIN
FSM : PROCESS ( clk , reset )
BEGIN
if ( reset = ’1 ’) then
state <= IDLE ;
reg_a <= ( others = > ’0 ’) ;
reg_b <= ( others = > ’0 ’) ;
sum <= ( others = > ’0 ’) ;
valid_r <= ’0 ’;
elsif ( rising_edge ( clk ) ) then
if ( state = IDLE ) and ( start = ’0 ’) then
valid_r <= ’0 ’;
elsif ( state = IDLE ) and ( start = ’1 ’) then
state <= CALCULATING ;
reg_a <= resize ( unsigned ( a ) ,2* BIT_WIDTH ) ;
reg_b <= unsigned ( b ) ;
valid_r <= ’0 ’;

53
sum <= ( others = > ’0 ’) ;
elsif ( state = CALCULATING ) then
if ( reg_b = 0) then
state <= IDLE ;
valid_r <= ’1 ’;
else
if reg_b (0) = ’1 ’ then
sum <= sum + reg_a ;
end if ;
reg_a (2* BIT_WIDTH -1 downto 0) <= reg_a (2* BIT_WIDTH -2
downto 0) & ’0 ’;
reg_b ( BIT_WIDTH -1 downto 0) <= ’0 ’ & reg_b ( BIT_WIDTH -1
downto 1) ;
end if ;
end if ;
end if ;
END PROCESS FSM ;

ready <= valid_r ;


result <= std_logic_vector ( sum ) ;
END behavior ;

property multiply is
dependencies :
no_reset ;
for timepoints :
tb = t +1.. BIT_WIDTH waits_for ready =1;
freeze :
fa = a@t ,
fb = b@t ;
assume :
at t : CSM_IDLE ;
at t : start = 1;
prove :
at tb : result = fa * fb ;
end property ;

A.2 FIR filter


library ieee ;
use ieee . std_logic_1164 . all ;
use ieee . numeric_std . all ;
entity cf_fir_33_16_16 is
port (
signal clock_c : in std_logic ;
signal reset : in unsigned (0 downto 0) ;
signal data : in unsigned (15 downto 0) ;
signal k_0 : in unsigned (15 downto 0) ;
signal k_1 : in unsigned (15 downto 0) ;
signal k_2 : in unsigned (15 downto 0) ;
signal k_3 : in unsigned (15 downto 0) ;
signal k_4 : in unsigned (15 downto 0) ;
signal k_5 : in unsigned (15 downto 0) ;
signal k_6 : in unsigned (15 downto 0) ;
signal k_7 : in unsigned (15 downto 0) ;
signal k_8 : in unsigned (15 downto 0) ;
signal k_9 : in unsigned (15 downto 0) ;

54
signal k_10 : in unsigned (15 downto 0) ;
signal k_11 : in unsigned (15 downto 0) ;
signal k_12 : in unsigned (15 downto 0) ;
signal k_13 : in unsigned (15 downto 0) ;
signal k_14 : in unsigned (15 downto 0) ;
signal k_15 : in unsigned (15 downto 0) ;
signal k_16 : in unsigned (15 downto 0) ;
signal k_17 : in unsigned (15 downto 0) ;
signal k_18 : in unsigned (15 downto 0) ;
signal k_19 : in unsigned (15 downto 0) ;
signal k_20 : in unsigned (15 downto 0) ;
signal k_21 : in unsigned (15 downto 0) ;
signal k_22 : in unsigned (15 downto 0) ;
signal k_23 : in unsigned (15 downto 0) ;
signal k_24 : in unsigned (15 downto 0) ;
signal k_25 : in unsigned (15 downto 0) ;
signal k_26 : in unsigned (15 downto 0) ;
signal k_27 : in unsigned (15 downto 0) ;
signal k_28 : in unsigned (15 downto 0) ;
signal k_29 : in unsigned (15 downto 0) ;
signal k_30 : in unsigned (15 downto 0) ;
signal k_31 : in unsigned (15 downto 0) ;
signal k_32 : in unsigned (15 downto 0) ;
signal k_33 : in unsigned (15 downto 0) ;
signal data_o : out unsigned (37 downto 0) ) ;
end entity cf_fir_33_16_16 ;

architecture rtl of cf_fir_33_16_16 is


signal reg_0 : unsigned (31 downto 0) ;
signal reg_1 : unsigned (31 downto 0) ;
signal reg_2 : unsigned (31 downto 0) ;
signal reg_3 : unsigned (31 downto 0) ;
signal reg_4 : unsigned (31 downto 0) ;
signal reg_5 : unsigned (31 downto 0) ;
signal reg_6 : unsigned (31 downto 0) ;
signal reg_7 : unsigned (31 downto 0) ;
signal reg_8 : unsigned (31 downto 0) ;
signal reg_9 : unsigned (31 downto 0) ;
signal reg_10 : unsigned (31 downto 0) ;
signal reg_11 : unsigned (31 downto 0) ;
signal reg_12 : unsigned (31 downto 0) ;
signal reg_13 : unsigned (31 downto 0) ;
signal reg_14 : unsigned (31 downto 0) ;
signal reg_15 : unsigned (31 downto 0) ;
signal reg_16 : unsigned (31 downto 0) ;
signal reg_17 : unsigned (31 downto 0) ;
signal reg_18 : unsigned (31 downto 0) ;
signal reg_19 : unsigned (31 downto 0) ;
signal reg_20 : unsigned (31 downto 0) ;
signal reg_21 : unsigned (31 downto 0) ;
signal reg_22 : unsigned (31 downto 0) ;
signal reg_23 : unsigned (31 downto 0) ;
signal reg_24 : unsigned (31 downto 0) ;
signal reg_25 : unsigned (31 downto 0) ;
signal reg_26 : unsigned (31 downto 0) ;
signal reg_27 : unsigned (31 downto 0) ;
signal reg_28 : unsigned (31 downto 0) ;
signal reg_29 : unsigned (31 downto 0) ;

55
signal reg_30 : unsigned (31 downto 0) ;
signal reg_31 : unsigned (31 downto 0) ;
signal reg_32 : unsigned (31 downto 0) ;
signal reg_33 : unsigned (31 downto 0) ;
signal data_r_delayed_1 : unsigned (15 downto 0) ;
signal data_r_delayed_2 : unsigned (15 downto 0) ;
signal data_r_delayed_3 : unsigned (15 downto 0) ;
signal data_r_delayed_4 : unsigned (15 downto 0) ;
signal data_r_delayed_5 : unsigned (15 downto 0) ;
signal data_r_delayed_6 : unsigned (15 downto 0) ;
signal data_r_delayed_7 : unsigned (15 downto 0) ;
signal data_r_delayed_8 : unsigned (15 downto 0) ;
signal data_r_delayed_9 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _10 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _11 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _12 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _13 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _14 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _15 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _16 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _17 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _18 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _19 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _20 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _21 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _22 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _23 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _24 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _25 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _26 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _27 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _28 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _29 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _30 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _15 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _32 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _33 : unsigned (15 downto 0) ;
signal da ta_r_d elayed _34 : unsigned (15 downto 0) ;
signal d at a_ o_ r_ de la ye d_ 1 : unsigned (31 downto 0) ;;
signal d at a_ o_ r_ de la ye d_ 2 : unsigned (31 downto 0) ;;
signal d at a_ o_ r_ de la ye d_ 3 : unsigned (31 downto 0) ;;
signal d at a_ o_ r_ de la ye d_ 4 : unsigned (31 downto 0) ;;
signal d at a_ o_ r_ de la ye d_ 5 : unsigned (31 downto 0) ;;
signal d at a_ o_ r_ de la ye d_ 6 : unsigned (31 downto 0) ;;
signal d at a_ o_ r_ de la ye d_ 7 : unsigned (31 downto 0) ;;
signal d at a_ o_ r_ de la ye d_ 8 : unsigned (31 downto 0) ;;
signal d at a_ o_ r_ de la ye d_ 9 : unsigned (31 downto 0) ;;
begin
reg_0 <= k_0 * data_r_delayed_1 ;
reg_1 <= k_1 * data_r_delayed_2 ;
reg_2 <= k_2 * data_r_delayed_3 ;
reg_3 <= k_3 * data_r_delayed_4 ;
reg_4 <= k_4 * data_r_delayed_5 ;
reg_5 <= k_5 * data_r_delayed_6 ;
reg_6 <= k_6 * data_r_delayed_7 ;
reg_7 <= k_7 * data_r_delayed_8 ;
reg_8 <= k_8 * data_r_delayed_9 ;
reg_9 <= k_9 * data_ r_dela yed_10 ;

56
reg_10 <= k_10 * da ta_r_d elayed _11 ;
reg_11 <= k_11 * da ta_r_d elayed _12 ;
reg_12 <= k_12 * da ta_r_d elayed _13 ;
reg_13 <= k_13 * da ta_r_d elayed _14 ;
reg_14 <= k_14 * da ta_r_d elayed _15 ;
reg_15 <= k_15 * da ta_r_d elayed _16 ;
reg_16 <= k_16 * da ta_r_d elayed _17 ;
reg_17 <= k_17 * da ta_r_d elayed _18 ;
reg_18 <= k_18 * da ta_r_d elayed _19 ;
reg_19 <= k_19 * da ta_r_d elayed _20 ;
reg_20 <= k_20 * da ta_r_d elayed _21 ;
reg_21 <= k_21 * da ta_r_d elayed _22 ;
reg_22 <= k_22 * da ta_r_d elayed _23 ;
reg_23 <= k_23 * da ta_r_d elayed _24 ;
reg_24 <= k_24 * da ta_r_d elayed _25 ;
reg_25 <= k_25 * da ta_r_d elayed _26 ;
reg_26 <= k_26 * da ta_r_d elayed _27 ;
reg_27 <= k_27 * da ta_r_d elayed _28 ;
reg_28 <= k_28 * da ta_r_d elayed _29 ;
reg_29 <= k_29 * da ta_r_d elayed _30 ;
reg_30 <= k_30 * da ta_r_d elayed _31 ;
reg_31 <= k_31 * da ta_r_d elayed _32 ;
reg_32 <= k_32 * da ta_r_d elayed _33 ;
reg_33 <= k_33 * da ta_r_d elayed _34 ;
data_o <= d at a_ o_ r_ de la ye d_ 9 ;
process ( clock_c , reset ) is
begin
if reset = 1 then
data_r_delayed_1 <= 0;
data_r_delayed_2 <= 0;
data_r_delayed_3 <= 0;
data_r_delayed_4 <= 0;
data_r_delayed_5 <= 0;
data_r_delayed_6 <= 0;
data_r_delayed_7 <= 0;
data_r_delayed_8 <= 0;
data_r_delayed_9 <= 0;
data _r_del ayed_ 10 <= 0;
data _r_del ayed_ 11 <= 0;
data _r_del ayed_ 12 <= 0;
data _r_del ayed_ 13 <= 0;
data _r_del ayed_ 14 <= 0;
data _r_del ayed_ 15 <= 0;
data _r_del ayed_ 16 <= 0;
data _r_del ayed_ 17 <= 0;
data _r_del ayed_ 18 <= 0;
data _r_del ayed_ 19 <= 0;
data _r_del ayed_ 20 <= 0;
data _r_del ayed_ 21 <= 0;
data _r_del ayed_ 22 <= 0;
data _r_del ayed_ 23 <= 0;
data _r_del ayed_ 24 <= 0;
data _r_del ayed_ 25 <= 0;
data _r_del ayed_ 26 <= 0;
data _r_del ayed_ 27 <= 0;
data _r_del ayed_ 28 <= 0;
data _r_del ayed_ 29 <= 0;
data _r_del ayed_ 30 <= 0;

57
data _r_del ayed_ 31 <= 0;
data _r_del ayed_ 32 <= 0;
data _r_del ayed_ 33 <= 0;
data _r_del ayed_ 34 <= 0;
da ta _o _r _d el ay ed _1 <= 0;
da ta _o _r _d el ay ed _2 <= 0;
da ta _o _r _d el ay ed _3 <= 0;
da ta _o _r _d el ay ed _4 <= 0;
da ta _o _r _d el ay ed _5 <= 0;
da ta _o _r _d el ay ed _6 <= 0;
da ta _o _r _d el ay ed _7 <= 0;
da ta _o _r _d el ay ed _8 <= 0;
da ta _o _r _d el ay ed _9 <= 0;
elsif rising_edge ( clock_c ) then
data_r_delayed_1 <= data ;
data_r_delayed_2 <= data_r_delayed_1 ;
data_r_delayed_3 <= data_r_delayed_2 ;
data_r_delayed_4 <= data_r_delayed_3 ;
data_r_delayed_5 <= data_r_delayed_4 ;
data_r_delayed_6 <= data_r_delayed_5 ;
data_r_delayed_7 <= data_r_delayed_6 ;
data_r_delayed_8 <= data_r_delayed_7 ;
data_r_delayed_9 <= data_r_delayed_8 ;
data _r_del ayed_ 10 <= data_r_delayed_9 ;
data _r_del ayed_ 11 <= dat a_r_de layed_ 10 ;
data _r_del ayed_ 12 <= dat a_r_de layed_ 11 ;
data _r_del ayed_ 13 <= dat a_r_de layed_ 12 ;
data _r_del ayed_ 14 <= dat a_r_de layed_ 13 ;
data _r_del ayed_ 15 <= dat a_r_de layed_ 14 ;
data _r_del ayed_ 16 <= dat a_r_de layed_ 15 ;
data _r_del ayed_ 17 <= dat a_r_de layed_ 16 ;
data _r_del ayed_ 18 <= dat a_r_de layed_ 17 ;
data _r_del ayed_ 19 <= dat a_r_de layed_ 18 ;
data _r_del ayed_ 20 <= dat a_r_de layed_ 19 ;
data _r_del ayed_ 21 <= dat a_r_de layed_ 20 ;
data _r_del ayed_ 22 <= dat a_r_de layed_ 21 ;
data _r_del ayed_ 23 <= dat a_r_de layed_ 22 ;
data _r_del ayed_ 24 <= dat a_r_de layed_ 23 ;
data _r_del ayed_ 25 <= dat a_r_de layed_ 24 ;
data _r_del ayed_ 26 <= dat a_r_de layed_ 25 ;
data _r_del ayed_ 27 <= dat a_r_de layed_ 26 ;
data _r_del ayed_ 28 <= dat a_r_de layed_ 27 ;
data _r_del ayed_ 29 <= dat a_r_de layed_ 28 ;
data _r_del ayed_ 30 <= dat a_r_de layed_ 29 ;
data _r_del ayed_ 31 <= dat a_r_de layed_ 30 ;
data _r_del ayed_ 32 <= dat a_r_de layed_ 31 ;
data _r_del ayed_ 33 <= dat a_r_de layed_ 32 ;
data _r_del ayed_ 34 <= dat a_r_de layed_ 33 ;
da ta _o _r _d el ay ed _1 <= reg_0 + reg_1 + reg_2 + reg_3
+ reg_4 + reg_5 + reg_6 + reg_7 + reg_8 + reg_9
+ reg_10 + reg_11 + reg_12 + reg_13 + reg_14 + reg_15
+ reg_16 + reg_17 + reg_18 + reg_19 + reg_20 + reg_21
+ reg_22 + reg_23 + reg_24 + reg_25 + reg_26 + reg_27
+ reg_28 + reg_29 + reg_30 + reg_31 + reg_32 + reg_33 ;
da ta _o _r _d el ay ed _2 <= d ata _o _r _d el ay ed _1 ;
da ta _o _r _d el ay ed _3 <= d ata _o _r _d el ay ed _2 ;
da ta _o _r _d el ay ed _4 <= d ata _o _r _d el ay ed _3 ;
da ta _o _r _d el ay ed _5 <= d ata _o _r _d el ay ed _4 ;

58
da ta _o _r _d el ay ed _6 <= d ata _o _r _d el ay ed _5 ;
da ta _o _r _d el ay ed _7 <= d ata _o _r _d el ay ed _6 ;
da ta _o _r _d el ay ed _8 <= d ata _o _r _d el ay ed _7 ;
da ta _o _r _d el ay ed _9 <= d ata _o _r _d el ay ed _8 ;
end if ;
end process ;
end architecture rtl ;

59
60
Appendix B
Implementation source codes
B.1 Codes used in Chapter 3
# include < simp / SimpSolver .h >
# include " utils / System . h "
namespace Minisat {}

using namespace Minisat ;

class GBhelpSolver : public SimpSolver {


public :
// Constructor : makes en empty solver
GBhelpSolver () ;

// Destructor : removed this from memory


virtual ~ GBhelpSolver () {}
void selectGBinput ( std :: vector < Clause * >& GBinput ) ;
bool GBinput_ok ( const std :: vector < Clause * >& GBinput ) ;
void computeGB ( const std :: vector < Clause * >& GBinput , std :: vector < std ::
vector < int > >& GBoutput ) ;
void selectGBoutput ( std :: vector < std :: vector < int > > GBoutput , std ::
vector < std :: vector < int > >& selectedGBoutput ) ;
void GBlearning () ;
void dec ide_ac tivate GB () ;
void de c i de _ d ea c t i va t e GB ( const std :: vector < Clause * >& GBinput , const
std :: vector < std :: vector < int > >& selectedGBoutput ) ;
void addGBlearnt () ;
void setGBparams () ;

// BGB : Constant for Boolean Groebner bases


int gbhelp ; // Options for Groebner basis learning
schemes (0= none , 1= Kuechlin , 2 = density base )
double density_limit ; // Density of Groebner bases input .
double gb_factor_inc ;
int gb_max ; // Maximum size of GB learnt clauses
bool only_confl ; // only conflict clauses are selected
from GB output
bool aggressive ; // looking for locally new binary lit
aggressively
bool LBD2 ; // collet also GB learnt clauses with
LBD = 2
int gb_factor ;
long int gb_counter ; // For Kuechlin approach
bool gb_on ; // Activate Groebner bases help
std :: vector < std :: vector < int > > gb_learnts ;

61
double total_gb_time ;
uint64_t gbs , gbadds , gbzeros , maxdepth ; // GB statistics
std :: set < int > all_levels ; // to store all decision level of a
GB_learnt clause

virtual void e x t e n d e d _ c l a u s e _ l e a r n i n g () {
GBlearning () ;
}
virtual void a d d _ c l a u s e s _ f r o m _ e x t e n d e d _ l e a r n i n g () { addGBlearnt () ; }
virtual void p r e p a r e _ e x t e n d e d _ l e a r n i n g () { setGBparams () ; }

};

# include " GBhelpSolver . h "


# include " embed . h "

// = = = = = = = = = = = = = = = = = = = = = =

static const char * _gb = " GROEBNER BASES " ;


static IntOption opt_gbhelp ( _gb , " gbhelp " , "
Controls learning by Groebner basis (0= none , 1= Kuechlin , 2 = density
base ) " , 2 , IntRange (0 ,2) ) ;
static IntOption op t_gb_f actor_ inc ( _gb , " gb_factor_inc " , "
Control GB frequency " , 2 , IntRange (1 ,1000) ) ;
static DoubleOption op t_dens ity_li mit ( _gb , " density_limit " , "
Upper bound of density of GB Input " , 1.4 , DoubleRange (1 , false ,100 ,
false ) ) ;
static IntOption opt_gb_max ( _gb , " gb_max " , " the
maxiamum size of GB learnt clauses " , 5 , IntRange (1 ,50) ) ;
static BoolOption opt_only_confl ( _gb , " only_confl " , " Collect
only conflict clauses from GB output " , false ) ;
static BoolOption opt_aggressive ( _gb , " aggressive " , " Collect
only conflict clauses from GB output " , false ) ;
// For LBD
static BoolOption opt_LBD2 ( _gb , " LBD2 " , " Collect
also clauses from GB output with LBD = 2 " , false ) ;

// = = = = = = = = = = = = = = = = = = = = = =

GBhelpSolver :: GBhelpSolver () : SimpSolver () // For Boolean Groebner


bases
, gbhelp ( opt_gbhelp )
, density_limit ( op t_dens ity_li mit )
, gb_factor_inc ( op t_gb_f actor_ inc )
, gb_max ( opt_gb_max )
, only_confl ( opt_only_confl )
, aggressive ( opt_aggressive )
, LBD2 ( opt_LBD2 )
, gb_factor (1)
, gb_counter (0)
, gb_on ( true )
, total_gb_time (0)
, gbs (0) , gbadds (0) , gbzeros (0) { }

// = = = = = = = = = = = = = = = = = = = = = =

62
void GBhelpSolver :: selectGBinput ( std :: vector < Clause * >& GBinput )
{
GBinput . clear () ;

bool select_on = false ;

if ( gbhelp == 1) {
select_on = true ;
}
if (( gb_on ) and ( gbhelp == 2) ) {
select_on = true ;
}
for ( int i = 0; i < confl_concern . size () ; i ++) {
Clause & c = *( confl_concern [ i ]) ;
// BGB select input
if ( select_on ) {
if ( gbhelp == 1) {
if ( c . size () <= 8) GBinput . push_back (
confl_concern [ i ]) ;
}
if ( gbhelp == 2) {
Clause * cl = confl_concern [ i ];
if ( c . size () <=4 ) GBinput . push_back ( cl ) ;
}
if ( GBinput . size () > 6) select_on = false ;
}
if (! select_on ) break ;
}
}

// = = = = = = = = = = = = = = = = = = = = = =

bool GBhelpSolver :: GBinput_ok ( const std :: vector < Clause * >& GBinput )
{
if ( GBinput . size () < 4) return false ;
if (( gbhelp ==1) and ( GBinput . size () > 6) ) return false ;

// if ( gb_on and ( gbhelp == 2) ) {


if ( gbhelp == 2) {
// check density of GB input
std :: set < int > input_varset ;

for ( unsigned int i = 0; i < GBinput . size () ; i ++) {


Clause & c = * GBinput [ i ];
for ( int j = 0; j < c . size () ; j ++) input_varset .
insert ( var ( c [ j ]) ) ;
}
float density ;
density = ( float ) input_varset . size () / GBinput . size () ;
if ( density > density_limit ) return false ;
}
return true ;
}

// = = = = = = = = = = = = = = = = = = = = = =

63
void GBhelpSolver :: computeGB ( const std :: vector < Clause * >& GBinput , std ::
vector < std :: vector < int > >& GBoutput )
{
// BGB : Input is ok , compute GB with command " groebner_basis " in
Polybori

BEG IN_PBO RI_EMB ED () ;


exec ( " ll = list () " ) ;
for ( unsigned int i = 0; i < GBinput . size () ; i ++) {
Clause & c = * GBinput [ i ];
std :: vector < int > cla ;
cla . clear () ;
for ( int j = 0; j < c . size () ; j ++) {
int v = 2* var ( c [ j ]) +( int ) sign ( c [ j ]) ;
cla . push_back ( v ) ;
}
Interpreter :: globals () [ " l " ] = cla ;
Interpreter :: globals () [ " max_size " ] = gb_max ;
exec ( " ll . append ( l ) " ) ;
}
exec ( " from GBhelp import * " ) ;
exec ( " res = gbLearning ( ll , max_size ) " ) ;
//
int nsize = eval ( " len ( res ) " ) ;
// int n e w _ l i t _ i n _ b i n a r y _ c o u n t e r = 0;
std :: vector < std :: vector < int > > allclauses ( nsize ) ;
for ( int idx = 0; idx < nsize ; ++ idx ) {
allclauses [ idx ] = eval ( " lambda idx : res [ idx ] " ) ( idx ) ;
}
GBoutput = allclauses ;

END_PBORI_EMBED () ;
}

// = = = = = = = = = = = = = = = = = = = = = =

void GBhelpSolver :: selectGBoutput ( std :: vector < std :: vector < int > > GBoutput
, std :: vector < std :: vector < int > >& selectedGBoutput )
{
for ( unsigned int idx = 0; idx < GBoutput . size () ; ++ idx ) {
std :: vector < int >& cl = GBoutput [ idx ];
bool good_cl = true ;
if ( good_cl ) selectedGBoutput . push_back ( cl ) ;
}
}

// = = = = = = = = = = = = = = = = = = = = = =
void GBhelpSolver :: de cide_a ctivat eGB ()
{
if ( gb_counter % gb_factor == 0) gb_on = true ;
}

void GBhelpSolver :: d ec i d e_ d e ac t i va t e GB ( const std :: vector < Clause * >&


GBinput , const std :: vector < std :: vector < int > >& selectedGBoutput )
{
if (! aggressive or ( gbs >100) ) {

64
gb_on = false ;
return ;
}
}
// = = = = = = = = = = = = = = = = = = = = = =

void GBhelpSolver :: GBlearning ()


{
if ( gbhelp ==0) return ;
if ( gbhelp ==2) gb_counter ++;
// Activate GB if in case
if (! gb_on ) de cide_a ctivat eGB () ;

if ((! gb_on ) and ( gbhelp ==2) ) return ;


// Select GB input
std :: vector < Clause * > GBinput ;
GBinput . clear () ;
double select_time = 0;
double init_select_time = cpuTime () ;
selectGBinput ( GBinput ) ;
select_time = cpuTime () - init_select_time ;

double gb_time = 0;
double init_gb_time = cpuTime () ;
// Check GB input
if (! GBinput_ok ( GBinput ) ) {
return ;
}
// count satisfied GB input for KZ
if (( gbhelp ==1) ) {
gb_counter ++;
if (! gb_on ) return ;
}
// Compute Reduced Boolean Groebner basis
std :: vector < std :: vector < int > > GBoutput ;
GBoutput . clear () ;
computeGB ( GBinput , GBoutput ) ;

// Select good clauses from GB output


std :: vector < std :: vector < int > > selectedGBoutput ;
selectedGBoutput . clear () ;
selectGBoutput ( GBoutput , selectedGBoutput ) ;

// Store selected GB learnt clauses


for ( unsigned int i = 0; i < selectedGBoutput . size () ; i ++) {
gb_learnts . push_back ( selectedGBoutput [ i ]) ;
}

// Consider to deactivate GB basis


d ec i d e_ d e a ct i v at e G B ( GBinput , selectedGBoutput ) ;

// For GB Statistics
gbs ++;
if ( selectedGBoutput . size () == 0) gbzeros ++;
else gbadds += selectedGBoutput . size () ;
gb_time = cpuTime () - init_gb_time ;
total_gb_time = total_gb_time + gb_time + select_time ;
}

65
// = = = = = = = = = = = = = = = = = = = = = =
// Add GB learnt clauses
//

void GBhelpSolver :: addGBlearnt ()


{
if ( gbhelp == 0) return ;
// For ND_GB , gb_counter is the number of conflicts in a search
// so we must reset it when solver is restarted

if ( gbhelp == 2) gb_counter = 0;

if ( gb_factor < 1 e6 ) gb_factor = ( int ) gb_factor * gb_factor_inc ;

for ( unsigned int i = 0; i < gb_learnts . size () ; i ++) {


vec < Lit > lits ;
lits . clear () ;
for ( unsigned int j = 0; j < gb_learnts [ i ]. size () ; j ++) {
int k = gb_learnts [ i ][ j ];
Lit lit = toLit ( k ) ;
lits . push ( lit ) ;
}
addClause ( lits ) ;
}
gb_learnts . clear () ;
}

// = = = = = = = = = = = = = = = = = = = = = =

void GBhelpSolver :: setGBparams ()


{
if ( gbhelp ==0) return ;
// Set parameters for KZ
if ( gbhelp == 1) {
gb_factor = 1;
gb_factor_inc = 2;
gb_max = 2;
only_confl = false ;
aggressive = false ;
LBD2 = false ;
}
}

from polybori . cnf import *


from polybori . blocks import declare_ring , Block
from polybori . gbcore import groebner_basis
from polybori . memusage import *
# from polybori . PyPolyBoRi import *
def list_var_index ( poly ) :
l = list ( poly . vars_as_monomial () . variables () )
res = list ()
for var in l :
res . append ( var . index () )
return res

def tolits ( poly , var_map ) :


# convert polynomial clauses to CNF

66
lv = list_var_index ( poly )
lits = list ()
polyset = poly . set ()
for i in lv :
if polyset . subset0 ( i ) . empty () :
lits . append (2* var_map [ i ])
else :
lits . append (2* var_map [ i ]+1)
return lits

def gbLearning ( ll , max_size =2) :


"""
Compute the groebner basis of corr . Polynomials
of clauses in ll and collect all new binary clauses
"""
ll . sort ( key = len )
var_map = list ()
ideal = list ()
for l in ll :
for lit in l :
var = lit >> 1
if var not in var_map :
var_map . append ( var )
ring = declare_ring ([ Block ( " x " , len ( var_map ) ) ])
enc = CNFEncoder ( ring )
for l in ll :
poly = ring . one ()
for lit in l :
ind = var_map . index ( lit >> 1)
if lit &1 :
poly = poly *( ring . variable ( ind ) +1)
else :
poly = poly * ring . variable ( ind )
ideal . append ( poly )
gb = groebner_basis ( ideal , o t h e r _ o r d e r i n g _ f i r s t = False )

res = list ()
for poly in gb :
if ( poly . n_variables () <= max_size ) and ( poly not in
ideal ) :
polys = enc . po ly no mi al _c la us es ( poly )
for p in polys :
lits = tolits (p , var_map )
res . append ( lits )
return res

B.2 Codes used in Chapter 4


# Optimize Buchberger Moeller Algorithm
# for Boolean polynomial and lex ordering
# ------------------------
# -* - coding : utf -8 -* -
# Author : Hung
# Run in Sage , a free a mathematics software
# ------------------------

import resource

67
import sys
import signal

from sage . all import *


from polybori . gbrefs import load_file
from time import *
from polybori . cnf import *
from polybori . gbcore import groebner_basis
from polybori . interpolate import *
# For use process
from subprocess import Popen , PIPE
from polybori import Polynomial , Variable
from Pla2Boole import *
# -------------------------------------
import random
# from polybori . blocks import declare_ring
from polybori . blocks import Block , declare_ring
from polybori . specialsets import m o n o m i a l _ f r o m _ i n d i c e s

# ----------------------------
def time_expired (n , stack ) :
print ’ EXPIRED : ’ , ctime ()

def e n c o d e _ p o i n t s _ a s _ c o m p _ l i s t ( P ) :
n = len ( P [0])
m = len ( P )
Q = [[ int ( P [ i ][ j ]) for i in xrange ( m ) ] for j in xrange ( n ) ]
return Q

def update_irre ( irre ,L ,u , pointer ) :


j = pointer
while j < len ( L ) :
us = set ( u )
if us . issubset ( L [ j ]) :
irre . add ( j )
j +=1
return irre

def list2bset (l , one , zero ) :


new = one
for i in xrange ( len ( l ) ) :
new = new . change ( l [ i ])
return new

def updateB (B , mono , one , zero ) :


new = list2bset ( mono , one , zero )
B . append ( new )
return

def updateB2 (B , mono , one , zero ) :


B . append ( mono )
return

def updateG (G ,B , mono , one , zero , N_last_row ,m , nrows ) :


N2 = N_last_row [ m : m + nrows ]
f = list2bset ( mono , one , zero )
for j in reversed ( N2 . n onzer o_posi tions () ) :
f = f . union ( B [ j ])

68
G . append ( Polynomial ( f ) )
return G

def updateG2 (G ,B , mono , one , zero , N_last_row ,m , nrows ) :


N2 = N_last_row [ m : m + nrows ]
f = list ()
f . append ( mono )
for j in reversed ( N2 . n onzer o_posi tions () ) :
f . append ( B [ j ])
G . append ( f )
return G

# ------------------------------
def BM ( P ) :
m = len ( P )
G =[]
if len ( P ) ==0:
G = [1]
else :
nvars = len ( P [0])
ring = declare_ring ([ Block ( " x " , nvars ) ])
zero = ring . zero () . set ()
one = ring . one () . set ()
global x
x = ring . variable

Q= encode_points_as_comp_list (P)
del P

L =[ list () ]
addL =[]
irre = set ()
B =[ one ]
ptr = 0
current_var_idx = nvars -1
# Matrix initialize
x_ks = matrix ( GF (2) ,Q [ current_var_idx ])
I = matrix . identity ( GF (2) ,m )
row =[1 for i in xrange ( m ) ]
M = matrix ( GF (2) , row )
M_for_rank = M . augment ( I [0:1 ,:])

ext = True
nrows =1
while current_var_idx != -1:
if ptr not in irre :
base_mono = list ( L [ ptr ])
current_mono = base_mono +[ current_var_idx ]

M_row = M [ ptr : ptr +1 ,:]


new_row = x_ks . e le m e nt w i se _ p ro d u ct ( M_row )
v = matrix ( GF (2) , new_row )

if nrows < m :
n_i = I [ nrows : nrows +1 ,:]
v_ex = v . augment ( n_i )
else :
if ext :

69
n_i = matrix ( GF (2) ,1 , m )
ext = False
v_ex = v . augment ( n_i )
N = M_for_rank . stack ( v_ex )
N . echelonize ()
N_last_row = N [ -1]
N1 = N_last_row [: m ]
if N1 . is_zero () :
irre = update_irre ( irre ,L , base_mono , ptr )
G = updateG2 (G ,B , current_mono , one , zero , N_last_row ,m , nrows )
else :
nrows +=1
M = M . stack ( v )
M_for_rank = N
addL . append ( current_mono )
updateB2 (B , current_mono , one , zero )
ptr +=1
if ptr >= len ( L ) :
L = L + addL
current_var_idx -=1
x_ks = matrix ( GF (2) ,Q [ current_var_idx ])
ptr =0
addL =[]
irre = set ()
return G
# ---------------------------------------
def lex_gb_noes ( Sols , nvars , r ) :
offset = 0
S = bset_ from_s trings (r , Sols , offset )
var_as_mono = Monomial ( r )
for i in xrange ( offset , r . n_variables () ) :
var_as_mono *= r . variable ( i )
res = None
res = l e x _ g r o e b n e r _ b a s i s _ p o i n t s (S , var_as_mono )
return res
# --------------------------------------

def random_example ( nvars , npoints ) :


def get () :
line = ’ ’
for idx in xrange ( nvars ) :
line += random . choice ( ’ 01 ’)
return line
return [ get () for elt in xrange ( npoints ) ]

# ---------------------------------------
def main () :
resource . setrlimit ( resource . RLIMIT_CPU , (36000 ,36001) )
signal . signal ( signal . SIGXCPU , time_expired )
print ’ Starting : ’ , ctime ()
npoints = 1000
# nvars =100
print " npoints = " , npoints
# print " nvars = " , nvars
print " nvars Brickenstein BM "
# print " npoints Brickenstein BM "
nV =[10 ,20 ,50 ,100 ,200 ,500 ,1000]
nV =[10000]

70
# nP =[100 ,200 ,500 ,1000 ,2000 ,5000 ,10000]

for n in nV :
nvars = n
# npoints = n
P = random_example ( nvars , npoints )

# print "****** By Brickenstein ********"


# t = time ()
# import polybori
# r = polybori . Ring ( nvars )
# sys . setre cursio nlimit (10000)
# G1 = lex_gb_noes (P , nvars , r )
# t1 = time () -t

# print "****** By Buchberger_M ********"


t = time ()
G2 = BM ( P )
t2 = time () -t
print nvars , " " , round ( t2 ,1)
# print npoints , nvars ," " , round ( t1 ,1) ," " , round ( t2 ,1)
return

if __name__ == " __main__ " :


main ()

# -* - coding : utf -8 -* -
# Author : Hung
# ------------------------
# Find relation between states and next states
# using all - solution SAT and interpolation
# ------------------------

import resource
import sys
import signal

from polybori . gbrefs import load_file


from time import *
from polybori . cnf import *
from polybori . gbcore import groebner_basis
from polybori . interpolate import *
# For use process
from subprocess import Popen , PIPE
from polybori import Polynomial , Variable
from Pla2Boole import *
# -------------------------------------

# ################################
# Load test - files
# ################################
def get_data ( number , k ) :
data = load_file ( ’/ u / n / nguyen / polybori - work / sa t_inte rpolat ion /
test_file / S ’+ str ( number ) + ’. py ’)
if k > len ( data . initial_states ) :
raise ValueError , " k must less than or equal to the number of
states "

71
data . ideal = data . ideal + data . initial_states [: k ]
return data
# nvars = 2* data . num_states + data . num_signals

# ################################
# Convert ideal to CNF
# ################################
def toCNF ( ideal ) :
enc = CNFEncoder ( ideal [0]. ring () )
res = enc . dimacs_cnf ( ideal )
res += ’\ n ’
return res

# ################################
# Extract solution info from
# Avi_all_sat output
# ################################
def get_redPLA ( avi_output ) :
res = list ()
counter = 0
for line in avi_output . split ( ’\ n ’) :
if line . startswith ( ’0 ’) or line . startswith ( ’1 ’) :
res . append ( line )
counter +=1
# print ’ number of SAT solutions = ’, counter
return res

# ################################
# Solve all - solution SAT problem
# ################################
def Avi_all_sat ( CNFs , nImportant_vars ) :
# length of a batch
M = str (100)
N = str ( nImportant_vars )
process = Popen ([ " batch_all_sat " ," -" ,N , M ] , bufsize = 4096 , stdin =
PIPE , stdout = PIPE )
all_sat_output = process . communicate ( CNFs ) [0]
res = get_redPLA ( all_sat_output )
return res

# ################################
# Interpolation
# ################################
def lex_gb_noes ( Sols , nvars , r ) :
offset = r . n_variables () - nvars
S = bset_ from_s trings (r , Sols , offset )
var_as_mono = Monomial ( r )
for i in xrange ( offset , r . n_variables () ) :
var_as_mono *= r . variable ( i )
res = None
res = l e x _ g r o e b n e r _ b a s i s _ p o i n t s (S , var_as_mono )
return res

# ################################
# Compute Groebner basis of
# elimination ideal
# by all - solution SAT

72
# and interpolation
# ################################
def SATElim ( data ) :
t = time ()
ideal = data . ideal
ring = data . ring
N = 2* data . num_states
CNFs = toCNF ( ideal )
Sols = Avi_all_sat ( CNFs , N )
gb = lex_gb_noes ( Sols ,N , ring )
return gb

# ################################
# Compute Groebner basis
# ################################
def GBElim ( data ) :
ideal = data . ideal
ring = data . ring

ring2 = ring . clone ( ordering = block_dp_asc , blocks =[ data .


num_signals ])
ideal2 = [ ring2 ( p ) for p in ideal ]

gb = groebner_basis ( ideal2 )
res = [ poly for poly in gb if poly . navigation () . value () >= data .
num_signals ]
return res

# ################################
# Test all benchmarks
# ################################

def time_expired (n , stack ) :


print ’ EXPIRED : ’ , ctime ()

def main () :
d ={27:3 , 208:8 , 298:14 , 344:15 , 349:15 , 382:21 , 386:6 , 420:16 , 444:21 ,
510:6 , 526:21 , 641:19 , 713:19 , 820:5 , 832:5 , 838:32 , 953:29 ,
1196:18 , 1238:18 , 1423:74 , 1488:6 , 1494:6}
resource . setrlimit ( resource . RLIMIT_CPU , (36000 ,36001) )
signal . signal ( signal . SIGXCPU , time_expired )
print ’ Starting : ’ , ctime ()

# Parse input
method = sys . argv [1]
num = int ( sys . argv [2])
inum = 0

print " "


print " S " + str ( num )
if method == " g " :
print " GB "
elif method == " s " :
print " SAT "

t = time ()
# Get data
data = get_data ( num , inum )

73
if method == " g " :
gb = GBElim ( data )
elif method == " s " :
gb = SATElim ( data )
# Resource statistics
GBtime = time () -t
GBmem = resource . getrusage ( resource . RUSAGE_SELF ) . ru_maxrss / 1000

# Output to screen
print " time = " , GBtime
print " mem = " , GBmem , " M "
print ’ End : ’ , ctime ()
exit ()
return

if __name__ == " __main__ " :


main ()

B.3 Codes used in Chapter 5


# !/ bin / bash
# ================================================
# Check global property of an abstract multiplier
# design using computer algebra techniques
# ================================================
filename = " multiplier . txt "

python << END


# --------------------------------------------
bw = $1
fn = " $filename "
# --------------------------------------------
# Help methods
# --------------------------------------------

# indexing
def E (* args ) :
res = args [0]
for i in xrange (1 , len ( args ) ) :
res = res + " _ " + str ( args [ i ])
return res

def mk_vars ( name , bw ) :


return [ E ( name , i ) for i in reversed ( xrange ( bw +1) ) ]

# Expand b to bit variables


def expand (b , bw ) :
res = b
for i in xrange ( bw ) :
res = res + " -" + str (2** i ) + " * " + E (b ,0 , i )
return res

# make new ring


def mk_ring ( bw , all_vars , ordering , name ) :
line = " ring " + name + " = ( integer ,2 , " + str ( bw ) + " ) ,( "
for var in all_vars :
line += var + " ,"

74
line = line [: -1]+ " ) ," + ordering
lines . append ( line )

# set options
def set_options (* args ) :
for i in xrange ( len ( args ) ) :
line = " option ( " + args [ i ]+ " ) "
lines . append ( line )

# define an ideal
def mk_ideal ( poly_list , start_index , name ) :
res = " ideal " + name + " = ( "
for poly in poly_list :
p = " poly p " + str ( start_index ) + " = " + poly
lines . append ( p )
res = res + " p " + str ( start_index ) + " ,"
start_index +=1
res = res [: -1] + " ) "
lines . append ( res )
return start_index

# generate all step ideal


def mk_step_ideals ( polys_block ) :
start_index =0
for i in xrange ( len ( polys_block ) ) :
name = " ide " + str ( i )
start_index = mk_ideal ( polys_block [ i ] , start_index , name )

# Make global ideal


def mk_global_ideal ( polys_block ) :
name = " ide "
all_polys =[]
for polys in polys_block :
all_polys += polys
mk_ideal ( all_polys ,0 , name )

# reduce ideal at step k +1 w . r . t ideal at step k for k = 0.. bw


def s uccess ive_re duce ( bw ) :
for i in xrange ( bw ) :
line = " ide " + str ( i +1) + " = reduce ( ide " + str ( i +1) + " , ide " + str ( i ) + " ) "
lines . append ( line )

# check the proofgoal


def check_proofgoal ( bw ) :
lines . append ( " poly proofgoal = 0 " )
lines . append ( " poly pready = 0 " )
lines . append ( " ideal ideready = 0 " )
for i in xrange ( bw ) :
p1 = " proofgoal = " + E ( " r " ,i +1) + " - a * b "
lines . append ( p1 )
p2 = " pready = " + E ( " b " ,i +1)
lines . append ( p2 )
p3 = " ideready = ide + pready "
lines . append ( p3 )
p5 = " reduce ( proofgoal , ideready ) "
lines . append ( p5 )
lines . append ( " quit " )

75
# write to a text file
def write2file ( lines ) :
new = open ( fn , " w " )
for line in lines :
new . write ( line )
new . write ( " ;\ n " )
new . close ()
# ---------------------------------------
# ring data
# ---------------------------------------
r_vars = mk_vars ( " r " , bw )
ready_vars = mk_vars ( " ready " , bw )
a_vars = mk_vars ( " a " , bw )
b_vars = mk_vars ( " b " , bw )
bz_vars = mk_vars ( " bz " , bw )
# all_vars = r_vars + ready_vars + a_vars + [" a " ," b "] + bz_vars + b_vars
all_vars = r_vars + ready_vars + a_vars + [ " a " ] + bz_vars + b_vars +[ " b " ]
ordering = " lp "

# ---------------------------------------
# Poly data
# ---------------------------------------
polys_block =[]
polys =[]
polys . append ( " r_0 - 0 " )
polys . append ( " a_0 - a " )
polys . append ( " b_0 - b " )
polys_block . append ( polys )

for i in xrange ( bw ) :
polys =[]
# Equation for r
poly1 = E ( " r " ,i +1) + E ( " -r " ,i ) + E ( " -a " ,i ) + E ( " * bz " ,i )
polys . append ( poly1 )
# Equation for a
poly2 = E ( " a " ,i +1) + E ( " -2* a " ,i )
polys . append ( poly2 )
# Equations model operator shift b left .
poly3 = E ( " 2* b " ,i +1) + E ( " -b " ,i ) + E ( " + bz " ,i )
polys . append ( poly3 )
polys_block . append ( polys )

# --------------------------------------
# Main
# --------------------------------------
lines =[]

mk_ring ( bw , all_vars , ordering , " r " )


set_options ( " notWarnSB " )
mk_global_ideal ( polys_block )
check_proofgoal ( bw )

write2file ( lines )
# --------------------------------------
END

time Singular $filename

76
# !/ bin / bash
# ================================================
# Verify the global property of an filter
# using computer algebra techniques
# ================================================
filename = " filter2 . txt "

textfile = $1

python << END


# --------------------------------------------
fn = " $filename "
nc =42 # number of cycles
# --------------------------------------------
# Help methods
# --------------------------------------------

# indexing
def E (* args ) :
res = args [0]
for i in xrange (1 , len ( args ) ) :
res = res + " _ " + str ( args [ i ])
return res

# generate a list of variables name_0 ,... , name_n


def mk_vars ( name , n ) :
return [ E ( name , i ) for i in reversed ( xrange ( n +1) ) ]

# Expand b to bit variables


def expand (b , bw ) :
res = b
for i in xrange ( bw ) :
res = res + " -" + str (2** i ) + " * " + E (b ,0 , i )
return res

# remove whitespace from a formula


def clean ( s ) :
res = " "
for i in xrange ( len ( s ) ) :
if s [ i ]!= " " :
res += s [ i ]
return res

def add_index (v ,k , res ) :


if v . isdigit () :
res += v
else :
res += E (v , k )
return res

def resolve_bitvar ( s ) :
res = s
if s . find ( " [ " ) == -1:
return res
res = res . replace ( " [ " ," _ " )
res = res . replace ( " ] " ," " )
return res

77
def one_side_eq ( s ) :
res = s
res = res . replace ( " + " ," ++ " )
res = res . replace ( " -" ," + " )
res = res . replace ( " ++ " ," -" )
res = res . replace ( " = " ," -" )
return res

def p arse_s hift_r ight (s ,k , bw ) :


res =[]
ss = s . split ( " >>" )
var = ss [0]
ks = int ( ss [1])
for i in xrange ( bw - ks ) :
l = E ( var , k +1 , i ) + " -" + E ( var ,k , i + ks )
res . append ( l )
for i in xrange ( bw - ks , bw ) :
l = E ( var , k +1 , i )
res . append ( l )
return res

def parse_eq (s , k ) :
s = clean ( s )
s = s . replace ( " <= " ," = " )
s = resolve_bitvar ( s )
if s . find ( " == " ) >=0:
s = s . replace ( " == " ," = " )
instant = True
else :
instant = False
eq_index = s . find ( " = " )
res = " "
v=""
i =0
while i < len ( s ) :
if s [ i ] not in [ " = " ," * " ," + " ," -" ]:
v += s [ i ]
if i == ( len ( s ) -1) :
if instant :
res = add_index (v , k +1 , res )
else :
res = add_index (v ,k , res )
else :
if (i <= eq_index ) or instant :
res = add_index (v , k +1 , res )
else :
res = add_index (v ,k , res )
res += s [ i ]
v=""
i +=1
res = one_side_eq ( res )
return res

def parse ( textfile , ival ) :


file = open ( textfile , " r " )
eqs = file . read ()
file . close ()
res =[]

78
for i in xrange ( ival ) :
res . append ([])
for s in eqs . split ( " \ n " ) :
s = s . replace ( " ; " ," " )
if s . find ( " = " ) >=0:
for i in xrange ( ival ) :
tmp = parse_eq (s , i )
res [ i ]. append ( tmp )
elif s . find ( " >>" ) >=0:
for i in xrange ( ival ) :
tmp = p arse_s hift_r ight (s ,i , bw )
res [ i ]+= tmp
return res

# ---------------------------------------------

# make new ring


def mk_ring ( bw , all_vars , ordering , name ) :
line = " ring " + name + " = ( integer ,2 , " + str ( bw ) + " ) ,( "
for var in all_vars :
line += var + " ,"
line = line [: -1]+ " ) ," + ordering
lines . append ( line )

# set options
def set_options (* args ) :
for i in xrange ( len ( args ) ) :
line = " option ( " + args [ i ]+ " ) "
lines . append ( line )

# define an ideal
def mk_ideal ( poly_list , start_index , name ) :
res = " ideal " + name + " = ( "
for poly in poly_list :
p = " poly p " + str ( start_index ) + " = " + poly
lines . append ( p )
res = res + " p " + str ( start_index ) + " ,"
start_index +=1
res = res [: -1] + " ) "
lines . append ( res )
return start_index

def mk_global_ideal ( polys_block ) :


name = " ide "
all_polys =[]
for polys in polys_block :
all_polys += polys
mk_ideal ( all_polys ,0 , name )

# check the proofgoal


def check_proofgoal () :
lines . append ( " poly proofgoal = data_o_42 - ( data_i_34 * k0_i_35 +
data_i_33 * k1_i_35 + data_i_32 * k2_i_35 + data_i_31 * k3_i_35 +
data_i_30 * k4_i_35 + data_i_29 * k5_i_35 + data_i_28 * k6_i_35 +
data_i_27 * k7_i_35 + data_i_26 * k8_i_35 + data_i_25 * k9_i_35 +
data_i_24 * k10_i_35 + data_i_23 * k11_i_35 + data_i_22 * k12_i_35 +
data_i_21 * k13_i_35 + data_i_20 * k14_i_35 + data_i_19 * k15_i_35 +

79
data_i_18 * k16_i_35 + data_i_17 * k17_i_35 + data_i_16 * k18_i_35 +
data_i_15 * k19_i_35 + data_i_14 * k20_i_35 + data_i_13 * k21_i_35 +
data_i_12 * k22_i_35 + data_i_11 * k23_i_35 + data_i_10 * k24_i_35 +
data_i_9 * k25_i_35 + data_i_8 * k26_i_35 + data_i_7 * k27_i_35 +
data_i_6 * k28_i_35 + data_i_5 * k29_i_35 + data_i_4 * k30_i_35 +
data_i_3 * k31_i_35 + data_i_2 * k32_i_35 + data_i_1 * k33_i_35 ) " )
lines . append ( " reduce ( proofgoal , ide ) " )
lines . append ( " quit " )

# write to a text file


def write2file ( lines ) :
new = open ( fn , " w " )
for line in lines :
new . write ( line )
new . write ( " ;\ n " )
new . close ()
# ----------------------------------------
# Generate list of variables
data_o_vars = mk_vars ( " data_o " , nc )

d a t a _ o _ r _ d e l a y e d _ v a r s =[]
for i in reversed ( xrange (7) ) :
d a t a _ o _ r _ d e l a y e d _ v a r s += mk_vars ( " dat a_o_r_ delaye d_ " + str ( i +1) , nc )

reg_vars =[]
for i in reversed ( xrange (34) ) :
reg_vars += mk_vars ( " reg " + str ( i ) , nc )

d a t a _ i _ r _ d e l a y e d _ v a r s =[]
for i in reversed ( xrange (34) ) :
d a t a _ i _ r _ d e l a y e d _ v a r s += mk_vars ( " dat a_i_r_ delaye d_ " + str ( i +1) , nc )

data_i_vars = mk_vars ( " data_i " , nc )

k_vars =[]
for i in reversed ( xrange (34) ) :
k_vars += mk_vars ( " k " + str ( i ) + " _i " , nc )
# variable ordering and monomial ordering
all_vars = data_o_vars + d a t a _ o _ r _ d e l a y e d _ v a r s + reg_vars +
d a t a _ i _ r _ d e l a y e d _ v a r s + data_i_vars + k_vars
ordering = " lp "
# Poly data
polys_block = parse ( " $textfile " , nc )
# Main
lines =[]
mk_ring (38 , all_vars , ordering , " r " )
set_options ( " notWarnSB " )
mk_global_ideal ( polys_block )
check_proofgoal ()
# write to file
write2file ( lines )
# -------------------------------------------------------------
END

time Singular $filename

80
Bibliography
[ABKR00] J. Abbott, A. Bigatti, M. Kreuzer, and L. Robbiano. Computing ideals of points.
Journal of Symbolic Computation, 30(4):341–356, 2000.

[AS09] Gilles Audemard and Laurent Simon. Predicting learnt clauses quality in modern
sat solvers. In Proceedings of the 21st international jont conference on Artifical
intelligence, IJCAI’09, pages 399–404, San Francisco, CA, USA, 2009. Morgan
Kaufmann Publishers Inc.

[BD09] Michael Brickenstein and Alexander Dreyer. PolyBoRi: A framework for


Gröbner-basis computations with Boolean polynomials. Journal of Symbolic
Computation, 44(9):1326–1345, 2009. Effective Methods in Algebraic Geometry.

[BD13] Michael Brickenstein and Alexander Dreyer. Gröbner-free normal forms for
boolean polynomials. Journal of Symbolic Computation, 48(0):37–53, 2013.

[BDG+ 09] Michael Brickenstein, Alexander Dreyer, Gert-Martin Greuel, Markus Wedler,
and Oliver Wienand. New developments in the theory of gröbner bases and appli-
cations to formal verification. Journal of Pure and Applied Algebra, 213(8):1612–
1635, 2009. Theoretical Effectivity and Practical Effectivity of Gröbner Bases.

[BHvMW09] A. Biere, M. Heule, H. van Maaren, and T. Walsh. Handbook of Satisfiability:


Volume 185 Frontiers in Artificial Intelligence and Applications. IOS Press,
Amsterdam, The Netherlands, The Netherlands, 2009.

[BMS00] Luı́s Baptista and João Marques-Silva. Using randomization and learning to
solve hard real-world instances of satisfiability, 2000.

[Bri10] Michael Brickenstein. Boolean Gröbner bases – Theory, Algorithms and Appli-
cations. PhD thesis, University of Kaiserslautern, Germany, 2010.

[Buc85] B. Buchberger. Gröbner bases: an algorithmic method in polynomial ideal the-


ory. In N. K. Bose, editor, Multidimensional Systems Theory, pages 184–232. D.
Reidel Publishing Company, 1985.

[CEI96] M. Clegg, J. Edmonds, and R. Impagliazzo. Using the Gröbner basis algorithm
to find proofs of unsatisfiability. Proceedings of the Twenty-eighth Annual ACM
S ymposium on the Theory of Computing, pages 174–183, 1996.

[CK07] Christopher Condrat and Priyank Kalla. A Gröbner basis approach to CNF-
formulae preprocessing. In Tools and Algorithms for the Construction and Anal-
ysis of Systems, volume 4424 of Lecture Notes in Computer Science, pages 618–
631. Springer, 2007.

81
[DGPS12] Wolfram Decker, Gert-Martin Greuel, Gerhard Pfister, and Hans Schönemann.
Singular 3-1-6 — A computer algebra system for polynomial computations.
http://www.singular.uni-kl.de, 2012.

[DLL62] Martin Davis, George Logemann, and Donald Loveland. A machine program for
theorem-proving. Commun. ACM, 5(7):394–397, July 1962.

[DP60] Martin Davis and Hilary Putnam. A computing procedure for quantification
theory. J. ACM, 7(3):201–215, July 1960.

[EB05] Niklas Eén and Armin Biere. Effective preprocessing in SAT through variable
and clause elimination. In Proceedings of the 8th international conference on
Theory and Applications of Satisfiability Testing, SAT’05, pages 61–75, Berlin,
Heidelberg, 2005. Springer-Verlag.

[ES04] Niklas Eén and Niklas Sörensson. An extensible SAT-solver. In Theory and
Applications of Satisfiability Testing, volume 2919 of Lecture Notes in Computer
Science, pages 333–336. Springer Berlin / Heidelberg, 2004.

[GP02] G.-M. Greuel and G. Pfister. A SINGULAR Introduction to Commutative Al-


gebra. Springer Verlag, 2002.

[GP07] Gert-Martin Greuel and Gerhard Pfister. A Singular Introduction to Commuta-


tive Algebra. Springer Publishing Company, Incorporated, 2nd edition, 2007.

[GSK98] Carla P. Gomes, Bart Selman, and Henry Kautz. Boosting combinatorial search
through randomization. In Proceedings of the 15th national conference on Artifi-
cial intelligence, pages 431–437. American Association for Artificial Intelligence,
1998.

[GSY04] Orna Grumberg, Assaf Schuster, and Avi Yadgar. Memory efficient all-solutions
sat solver and its application for reachability analysis. In In Proceedings of
the 5th International Conference on Formal Methods in Computer-Aided Design
(FMCAD, pages 275–289. Springer, 2004.

[JS06] Winfried Just and Brandilyn Stigler. Computing gröbner bases of ideals of few
points in high dimensions. ACM Commun. Comput. Algebra, 40(3-4):67–78,
September 2006.

[LS04] Reinhard Laubenbacher and Brandilyn Stigler. A computational algebra ap-


proach to the reverse engineering of gene regulatory networks. Journal of The-
oretical Biology, 229(4):523–537, 2004.

[Lun08] Samuel Lundqvist. Mathematical methods in computer science. chapter Com-


plexity of Comparing Monomials and Two Improvements of the Buchberger-
Möller Algorithm, pages 105–125. Springer-Verlag, Berlin, Heidelberg, 2008.

[MB82] H. Michael Möller and Bruno Buchberger. The construction of multivariate


polynomials with preassigned zeros. In Proceedings of the European Computer
Algebra Conference on Computer Algebra, EUROCAM ’82, pages 24–31, Lon-
don, UK, UK, 1982. Springer-Verlag.

82
[MSSSS96] Joao P. Marques-Silva, Joo P. Marques Silva, Karem A. Sakallah, and Karem A.
Sakallah. Grasp - a new search algorithm for satisfiability. In in Proceedings of
the International Conference on Computer-Aided Design, pages 220–227, 1996.

[One] Onespin Solutions GmbH, Germany onespin 360mv. www.onespin-solutions.


com.

[PWS+ 11] E. Pavlenko, M. Wedler, D. Stoffel, W. Kunz, A. Dreyer, F. Seelisch, and


G. Greuel. Stable: A new qf-bv smt solver for hard verification problems com-
bining boolean reasoning with computer algebra. In Design, Automation Test
in Europe Conference Exhibition (DATE), 2011, pages 1–6, March 2011.

[RD06] G. Van Rossum and Fred L. Drake. The Python Language Reference Manual.
Network Theory Ltd., Bristol, United Kingdom, November 2006.

[SNC09] Mate Soos, Karsten Nohl, and Claude Castelluccia. Extending sat solvers to
cryptographic problems. In Proceedings of the 12th International Conference
on Theory and Applications of Satisfiability Testing, SAT ’09, pages 244–257,
Berlin, Heidelberg, 2009. Springer-Verlag.

[zGG03] Joachim von zur Gathen and Jürgen Gerhard. Modern Computer Algebra. Cam-
bridge University Press, second edition, 2003.

[ZK10] Christoph Zengler and Wolfgang Küchlin. Extending clause learning of SAT
solvers with Boolean Gröbner bases. In Proceedings of the 12th international
conference on Computer algebra in scientific computing, CASC’10, pages 293–
302, Berlin, Heidelberg, 2010. Springer-Verlag.

83
Wissenschaftlicher Werdegang
1990 – 2002 Besuch der Schule in Vinh Long, Vietnam.

2002 Abschluss an der Pham Hung High School, Vinh Long, Vietnam.

2006 Bachelorabschluss am Fachbereich Mathematik an der Can Tho Universität, Can


Tho, Vietnam.
Bachelorarbeit: Solving linear programming problem by affine scaling method
Supervisor: M.sc. Ho Huu Hoa

2010 Masterabschluss am Fachbereich Mathematik an der TU Kaiserslautern.


Masterarbeit: Modular Algorithms for Computing a Generating Set of the
Syzygy Module
Supervisor: Prof. Dr. Gerhard Pfister

seit 04/2012 Promotionstudent am Fachbereich Mathematik an der TU Kaiserslautern.


Dissertation: Combinations of Boolean Gröbner Bases and SAT Solvers
Supervisor: Prof. Dr. Gerhard Pfister

Curriculum Vitae
1990 – 2002 Elementary, secondary, and high school in Vinh Long, Vietnam.

2002 Graduation from Pham Hung High School, Vinh Long, Vietnam.

2006 Bachelor’s degree in mathematics from Can Tho University, Vietnam.


Thesis: Solving linear programming problem by affine scaling method
Supervisor: M. sc. Ho Huu Hoa

2010 Master’s degree in mathematics from TU Kaiserslautern


Thesis: Modular Algorithms for Computing a Generating Set of the Syzygy Mod-
ule
Supervisor: Prof. Dr. Gerhard Pfister

from 04/2012 Ph.D studies in mathematics at TU Kaiserslautern.


Dissertation: Combinations of Boolean Gröbner Bases and SAT Solvers
Supervisor: Prof. Dr. Gerhard Pfister
Declaration

I hereby declare that this thesis is my own work and effort, and that no other sources than those
listed have been used.
The third chapter of this thesis has been publisched in the Proceeding of 2nd Young Researcher
Symposium 2013 by Fraunhofer Verlag, ISBN 978-3-8396-0628-5.
I am not in a second examination process right now.

Kaiserslautern, October 2014

Thanh Hung Nguyen

You might also like