1 of 194

Introduction to SAT

Alexander Nadel

Technion, Data and Decision Sciences & Intel, Israel

Indian SAT+SMT School, 2024

August 18, 2024

Pune, Maharashtra, India

1

8/6/2024

PEG PDS DDI

2 of 194

Introduction

SAT: determine if a Boolean formula in Conjunctive Normal Form (CNF) is satisfiable

The original NP-Complete problem

    • The famous Cook-Levin theorem (early 70s)

SAT has exponential complexity unless P = NP

P = NP (SAT): frequently called the most important outstanding question in CS

    • If it is easy to check that a solution to a problem is correct, is it also easy to solve the problem?
    • One of the 7 Clay Millennium Prize Problems – worth $1,000,000

2

8/6/2024

F = (a ∨ b) ∧ (¬a ∨ ¬b ∨ c)

clause #1

clause #2

Literals

PEG PDS DDI

3 of 194

Introduction

SAT is an unresolved mystery!

Yet, SAT solvers are scalable widely used tools

Main goals for today:

    • Explain how modern SAT solvers work
    • Convey intuition why they work in practice
    • Provide examples of applying SAT

3

8/6/2024

PEG PDS DDI

4 of 194

SAT Applications

4

8/6/2024

PEG PDS DDI

5 of 194

SAT Application Examples

5

8/6/2024

Optimization with

SAT@

PEG PDS DDI

6 of 194

SAT Resources

6

8/6/2024

PEG PDS DDI

7 of 194

Why am I Interested in SAT?

2002: stumbled upon SAT and completed my Master thesis about it (Hebrew University)

    • Jerusat – won the Industrial, SAT category at SAT Competition 2004

2003: joined Intel

    • Been developing & internally deploying SAT and SAT-based solvers (SMT, Model Checkers) ever since
    • Till 2014: working on SAT-based validation as the rest of the semiconductor industry
    • Since 2014: optimization (place & route, scheduling), test generation, physical design, lithography, …

2009: PhD about SAT (Tel-Aviv University)

2023: joined the Technion’s Data and Decision Sciences faculty as a part-time research fellow

    • Looking for students!

Most SW is closed-sourced, but lately I was able to participate in some open-source projects:

    • 2018: MapleLCMDistChronoBT SAT solver – won the SAT Competition 2018
    • 20192024 : TT-Open-WBO-Inc MaxSAT solver – multiple medals in MaxSAT Evaluations
    • 2022: Intel released my new SAT solver “Intel® SAT Solver” (IntelSAT), tuned for optimization flows

7

8/6/2024

PEG PDS DDI

8 of 194

Agenda

How does a conflict-driven SAT solver work?

    • The core: backtrack search, Boolean Constraint Propagation (BCP), conflict analysis
    • Follow the first SAT Competition winners (from Chaff till Minisat)

Applying SAT by example

    • Paradigms: incremental SAT solving, SAT-based local search, example encodings
    • Applications: Bounded Model Checking (BMC), proof-based abstraction refinement, bug hunting, anytime MaxSAT

Advanced core SAT algorithms

    • Follow the SAT Competition winners after Minisat & discussion about incremental SAT

8

8/6/2024

PEG PDS DDI

9 of 194

Not in Today’s Agenda

SAT Solving

    • Parallel SAT solving (divide & conquer, portfolio, cloud)
    • Non-CNF formulas
    • Deserves much more attention: inprocessing, encodings

SAT-based paradigms and solvers

    • Satisfiability Modulo Theories (SMT)
    • Quantified Boolean Formula (QBF)
    • Model counting
    • AllSAT – enumerating all solutions
    • Model sampling

9

8/6/2024

PEG PDS DDI

10 of 194

SAT Fundamentals: Backtrack Search

The baseline algorithm in modern SAT solvers is backtrack search

Called DPLL or DLL

Davis, Martin; Logemann, George; Loveland, Donald: "A Machine Program for Theorem Proving"Communications of the ACM. 5 (7): 394–397. (1961). 

Davis, Martin; Putnam, Hilary: A computing procedure for quantification theory. Journal of the ACM 7 (1960)

10

8/6/2024

PEG PDS DDI

11 of 194

From Enumeration to DPLL

11

8/6/2024

Boolean Constraint Propagation (BCP): after a decision, apply the unit clause rule till fixed-point

0

1

0

Carry out backtrack search.

Stop when a model is found

0

The unassigned literal c1 must be implied

F = (a ∨ b) ∧ (¬a ∨ ¬b ∨ c)

clause #1

clause #2

Literals

a

b

b

c

c

c

c

0

1

0

0

0

0

0

0

1

1

1

1

1

1

a

b

b

c

c

c

0

1

0

0

0

0

0

1

1

1

1

1

a

b

c

Stop when a clause turns UNSAT

c2

c1

c3

c2

c1

c3

Falsified literal:

Satisfied literal:

Unassigned literal:

A unit clause -- one unassigned, rest falsified:

1

a

b

c

0

0

The unit clause rule: the unassigned literal in a unit clause must be 1

Implied in parent clause #1:

PEG PDS DDI

12 of 194

The Mystery of SAT Solver Scalability

DPLL: backtrack search with BCP until a model is found (SAT) or completion (UNSAT)

DPLL could handle formulas with <2,000 clauses

Modern SAT solvers cope with industrial instances of 100,000,000’s clauses

The introduction of Conflict-Driven-Clause-Learning (CDCL) or, simply, �Conflict-driven Solving was the birth of modern highly-scalable SAT solving

Learn from conflicts to drive & prune backtrack search

12

8/6/2024

a

b

b

c

c

c

c

0

1

0

0

0

0

0

0

1

1

1

1

1

1

PEG PDS DDI

13 of 194

CDCL: the Intuitive Principles

Learning and pruning

    • Block already explored sub-spaces

Locality

    • Focus the search on the relevant data
    • Learn strong clauses from the local context

Well-engineered data structures

    • Extremely fast Boolean Constraint Propagation (BCP)

Beyond CDCL

    • Inprocessing
    • Local search integration

13

8/6/2024

PEG PDS DDI

14 of 194

Basic CDCL Algorithm

Preprocess() // Simplify the formula

While (true)

    • Literal l = Decide() // Choose the next literal to assign
    • BCP(l) // Apply the unit clause rule till fixed point
    • If (conflict)
      • ConflictAnalysisLoop() // Learn a new conflict clause(s), backtrack and flip a variable
    • If (learned an empty clause)
      • Return UNSAT
    • If (all the variables are assigned)
      • Return SAT
    • Occasionally, restart
    • Occasionally, delete conflict clauses

14

8/6/2024

PEG PDS DDI

15 of 194

Conflict-driven SAT Solving: Seminal Work

15

8/6/2024

1996: GRASP by Joao P. Marques-Silva and Karem A. Sakallah

João P. Marques Silva, Karem A. Sakallah: GRASP - a new search algorithm for satisfiability. ICCAD 1996: 220-2272001: Chaff by Matthew W. Moskewicz, Conor F. Madigan, Ying Zhao, Lintao Zhang and Sharad Malik

Matthew W. Moskewicz, Conor F. Madigan, Ying Zhao, Lintao Zhang, Sharad Malik: Chaff: Engineering an Efficient SAT Solver. DAC 2001: 530-535

PEG PDS DDI

16 of 194

Chaff’s Conflict Analysis

16

8/6/2024

h@5(C5)

b@2

c@3

d@4

e@5

f@5(C6)

g@5(C3)

a@1

Decision Level 4

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= ¬c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ h

Decision Level 1

Decision Level 2

Decision Level 3

Decision Level 5

Decision variable/literal

C6= ¬e ∨ ¬h ∨ f

Implied literal

Conflict analysis starts

PEG PDS DDI

17 of 194

Implication Graphs and Conflict Analysis

Every vertex corresponds to an assigned literal

A decision literal has 0 incoming edges

A literal implied in clause C has |C|-1 incoming edges from every other literal in C

We only need the strongly connected component of the conflict

17

8/6/2024

h@5(C5)

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= ¬c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ h

a@1

b@2

c@3

d@4

e@5

g@5

¬ g@5

f@5

c@3

b@2

C3

C3

C4

C6

C4

Implication graph

f@5(C6)

C6= ¬e ∨ ¬h ∨ f

h@5

C5

C6

g@5(C3)

e@5

PEG PDS DDI

18 of 194

Implication Graphs and Conflict Analysis

Conflict cut

    • Right (conflict): the two conflicting implications
    • Left (reason): all the decision literals (roots)

Conflict clause

    • Corresponds to every cut: includes one appearance of ¬l for every edge l🡪r in the cut
    • Learning a conflict clause prevents the conflict from reappearing

18

8/6/2024

h@5(C5)

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= ¬c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ h

a@1

b@2

c@3

d@4

e@5

g@5

¬ g@5

f@5

c@3

b@2

C3

C3

C4

C6

C4

Implication graph

f@5(C6)

C6= ¬e ∨ ¬h ∨ f

h@5

C5

C6

g@5(C3)

e@5

¬f ∨ ¬c ∨ ¬b

¬h ∨ ¬e ∨ ¬c ∨ ¬b

¬e ∨ ¬c ∨ ¬b

PEG PDS DDI

19 of 194

Implication Graphs and Conflict Analysis

A UIP cut has exactly one literal l of the last level on the reason side of its edges

    • l is a Unique Implication Point (UIP): a literal sufficient to imply the conflict at the last level
    • A conflict clause is a UIP clause if it corresponds to a UIP cut

UIP’s are ordered starting from the conflict

19

8/6/2024

h@5(C5)

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= ¬c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ h

a@1

b@2

c@3

d@4

e@5

f@5(C6)

C6= ¬e ∨ ¬h ∨ f

g@5(C3)

g@5

¬ g@5

f@5

c@3

b@2

C3

C3

C4

C6

C4

h@5

C5

e@5

¬f ∨ ¬c ∨ ¬b: 1UIP

¬h ∨ ¬e ∨ ¬c ∨ ¬b

¬e ∨ ¬c ∨ ¬b: 2UIP

C6

Implication graph

PEG PDS DDI

20 of 194

Chaff’s Conflict Analysis

20

8/17/2024

h@5(C5)

f@1(C8)

c@3

¬f@3(C7)

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= ¬c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ h

a@1

b@2

c@3

d@4

e@5

g@5

¬ g@5

f@5

e@5

c@3

b@2

1UIP

C7 = ¬f ∨ ¬c ∨ ¬b

a@1

b@2

C3

C3

C4

C6

C4

g@3

¬ g@3

a@1

¬ f@3

C1

C1

C2

C2

1UIP

C8 = f ∨ ¬a

a@1

c@3

b@2

  • Learn a falsified asserting clause C=[c1, c2@β<δ , c3@≤β , … , c|C|@≤ β]
    • 1UIP clause: fewest variables out of all UIP clauses (UIP clauses have one variable @ δ)
  • Backtrack to level β: called Non-Chronological Backtracking (NCB) 🡪 C becomes unit
  • Flip & imply c1 in its parent C and run BCP

NCB to 3

NCB to 1

Implication graph

f@5(C6)

g@3(C1)

C6= ¬e ∨ ¬h ∨ f

h@5

C5

C6

g@5(C3)

¬c@2

¬b@3

¬e@4

d@5

g@6

h@7

C7

C7

Conflict analysis completed

PEG PDS DDI

21 of 194

GRASP’s Conflict Analysis

b@2

a@1

g@3

a@1

b@2

c@3

d@4

e@5

f@5(C5)

g@5

¬g@5

f@5

e@5

c@3

1UIP

C6 = ¬f ∨ ¬c ∨ ¬b

C3

C3

C4

C5

C4

2UIP 🡪 1UIP

C7 = ¬e ∨ f

¬f@3(C6)

a@1

b@2

c@3

d@4

f@1(C8)

a@1

¬f@3

C1

C1

C2

C2

1UIP

c@3

b@2

2UIP🡪1UIP

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= ¬c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ f

b@2

C9 = ¬c ∨ ¬b ∨ ¬f

C8 = f ∨ ¬a

  • Backtrack to the conflict level δ: called NCB in GRASP (unnamed today)
  • Learn a falsified asserting 1UIP clause C=[c1, c2@β<δ , c3@≤β , … , c|C|@≤ β]
  • Learn a clause per every other UIP of the last level
  • Backtrack to level δ-1: called Chronological Backtracking (CB) today.
  • Flip & imply c1 in its parent C and run BCP

CB to 4

¬g@3

Backtrack to conflict level 3

CB to 2

In GRASP, f is a special kind of a “flipped” decision variable at level 5, but GRASP learns as if ¬f were implied at level 3

g@5(C3)

g@3(C1)

¬g@1(C4)

¬c@1(C3)

d@3

¬e@4

Conflict analysis completed

PEG PDS DDI

22 of 194

Up-to-date Conflict Analysis Algorithm �Covers GRASP & Chaff & Modern Solvers

  1. Backtrack before conflict analysis: backtrack to the conflict level δ, if required
    • Required in GRASP
    • Not required in Chaff: current decision level ≡ conflict level
  2. Learn an asserting clause C=[c1, c2@β<δ, c3@@≤β, …, ci@@≤β, …, c|C|@≤β]
    • 1UIP clause in both GRASP & Chaff
    • Return UNSAT, if the clause is empty
  3. Optionally, learn other clauses
    • GRASP: a clause for every other UIP of the conflict decision level
  4. Backtrack: backtrack to a level in [β, β+1, …, δ-1] -- renders the asserting clause unit
    • GRASP -- always δ-1: Chronological Backtracking (CB) in today’s terminology
    • Chaff -- always β: Non-Chronological Backtracking (NCB) in today’s terminology
  5. Flip c1 by implying it in C and run BCP

22

8/6/2024

PEG PDS DDI

23 of 194

Boolean Constraint Propagation (BCP) Essentials

BCP is carried out after every decision and flip and consumes 80-90% run-time

What?

    • Identify and propagate in unit clauses (performance)

    • Identify and report any conflicts (correctness)

How?

    • Visit a clause when one of its watched literals is falsified
      • Every literal l holds a Watch List (WL) with all the clauses where l is watched

23

8/6/2024

c2

c1

c3

c2

c1

c3

c2

c1

c3

Falsified literal:

Satisfied literal:

Unassigned literal:

PEG PDS DDI

24 of 194

Efficient Data Structure for BCP

  • GRASP watched all the literals in every clause
  • It is sufficient to watch two non-falsified literals: SATO’s Head/Tail!
    • Watching: visiting during BCP

Hantao Zhang: SATO: An Efficient Propositional Prover. CADE 1997: 272-275

  • Chaff’s 2WL: watching the first two literals – no need to visit during backtracking!

    • as long as: decision-level(falsified watch) ≥ decision-level(falsified non-watch)
  • Caching one literal inside the watches & inlining binary clauses

Sörensson, N., Eén, N.: MiniSAT 2.1 and MiniSAT++ 1.0 - SAT race Editions. SAT, Competitive Event Booklet (2008) (caching one literal)� Geoffrey Chu, Aaron Harwood, Peter J. Stuckey: Cache Conscious Data Structures for Boolean Satisfiability Solvers. J. Satisf. Boolean Model. Comput. 6(1-3): 99-120 (2009) (caching one literal & inlining binary clauses)

8/6/2024

c4

c5

c7

c2

c1

c3

c6

Falsified literal:

Satisfied literal:

Unassigned literal:

Unknown literal:

Non-falsified literal:

Non-satisfied literal:

c4

c5

c7

c3

c2

c6

c1

PEG PDS DDI

25 of 194

BCP assuming NCB

For every satisfied literal l in the literal stack Π (literals to be propagated)

    • For <h ≠ ¬l ∈ C, C> ∈ WL(¬l) h: cached literal; C: the visited clause, where c1≡¬l or c2≡¬l
      • If h is satisfied: continue C is satisfied: no conflict, C isn’t unit 🡪 skip C

Clause visit: assume WLOG c2 ≡ ¬l

      • If c1 is satisfied: continue
      • If a non-falsified k ≠ c1∈C exists
        • Swap(C, k, ¬l)
        • Remove <h ≠ ¬l ∈ C, C> from WL(¬l)
        • Add <h’ ≠ k ∈ C, C> to WL(k) h’: heuristical
      • Else (unit or falsified)
        • If c1 is unassigned, imply c1 and add c1 to Π (unit)

        • If c1 is falsified, report a conflict and return C (falsified)

25

8/6/2024

c4

c2 ≡ ¬l

c3

c1

c4

c2 ≡ ¬l

c3

c1

Falsified literal:

Satisfied literal:

Unassigned literal:

Unknown literal:

c4 ≡ k

c2 ≡ ¬l

c3

c1

Non-falsified literal:

c4 ≡ ¬l

c2≡ k

c3

c1

c4

c2 ≡ ¬l

c3

c1

c4

c2 ≡ ¬l

c3

c1

c4

c2 ≡ ¬l

c3

c1

Non-satisfied literal:

PEG PDS DDI

26 of 194

Agenda

How does a conflict-driven SAT solver work?

    • The core: backtrack search, Boolean Constraint Propagation (BCP), conflict analysis
    • Follow the first SAT Competition winners (from Chaff till Minisat)

Applying SAT by example

    • Paradigms: incremental SAT solving, SAT-based local search, example encodings
    • Applications: Bounded Model Checking (BMC), proof-based abstraction refinement, bug hunting, anytime MaxSAT

Advanced core SAT algorithms

    • Follow the SAT Competition winners after Minisat & discussion about incremental SAT

26

8/6/2024

PEG PDS DDI

27 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

27

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

MiniSat-based:

Armin Biere’s& derived:

Others:

2006

RSAT

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Glucose

Lingeling

Lingeling

abcdSAT

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

2022

2023

KissatMAB-HyWalk

Zheng

He�Chen

Zhou

Li

SBVA-CaDiCaL

Haberlandt

Green

PEG PDS DDI

28 of 194

Chaff

Covered:

    • Conflict analysis
    • BCP

To cover:

    • Variable State Independent Decaying Sum (VSIDS) decision heuristic
      • The first conflict-driven decision heuristic
    • Conflict clause deletion
    • Restarts

28

8/6/2024

PEG PDS DDI

29 of 194

Variable State Independent Decaying Sum (VSIDS)

Each literal l has a counter S(l), initialized to 0

For every new clause C=[c1, c2, …, cn], S(ci) is incremented for every ci∈C

Including initial and conflict clauses

The (unassigned) variable and polarity with the highest counter is chosen

Ties are broken randomly

Periodically (once in 256 conflicts), all the counters are halved.

PEG PDS DDI

30 of 194

VSIDS Example

Literal

Score

a

0

¬a

0

b

0

¬b

0

c

0

¬c

0

d

0

¬d

0

e

0

¬e

0

Heuristic-related data

Search tree

Conflicts till now: 0

PEG PDS DDI

31 of 194

VSIDS Example

Literal

Score

a

4

¬a

5

b

3

¬b

3

c

2

¬c

3

d

2

¬d

4

e

2

¬e

6

Heuristic-related data

Search tree

Conflicts till now: 0

Count literal appearances in the initial formula

PEG PDS DDI

32 of 194

VSIDS Example

Literal

Score

a

4

¬a

5

b

3

¬b

3

c

2

¬c

3

d

2

¬d

4

e

2

¬e

6

Heuristic-related data

Search tree

Conflicts till now: 0

Pick a literal with maximal score

¬e🡪{h,i}

PEG PDS DDI

33 of 194

VSIDS Example

Literal

Score

a

4

¬a

5

b

3

¬b

3

c

2

¬c

3

d

2

¬d

4

e

2

¬e

6

Heuristic-related data

Search tree

Conflicts till now: 0

¬e🡪{h,i}

¬a🡪{d}

Pick an unassigned literal with maximal score

PEG PDS DDI

34 of 194

VSIDS Example

Literal

Score

a

4

¬a

5

b

3

¬b

3

c

2

¬c

3

d

2

¬d

4

e

2

¬e

6

Heuristic-related data

Search tree

Conflicts till now: 0

¬e🡪{h,i}

Conflict

¬a🡪{d}

PEG PDS DDI

35 of 194

VSIDS Example

Literal

Score

a

4🡪5

¬a

5

b

3

¬b

3🡪4

c

2🡪3

¬c

3

d

2

¬d

4

e

2

¬e

6

Heuristic-related data

Search tree

Conflicts till now: 1

¬h ∨ a ∨ c ∨ ¬b ∨ k

Increment scores for conflict clause literals

¬e🡪{h,i}

¬a🡪{d}

PEG PDS DDI

36 of 194

VSIDS Example

Literal

Score

a

10

¬a

12

b

18

¬b

6

c

12

¬c

6

d

2

¬d

6

e

16

¬e

6

Heuristic-related data

Search tree

Conflicts till now: 256

Assume the threshold of 256 is reached

¬e🡪{h,i}

¬a🡪{d}

PEG PDS DDI

37 of 194

VSIDS Example

Literal

Score

a

10🡪5

¬a

12🡪6

b

18🡪9

¬b

6🡪3

c

12🡪6

¬c

6🡪3

d

2🡪1

¬d

6🡪3

e

16🡪8

¬e

6🡪3

Heuristic-related data

Search tree

Conflicts till now: 256

Halve the scores

¬e🡪{h,i}

¬a🡪{d}

PEG PDS DDI

38 of 194

VSIDS vs. Static Heuristics

Pre-Chaff static heuristics

    • Go over all clauses that are not satisfied
    • Compute some function f(a) for each literal—based on frequency
    • Choose literal with maximal f(a)

VSIDS was a breakthrough

    • Extremely low overhead
    • Conflict-driven 🡪 dynamic and local
      • Based on recent conflicts
      • Focuses the search to learn from the local context

PEG PDS DDI

39 of 194

Conflict Clause Deletion

Maintaining too many clauses slows down the solver

D. Gelperin: Deletion-directed search in resolution-based proof procedures, in Proc. of the 3rd Int. Joint Conf. on Artificial Intelligence (1973), pp. 47–50.

Chaff’s strategy:

    • Mark a clause for deletion, once 100-200 literals become unassigned

39

8/6/2024

PEG PDS DDI

40 of 194

Restarts

C. P. Gomes, B. Selman and H. A. Kautz: Boosting combinatorial search through randomization, in Proc. of AAAI (1998), pp. 431–437

Refocus the search by starting from important variables

Chaff: restart every 700 conflicts

40

8/6/2024

PEG PDS DDI

41 of 194

Chaff

Preprocess()

While (true)

    • Literal l = Decide() // VSIDS
    • BCP(l) // 2WL
    • If (conflict)
      • ConflictAnalysisLoop() // 1UIP + non-chronological backtracking
    • If (learned an empty clause)
      • Return UNSAT
    • If (all the variables are assigned)
      • Return SAT
    • Occasionally, restart // Every 700 conflicts
    • Occasionally, delete conflict clauses // Mark for deletion, when 100-200 lit’s are unassigned

41

8/6/2024

PEG PDS DDI

42 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

42

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

2006

RSAT

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Glucose

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Armin Biere’s& derived:

Others:

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

43 of 194

BerkMin & Forklift by Goldberg & Novikov

Forklift: industrial closed-source solver (Cadence)

We discuss Forklift’s direct ancestor BerkMin (won Handmade, SAT category at SC’02)

Goldberg, Novikov: BerkMin: A fast and robust SAT-solver, DATE, 2002.

Clause deletion is based on “age” and size. The strategy, simplified:

    • Age: remove clauses which did not participate in recent conflict clause derivation
    • Size: keep short clauses forever (|C|<8)

Restarts every 550 conflicts

Innovation in decision heuristics

    • Boost the score for all the literals visited during conflict analysis (rather than only in the conflict clause)
      • Used in modern solvers
    • Clause-based heuristic

43

8/6/2024

PEG PDS DDI

44 of 194

Extended Score Boost Example

44

8/6/2024

h@5(C5)

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= ¬c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ h

a@1

b@2

c@3

d@4

e@5

g@5

¬ g@5

f@5

c@3

b@2

C3

C3

C4

C6

C4

Implication graph

f@5(C6)

C6= ¬e ∨ ¬h ∨ f

h@5

C5

C6

g@5(C3)

e@5

¬e ∨ ¬c ∨ ¬b

  • Chaff’s: boost the scores of ¬e, ¬c and ¬b
  • BerkMin: additionally to ¬e, ¬c and ¬b, boost the scores of h, f, g, ¬g

PEG PDS DDI

45 of 194

BerkMin & Forklift by Goldberg & Novikov

Forklift: industrial closed-source solver (Cadence)

We discuss Forklift’s direct ancestor BerkMin (won Handmade, SAT category at SC’02)

Goldberg, Novikov: BerkMin: A fast and robust SAT-solver, DATE, 2002.

Clause deletion is based on “age” and size. The strategy, simplified:

    • Age: remove clauses which did not participate in recent conflict clause derivation
    • Size: keep short clauses forever (|C|<8)

Restarts every 550 conflicts

Innovation in decision heuristics

    • Boost the score for all the literals visited during conflict analysis (rather than only in the conflict clause)
      • Used in modern solvers
    • Clause-based heuristic

45

8/6/2024

PEG PDS DDI

46 of 194

Clause-based Heuristics

Berkmin

    • The conflict clauses are placed on a stack
    • The next variable is picked from the topmost unsatisfied clause
    • If no such clause exists, use VSIDS

HaifaSAT (3d in three Industrial categories at SC’05)

Roman Gershman, Ofer Strichman: HaifaSat: A New Robust SAT Solver. Haifa Verification Conference 2005: 76-89

    • Move clauses visited during conflict analysis to the top

CBH -- Eureka SAT solver (2nd at SR’06)

Nachum Dershowitz, Ziyad Hanna, Alexander Nadel: A Clause-Based Heuristic for SAT Solvers. SAT 2005: 46-60

    • Either all the clauses (including the initial clauses) or only the initial clauses are on the stack
    • Move clauses visited during conflict analysis to the top

Added value w.r.t variable-based heuristics: picks interrelated variables

Didn’t make it to mainstream modern solvers, though CBH is occasionally very useful in my experience

    • 2023: modified CBH works great for constraint-based product configuration ��Matthias Gorenflo, Tomás Balyo, Markus Iser, Tobias Ostertag: Decision Heuristics in a Constraint-based Product Configurator. ConfWS 2023: 51-59

46

8/6/2024

PEG PDS DDI

47 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

47

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

RSAT

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Glucose

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

abcdSAT

Zheng

He�Chen

Zhou

Li

PEG PDS DDI

48 of 194

MiniSat & SatELite: Seminal Works

Niklas Eén, Niklas Sörensson: An Extensible SAT-solver. SAT 2003: 502-518

    • Minisat solver
    • “Test of time” award at SAT’22
    • Simple & elegant engineering: the ancestor of a long line of solvers!
    • Impactful heuristics & algorithms:
      • Exponential VSIDS (EVSIDS)
        • sometimes still called VSIDS today
      • Conflict clause minimization
    • Incremental-under-assumptions API: enabler of major real-world flows

Niklas Eén, Armin Biere: Effective Preprocessing in SAT Through Variable and Clause Elimination. SAT 2005: 61-75

    • SatELite Preprocessing

48

8/6/2024

PEG PDS DDI

49 of 194

Minisat’s Decision Heuristic

Separate variable and polarity heuristics

    • Keep score per variable, rather than per literal
    • Choose 0 as the first polarity

EVSIDS

    • Increment activity by an exponentially increasing increment (g=1/f)#conflict
      • Minisat: f=0.95 🡪 g≈1.05
    • Rescale when activity (for any variable) becomes higher than 10100
      • g *= 10-100
      • #conflict = 1
    • Even more dynamic than VSIDS

Both features (further updated) made it to today’s state-of-the-art solvers

49

8/6/2024

PEG PDS DDI

50 of 194

Restart & Clause Deletion in Minisat

Restarts

    • Geometric series
      • starting from 100, with the factor of 1.5
    • Too slow: didn’t make it to modern solvers

Clause deletion

    • Activity-based: smoothing BerkMin’s scheme
      • Each clause is associated with a float activity
      • Each time a clause is used in conflict analysis, its activity is increased
      • Periodically, the less active clauses are deleted (half of the clauses)
      • Still in use (along with other ideas)�

50

8/6/2024

PEG PDS DDI

51 of 194

MiniSat & SatELite: Seminal Works

Niklas Eén, Niklas Sörensson: An Extensible SAT-solver. SAT 2003: 502-518

    • Minisat solver
    • Simple & elegant engineering: the ancestor of a long line of solvers!
    • Impactful heuristics & algorithms:
      • Exponential VSIDS (EVSIDS)
        • sometimes still called VSIDS today
      • Conflict clause minimization
    • Incremental-under-assumptions API: enabler of major real-world flows
    • “Test of time” award at SAT’22

Niklas Eén, Armin Biere: Effective Preprocessing in SAT Through Variable and Clause Elimination. SAT 2005: 61-75

    • SatELite Preprocessing

51

8/6/2024

Next: after some preliminary material

After presenting SatELite

PEG PDS DDI

52 of 194

Resolution and Variable Elimination

52

8/6/2024

C ∨ l

D ∨ ¬l

Resolution (Davis & Putnam’60)

C ∨ D

a ∨ b ∨ l

c ∨ b ∨ ¬l

a ∨ b ∨ c

l is the pivot

Variable Elimination by Resolution (Davis & Putnam’60)

C1l

D1¬l

C2l

D2¬l

Cnl

Dm¬l

C1 ∨ D1

C1 ∨ D2

C1 ∨ Dm

C2 ∨ D1

C2 ∨ D2

C2 ∨ Dm

Cn ∨ D1

Cn ∨ D2

Cn ∨ Dm

a ∨ b ∨ l

d ∨ l

c ∨ b ∨ ¬l

¬c ∨ ¬ b ∨ ¬l

a ∨ b ∨ c

c ∨ b ∨ d

¬c ∨ ¬ b ∨ d

Equisatisfiable

PEG PDS DDI

53 of 194

Subsumption and Self-Subsuming Resolution

53

8/6/2024

Subsumption

C

C ∨ D

C

C ∨ D

a ∨ b

a ∨ b ∨ c

a ∨ b

a ∨ b ∨ c

C ∨ D ∨ l

C ∨ ¬l

Self-subsuming Resolution

C ∨ D ∨ l

C ∨ ¬l

a ∨ b ∨ l

b ∨ ¬l

a ∨ b

b ∨ ¬l

PEG PDS DDI

54 of 194

SatELite Preprocessor

Run the following till fixed-point

    • Variable elimination
      • Bounded: the number of clauses doesn’t grow�or grows by a constant factor
      • Gate identification: next slide
    • Subsumption for removing subsumed clauses:

    • Self-subsuming resolution for removing literals:

Crucial on many difficult instances ever since 2005!

54

8/6/2024

a ∨ b ∨ l

d ∨ l

c ∨ b ∨ ¬l

¬c ∨ ¬ b ∨ ¬l

a ∨ b ∨ c

c ∨ b ∨ d

¬c ∨ ¬ b ∨ d

a ∨ b

a ∨ b ∨ c

a ∨ b

a ∨ b ∨ c

a ∨ b ∨ l

b ∨ ¬l

a ∨ b

b ∨ ¬l

PEG PDS DDI

55 of 194

SatELite with Gate Identification

Idea: reduce the number of generated resolvents when eliminating a variable

How (on an AND-gate example; applicable to other gates too):

    • Assume the algorithm considers eliminating the variable g
    • Was g created by translating an AND-gate to clauses?
      • Are the following clauses (or their simplified variants) present:
    • Negative 🡪 optimization can’t be applied. Positive:
    • Let the gate definition clauses be G = G+ ∪ G- and the rest be R = R+ ∪ R-
      • + clauses contain g; - clauses contain ¬g
    • Create only the resolvents between G and R!
      • Resolving between G+ and G- yield tautologies
      • Resolving between R+ and R- is unnecessary 🡪 next slide

55

8/6/2024

a

b

g

g ∨ ¬a ∨ ¬b

¬g ∨ a

¬g ∨ b

G+

G-

PEG PDS DDI

56 of 194

SatELite with Gate Identification: Cont.

Resolving between R+ and R- is unnecessary: the resolvents are obsolete

It can be yielded solely by resolutions between G and R:

56

8/6/2024

P ∨ a

a

b

g

g ∨ ¬a ∨ ¬b

¬g ∨ a

¬g ∨ b

G+

G-

P ∨ g ∈ R+

N ∨ ¬g ∈ R-

P ∨ N

P ∨ g

N ∨ ¬g

¬g ∨ a

g ∨ ¬a ∨ ¬b

¬g ∨ b

R+

R-

G-

G+

N ∨ ¬a ∨ ¬b

P ∨ b

P ∨ N ∨ ¬b

P ∨ N

PEG PDS DDI

57 of 194

(Learned Clause) Minimization

The idea:

    • During conflict analysis,
    • given a learnt clause C,
    • remove unnecessary literals from C by resolution with parent clauses

Local minimization

Beame, P., Kautz, H., Sabharwal, A.: Towards understanding and harnessing the potential of clause learning. J. Artif. Intell. Res. (JAIR) 22 (2004)

Recursive minimization

Niklas Sörensson, Armin Biere: Minimizing Learned Clauses. SAT 2009: 237-243

    • In MiniSat since 2005
    • Standard nowadays, applied for every learnt clause

57

8/6/2024

PEG PDS DDI

58 of 194

Local Minimization�

58

8/6/2024

C1= ¬a ∨ b

C2= ¬b ∨ c

C3= ¬b ∨ ¬c ∨ ¬d ∨ e

C4= ¬b ∨ ¬c ∨ ¬d ∨ ¬e

a@1

b@1

1UIP

C5 = ¬b ∨ ¬c ∨ ¬d

c@1

d@2

e@2

¬ e@2

a@1

b@1

c@1

d@2

C6 = ¬b ∨ ¬d

  • Given a newly learnt clause C, remove literals, whose antecedents (in the implication graph) are already in C
    • By applying self-subsuming resolution with the parent clause

e@2

PEG PDS DDI

59 of 194

Local Minimization Shortcoming�

d@2

e@2

C1= ¬a ∨ b

C2= ¬a ∨ ¬b ∨ c

C3= ¬a ∨ ¬c ∨ ¬d ∨ e

C4= ¬a ∨ ¬c ∨ ¬d ∨ ¬e

a@1

b@1

1UIP

C5 = ¬a ∨ ¬c ∨ ¬d

c@1

d@2

e@2

¬ e@2

a@1

b@1

c@1

C6 = ¬a ∨ ¬b ∨ ¬d

A new literal 🡪 local minimization fails

However, a further resolution step with C1 would have yielded C7 = ¬a ∨ ¬d, which subsumes C5

  • Given a newly learnt clause C, remove literals, whose antecedents (in the implication graph) are already in C
    • By applying self-subsuming resolution with the parent clause

PEG PDS DDI

60 of 194

Recursive Minimization�

60

8/6/2024

C1= ¬a ∨ b

C2= ¬a ∨ ¬b ∨ c

C3= ¬a ∨ ¬c ∨ ¬d ∨ e

C4= ¬a ∨ ¬c ∨ ¬d ∨ ¬e

a@1

b@1

1UIP

C5 = ¬a ∨ ¬c ∨ ¬d

c@1

d@2

e@2

¬ e@2

a@1

b@1

c@1

d@2

  • Given newly a learnt clause C, try to remove literals one-by-one in decreasing assignment order by continuous resolution with the parents till either:
    • A new level or a new decision variable is reached 🡪 removal not possible
    • Literals already in the clause reached 🡪 remove the literal from the clause

C6 = ¬a ∨ ¬b ∨ ¬d

C7 = ¬a ∨ ¬d

e@2

PEG PDS DDI

61 of 194

MiniSat in Non-Incremental Mode

Preprocess() // Variable elimination with gate identification & subsumption & self-subsuming resolution

While (true)

    • Literal l = Decide() // Variable-based EVSIDS + polarity 0
    • BCP(l)
    • If (conflict)
      • ConflictAnalysisLoop() // minimized 1UIP
    • If (learned an empty clause)
      • Return UNSAT
    • If (all the variables are assigned)
      • Return SAT
    • Occasionally, restart // geometric series
    • Occasionally, delete conflict clauses // activity-based

61

8/6/2024

PEG PDS DDI

62 of 194

Agenda

How does a conflict-driven SAT solver work?

    • The core: backtrack search, Boolean Constraint Propagation (BCP), conflict analysis
    • Follow the first SAT Competition winners (from Chaff till Minisat)

Applying SAT by example

    • Paradigms: incremental SAT solving, SAT-based local search, example encodings
    • Applications: Bounded Model Checking (BMC), proof-based abstraction refinement, bug hunting, anytime MaxSAT

Advanced core SAT algorithms

    • Follow the SAT Competition winners after Minisat & discussion about incremental SAT

62

8/6/2024

PEG PDS DDI

63 of 194

Hardware Circuit Example

63

8/6/2024

definitions:

I(C0) := FALSE;

I(C1) := FALSE;

X(C0) := C0 ⊕ en;

X(C1) := C1 ⊕ (C0 ∧ en);

constraints:

en 🡪 ¬X(en)

2-Bit Counter, counting when en=1

Cycle

en

C1

C0

0

1

0

0

1

0

0

1

2

1

0

1

3

0

1

0

4

1

1

0

5

0

1

1

PEG PDS DDI

64 of 194

Hardware Model Checking

Model Checking: given a circuit and a property, does the property always hold?

    • Safety property: something bad will never happen
      • Example: the counter never reaches the value 11

64

8/6/2024

definitions:

I(C0) := FALSE;

I(C1) := FALSE;

X(C0) := C0 ⊕ en;

X(C1) := C1 ⊕ (C0 ∧ en);

constraints:

en 🡪 ¬X(en)

proof obligations:

¬(C0 ∧ C1)

2-Bit Counter, counting when en=1

Cycle

en

C1

C0

0

1

0

0

1

0

0

1

2

1

0

1

3

0

1

0

4

1

1

0

5

0

1

1

PEG PDS DDI

65 of 194

Hardware Model Checking

Model Checking: given a circuit and a property, does the property always hold?

    • Safety property: something bad will never happen
      • Example: the counter never reaches the value 11

65

8/6/2024

definitions:

I(C0) := FALSE;

I(C1) := FALSE;

X(C0) := C0 ⊕ en;

X(C1) := C1 ⊕ (C0 ∧ en);

constraints:

en 🡪 ¬X(en)

proof obligations:

¬(C0 ∧ C1)

2-Bit Counter, counting when en=1

Cycle

en

C1

C0

0

1

0

0

1

0

0

1

2

1

0

1

3

0

1

0

4

1

1

0

5

0

1

1

PEG PDS DDI

66 of 194

Bounded Model Checking (BMC)

BMC: given a circuit ϕ and a property P, verify P until a user-given bound n

    • For every bound b∈{1,…,n}
      • The property holds at bound b iff (ϕ unrolled to bound b) ∧ ¬P is UNSAT
      • If it’s SAT, the model comprises the trace of a bug

66

8/6/2024

PEG PDS DDI

67 of 194

BMC Example

a

b

c

h

g

The property: h🡪b

PEG PDS DDI

68 of 194

BMC Example: Cycle 0

a

b

h

g

c0

A user-given initial value

a

b

c

h

g

The property: h🡪b

PEG PDS DDI

69 of 194

BMC Example: Cycle 0

a

b

h

g

c0

h ∨ ¬g ∨ ¬c0

¬h ∨ g

¬h ∨ c0

g ∨ ¬a ∨ ¬b

¬g ∨ a

¬g ∨ b

¬b

h

The negation of the property h🡪b:

a

b

c

h

g

UNSAT: the property holds!

The property: h🡪b

PEG PDS DDI

70 of 194

BMC Example: Cycle 1

a

b

h

g

c0

a

b

c

h

g

bx

hx

cx

ax

gx

The property: h🡪b

PEG PDS DDI

71 of 194

BMC Example: Cycle 1

a

b

h

g

c0

h ∨ ¬g ∨ ¬c0

¬h ∨ g

¬h ∨ c0

g ∨ ¬a ∨ ¬b

¬g ∨ a

¬g ∨ b

¬bx

hx

The negation of the property hx🡪bx:

a

b

c

h

g

bx

hx

cx

cx ∨ ¬h

¬cx ∨ h

ax

gx

gx ∨ ¬ax ∨ ¬bx

¬gx ∨ ax

¬gx ∨ bx

hx ∨ ¬gx ∨ ¬cx

¬hx ∨ gx

¬hx ∨ cx

UNSAT!

The property: h🡪b

PEG PDS DDI

72 of 194

Re-Using Relevant Information from Previous Cycles

G0 and G1: hold globally

T0 and T1: hold temporary

    • solely for a particular cycle

72

The property: h🡪b

a

b

h

g

c0

bx

hx

cx

h ∨ ¬g ∨ ¬ci

¬h ∨ g

¬h ∨ ci

g ∨ ¬a ∨ ¬b

¬g ∨ a

¬g ∨ b

¬b

h

¬bx

hx

cx ∨ ¬h

¬cx ∨ h

gx ∨ ¬ax ∨ ¬bx

¬gx ∨ ax

¬gx ∨ bx

hx ∨ ¬gx ∨ ¬cx

¬hx ∨ gx

¬hx ∨ cx

G0

G1

T0

T1

PEG PDS DDI

73 of 194

Pervasive Clause Learning (GRASP)

Cycle 0: create a SAT instance G0 ∧ T0 and solve it

    • Let G0* be the set of pervasive conflict clauses, that is conflict clauses that depend only on G0

Cycle 1: create a SAT instance G0 ∧ G0* ∧ G1 ∧ S1 and solve it

73

h ∨ ¬g ∨¬ci

¬h ∨ g

¬h ∨ ci

g ∨ ¬a ∨ ¬b

¬g ∨ a

¬g ∨ b

¬b

h

¬bx

hx

cx ∨ ¬h

¬cx ∨ h

gx ∨ ¬ax ∨ ¬bx

¬gx ∨ ax

¬gx ∨ bx

hx ∨ ¬gx ∨ ¬cx

¬hx ∨ gx

¬hx ∨ cx

G0

G1

a ∨ ¬h

g

G0*

T0

T1

PEG PDS DDI

74 of 194

Incremental SAT Solving under Assumptions (Minisat)

Cycle 0: create a SAT instance and solve it under the temporary assumptions T0

    • T0 clauses are not part of the instance, instead:
    • The literals of T0 are used as the first decision, or assumptions
    • Any learnt clause which depends on an assumption a, will contain a itself or derived literals 🡪 all the learnts are pervasive!
    • If one of the assumptions must be flipped, the solvers returns UNSAT

Cycle 1: add the clauses C1 to the same SAT instance and solve under the assumptions T1

74

h ∨ ¬g ∨¬ci

¬h ∨ g

¬h ∨ ci

g ∨ ¬a ∨ ¬b

¬g ∨ a

¬g ∨ b

¬b

h

¬bx

hx

cx ∨ ¬h

¬cx ∨ h

gx ∨ ¬ax ∨ ¬bx

¬gx ∨ ax

¬gx ∨ bx

hx ∨ ¬gx ∨ ¬cx

¬hx ∨ gx

¬hx ∨ cx

a ∨ ¬h

Assumptions

Assumptions

T0

T1

PEG PDS DDI

75 of 194

Incremental SAT Solving under Assumptions

Basic API:

    • AddClause(Clause C)
    • Solve(Literals A)

Output:

    • SAT iff F ∧ A is SAT
      • F: all the clauses added so far
      • A: current assumptions

Allows the user to add groups of clauses temporarily (for invocation #i)

    • Using a new selector (activation) variable s
    • To add a temporary clause Ti: AddClause(Tis)
    • Solve(A ∧ ¬s)
    • To delete all the temporary clauses afterwards: do nothing or add a unit clause s

75

PEG PDS DDI

76 of 194

Incremental SAT Solving under Assumptions

A breakthrough

    • Extremely easy to use
    • Very efficient, since it retains the following info across all the queries:
      • the conflict clauses
      • heuristical data: variable scores, clause activities, …

Incremental solving under assumptions is widely used, including:

    • Hardware & Software Validation
    • SAT-based Optimization, including MaxSAT

My personal industrial experience: can’t recall any non-incremental SAT application

Minisat: SatELite preprocessing is incompatible with incremental solving

    • Later works make it compatible:�

Alexander Nadel, Vadim RyvchinOfer Strichman: Preprocessing in Incremental SAT. SAT 2012: 256-269

Katalin Fazekas, Armin Biere, Christoph Scholl: Incremental Inprocessing in SAT Solving. SAT 2019: 136-154

76

8/6/2024

PEG PDS DDI

77 of 194

Unsatisfiable Core in Terms of Assumptions

Extended API:

    • AddClause(Clause C)
    • Solve(Literals A)
    • If UNSAT:
      • Is assumption l∈A required for unsatisfiability proof?

Algorithm outline

    • Conflict at decision level 0: unrelated to the assumptions
      • None of the assumptions is required
    • Otherwise, an assumption must have been flipped
      • Go over the trail backwards
      • Mark all the decision variables (must be assumptions!), connected to the flipped assumption
      • Return the marked assumptions

77

8/6/2024

PEG PDS DDI

78 of 194

78

8/6/2024

seen: marks variables connected to the flipped assumption

p: the flipped assumption

out_conflict: the returned set of assumptions in the core

Go over the trail backwards

A decision variable: must be an assumption, since the flip must have occurred at an assumption level

An implied variable: mark all the variables in its parent

PEG PDS DDI

79 of 194

Proof-based Abstraction Refinement Example

The unsatisfiable core in terms of the latches is required

No Bug

Valid

Model Check A

BMC(M,P,k)

Cex C at unrolling depth k

Bug

No

A 🡨 A ∪ latches in the UNSAT core of BMC(M,P,k)

Inputs: model M, property P �Output: does P hold under M?

Abstract model A 🡨 { }

Spurious?

Yes

Cut latches into free inputs

Kenneth L. McMillan, Nina Amla: Automatic Abstraction without Counterexamples. TACAS 2003: 2-17

Aarti Gupta, Malay K. Ganai, Zijiang Yang, Pranav Ashar: Iterative Abstraction using SAT-based BMC with Proof Analysis. ICCAD 2003: 416-423

PEG PDS DDI

80 of 194

SAT-based Local Search: �Finding a Solution Near an Assignment

Find a solution near an assignment M={v11, v22, …, vnn}

Polarity-based

    • Change only the polarity selection heuristic
    • Whenever a decision variable vi is chosen, choose σi as its first polarity

80

8/6/2024

Sabih Agbaria, Dan Carmi, Orly Cohen, Dmitry Korchemny, Michael Lifshits, Alexander Nadel:�SAT-based semiformal verification of hardware. FMCAD 2010: 25-32

PEG PDS DDI

81 of 194

Original Application: Bug Hunting

New Initial �states

New Initial �states

New Initial �states

initial

states

deep bugs

Max BMC

Bound

Needed to generate diverse solutions on the boundary!

PEG PDS DDI

82 of 194

Original Application: DiverseKSet for Bug Hunting

DiversekSet in SAT: generate a user-given number of diverse solutions

    • Maximize the average Hamming distance between the solutions

Diverse solutions, given an empty CNF

    • 000000
      • Any model
    • 111111
      • Flip every variable
    • 001110
      • Pick a random value
    • 110001
      • Balance the values for every variable

Given a CNF formula:

    • SAT-based local search: fix the polarities to match the current target solution (which would maximize the Hamming distance)
    • Run SAT incrementally
    • Adjust the target solution

82

8/6/2024

PEG PDS DDI

83 of 194

Optimization in SAT

OptSAT(F, ψ): given a propositional formula F in CNF and a Pseudo-Boolean objective function ψ, return a model to F which minimizes ψ

    • A Pseudo-Boolean (PB) function: a mapping from every full assignment to a real number

83

8/6/2024

Example: F = (a + b) (a + ¬c) (¬a + c)

H has 3 models:

        • M1={a=0, b=1, c=0}
        • M2={a=1, b=0, c=1}
        • M3={a=1, b=1, c=1}

a

b

c

ψ

0

0

0

2.3

0

0

1

3.5

0

1

0

8

0

1

1

100.1

1

0

0

96.3

1

0

1

75

1

1

0

1.35

1

1

1

20.4

PEG PDS DDI

84 of 194

Optimization in SAT

OptSAT(F, ψ): given a propositional formula F in CNF and a Pseudo-Boolean objective function ψ, return a model to F which minimizes ψ

    • A Pseudo-Boolean (PB) function: a mapping from every full assignment to a real number

84

8/6/2024

Example: F = (a + b) (a + ¬c) (¬a + c)

H has 3 models:

        • M1={a=0, b=1, c=0}
        • M2={a=1, b=0, c=1}
        • M3={a=1, b=1, c=1}

a

b

c

ψ

0

0

0

2.3

0

0

1

3.5

0

1

0

8

0

1

1

100.1

1

0

0

96.3

1

0

1

75

1

1

0

1.35

1

1

1

20.4

Best model

PEG PDS DDI

85 of 194

Solving OptSAT(F, ψ) Instances in Real-life

Is ψ is a linear PB function: ψ = wn-1*tn-1 + … + w1*t1 + … + w0*t0?

    • ti’s are Boolean variables
    • wi’s are strictly positive integer coefficients
    • Example: ψ = 2*t2 + 5*t1 + 7*t0

85

8/6/2024

  • Few works
  • Industrial usage @ Intel

Yes

No

  • MaxSAT
    • A well-established field
    • Myriads of applications
    • MaxSAT Evaluations since 2006

PEG PDS DDI

86 of 194

MaxSAT: Optimizing a Linear PB Function in SAT

86

8/6/2024

Hard Clauses H

  • Satisfiable

Optimization Target T = {tn-1, tn-2 , … , t0}

  • Each target bit ti is a literal (unit clause), associated with an integer weight w(ti) > 0

Input:

Unweighted MaxSAT: All the weights are 1

Output: A model M to H which minimizes the weight of the satisfied target bits ψ = wn-1*tn-1 + … + w1*t1 + … + w0*t0

PEG PDS DDI

87 of 194

MaxSAT: Optimizing a Linear PB Function in SAT

87

8/6/2024

Hard Clauses H

  • Satisfiable

Optimization Target T = {tn-1, tn-2 , … , t0}

  • Each target bit ti is a literal (unit clause), associated with an integer weight w(ti) > 0

Input:

Example: H = (a + b) (a + ¬c) (¬a + c); T={a,b}

H has 3 models:

        • M1={a=0, b=1, c=0}
        • M2={a=1, b=0, c=1}
        • M3={a=1, b=1, c=1}

Unweighted MaxSAT: All the weights are 1

Output: A model M to H which minimizes the weight of the satisfied target bits ψ = wn-1*tn-1 + … + w1*t1 + … + w0*t0

PEG PDS DDI

88 of 194

MaxSAT: Optimizing a Linear PB Function in SAT

88

8/6/2024

Hard Clauses H

  • Satisfiable

Optimization Target T = {tn-1, tn-2 , … , t0}

  • Each target bit ti is a literal (unit clause), associated with an integer weight w(ti) > 0

Input:

Example: H = (a + b) (a + ¬c) (¬a + c); T={a,b}

H has 3 models:

        • M1={a=0, b=1, c=0}
        • M2={a=1, b=0, c=1}
        • M3={a=1, b=1, c=1}

For unweighted MaxSAT, M1 and M2 are optimal, since:

M1(ψ) = M2(ψ) = 1, while M3(ψ) = 2

Output: A model M to H which minimizes the weight of the satisfied target bits ψ = wn-1*tn-1 + … + w1*t1 + … + w0*t0

Unweighted MaxSAT: All the weights are 1

PEG PDS DDI

89 of 194

Exact vs. Anytime MaxSAT

Anytime algorithm: expected to find better and better solutions, the longer it keeps running

MaxSAT research can be roughly classified into two categories

    • Exact
      • Guaranteed to return an optimal solution
      • No intermediate solutions are required
      • Evaluated at MaxSAT Evaluations since 2006
    • Anytime
      • Not guaranteed to return an optimal solution
        • Some algorithms do
      • Improving solutions are output frequently
      • Evaluated at MaxSAT Evaluations since 2011

89

8/6/2024

Handy for industrial usage

Modern solvers normally do:

Local search preprocessing

SAT-based algorithm

Next we review the core SAT-based algorithm

PEG PDS DDI

90 of 194

Linear Search SAT-UNSAT (LSU)

LSU is applied in leading anytime MaxSAT solvers

    • During various stages, often as the last fallback option

90

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

Daniel Le Berre and Anne Parrain: The sat4j library, release 2.2. JSAT, 7(2-3):59–64, 2010.

PEG PDS DDI

91 of 194

Linear Search SAT-UNSAT (LSU) Concept

91

8/6/2024

The optimal model

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

All the models

100

90

83

60

54

52

49

PEG PDS DDI

92 of 194

Linear Search SAT-UNSAT (LSU) Concept

92

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

93 of 194

Linear Search SAT-UNSAT (LSU) Concept

93

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

94 of 194

Linear Search SAT-UNSAT (LSU) Concept

94

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

95 of 194

Linear Search SAT-UNSAT (LSU) Concept

95

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

96 of 194

Linear Search SAT-UNSAT (LSU) Concept

96

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

97 of 194

Linear Search SAT-UNSAT (LSU) Concept

97

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

98 of 194

Linear Search SAT-UNSAT (LSU) Concept

98

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

99 of 194

Linear Search SAT-UNSAT (LSU) Concept

99

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

100 of 194

Linear Search SAT-UNSAT (LSU) Concept

100

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

101 of 194

Linear Search SAT-UNSAT (LSU) Concept

101

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

102 of 194

Linear Search SAT-UNSAT (LSU) Concept

102

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

103 of 194

Linear Search SAT-UNSAT (LSU) Concept

103

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

104 of 194

Linear Search SAT-UNSAT (LSU) Concept

104

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

105 of 194

Linear Search SAT-UNSAT (LSU) Concept

105

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

106 of 194

Linear Search SAT-UNSAT (LSU) Concept

106

8/6/2024

  1. F 🡨 H (a CNF F is initialized with the hard clauses)
  2. Run an incremental SAT solver over F
  3. If SAT with a model M
    • Block all the models of weight ≥ M(ψ) in F (using a cardinality or a Pseudo-Boolean constraint)
  4. Else (UNSAT)
    • Return the last model M (M is guaranteed to be an optimal model)

90

83

60

54

52

49

100

PEG PDS DDI

107 of 194

Cardinality and Pseudo-Boolean (PB) Constraints

In LSU: how to block the models with an upper bound on the weight?

Unweighted MaxSAT:

    • Cardinality constraint: t1 + . . . + tn ≤ b
      • Example: t1 + t2 + t3 + t4 + t5 ≤ 3

Weighted MaxSAT:

    • PB constraint: w1*t1 + . . . + wn* tn ≤ b
      • Example: 2t1 + 4t2 + t3 + 5t4 + 7t5 ≤ 10

Next: the totalizer encoding for unweighted MaxSAT

    • Used by state-of-the-art anytime MaxSAT solvers

107

8/6/2024

PEG PDS DDI

108 of 194

Encoding Cardinality Constraints: The Totalizer

Totalizer: unary encoding-based addition tree to represent (t1 + . . . + tn)

    • Unary encoding: 1 = 01; 2 = 011; 3 = 0111; 4 = 01111; 5 = 011111; ...

Complexity: O(n2) clauses and O(n ∗ log(n)) variables

Given an upper-bound b on the sum value: O(nb) clauses

Markus Büttner, Jussi Rintanen: Satisfiability Planning with Constraints on the Number of Actions. ICAPS 2005: 292-299

    • Tight upper bound significantly reduces complexity

Useful feature (shared with many other encodings): arc consistency

    • Consider the following cardinality constraint t1 + . . . + tn ≤ b.
    • If b variables are assigned 1, then unit propagation enforces 0 on the remaining n − b variables.
    • If b+1 variables are assigned 1, then unit propagation triggers a conflict

Tightening the upper bound is easy and efficient 🡪 handy for LSU & anytime MaxSAT

108

8/6/2024

Olivier Bailleux and Yacine Boufkhad: Efficient CNF encoding of boolean cardinality constraints. CP 2003: 108–122.

PEG PDS DDI

109 of 194

The Totalizer: o = a + b + c + d + e + f + g + h

109

8/6/2024

a

b

c

d

e

f

g

h

i={i1i0}=a+b

j={j1j0}=c+d

k={k1k0}=e+f

l={l1l0}=g+h

m={m3m2m1m0}=i+j

n={n3n2n1n0}=k+l

o={o7o6o5o4o3o2o1o0}=m+n

PEG PDS DDI

110 of 194

The Totalizer Example

110

8/6/2024

a

b

c

d

e

f

g

h

i={i1i0}=a+b

j={j1j0}=c+d

k={k1k0}=e+f

l={l1l0}=g+h

m={m3m2m1m0}=i+j

n={n3n2n1n0}=k+l

o={o7o6o5o4o3o2o1o0}=m+n

a=1

b=0

c=1

d=1

e=0

f=0

g=0

h=1

i={01}=a+b

j={11}=c+d

k={00}=e+f

l={01}=g+h

m={0111}=i+j

n={0001}=g+h

o={00001111}=m+n

PEG PDS DDI

111 of 194

The Totalizer Clauses

111

8/6/2024

N1: bits 1-indexed

N2: bits 1-indexed

N3=N1 + N2: bits 1-indexed

N3 = N1 + N2

for (p = 0; p <= |N1|; ++p)

for (q = 0; q <= |N2|; ++q)

Add clause ¬N1[p] ∨ ¬N2[q] ∨ N3[p+q] (N1[p]=1 and N2[q]=1 🡺 N3[p+q]=1)

Add clause N1[p+1] ∨ N2[q+1] ∨ ¬N3[p+q+1] (N1[p+1]=0 and N2[q+1]=0 🡺 N3[p+q+1]=0)

N1[0]=N2[0]=N3[0]=1;

N1[|N1+1|]= N2[|N2+1|]= N3[|N3+1|]= 1

p=2

q=3

p+q=5

(sum of the inputs is ≥ 5)

p+1=2

q+1=3

p+q+1=5

(sum of the

inputs < 5)

Complexity: for n inputs, O(n2) clauses and O(n ∗ log(n)) variables

PEG PDS DDI

112 of 194

Totalizer with Upper Bound�o = a + b + c + d + e + f + g + h 3

112

8/6/2024

a

b

c

d

e

f

g

h

i={i1i0}=a+b

j={j1j0}=c+d

k={k1k0}=e+f

l={l1l0}=g+h

m={m3m2m1m0}=i+j

n={n3n2n1n0}=k+l

o={o7o6o5o4o3o2o1o0}=m+n

PEG PDS DDI

113 of 194

Totalizer with Upper Bound:�o = a + b + c + d + e + f + g + h b=3

113

8/6/2024

a

b

c

d

e

f

g

h

i={i1i0}=a+b

j={j1j0}=c+d

k={k1k0}=e+f

l={l1l0}=g+h

m={0m2m1m0}=i+j

n={0n2n1n0}=k+l

o={0o2o1o0}=m+n

Complexity: for n inputs, O(n ∗ b) clauses and O(n ∗ log(n)) variables

PEG PDS DDI

114 of 194

Totalizer: Tightening the Upper Bound�o = a + b + c + d + e + f + g + h b=3

114

8/6/2024

a

b

c

d

e

f

g

h

i={i1i0}=a+b

j={j1j0}=c+d

k={k1k0}=e+f

l={l1l0}=g+h

m={0m2m1m0}=i+j

n={0n2n1n0}=k+l

o={0o2o1o0}=m+n

PEG PDS DDI

115 of 194

Totalizer: Tightening the Upper Bound�o = a + b + c + d + e + f + g + h b=3 🡪 b=1

115

8/8/2024

a

b

c

d

e

f

g

h

i={i1i0}=a+b

j={j1j0}=c+d

k={k1k0}=e+f

l={l1l0}=g+h

m={0m2m1m0}=i+j

n={0n2n1n0}=k+l

o={0o2o1o0}=m+n

Assert the unit clauses {¬o2} and {¬o1}; no need to create a new totalizer!

0

0

PEG PDS DDI

116 of 194

LSU’s Main Problem

The convergence is often too slow

    • The first model might be too far away
    • Finding the next best model might be too slow

116

8/6/2024

PEG PDS DDI

117 of 194

SAT-based Local Search to the Rescue

TORC (Target-Optimal-Rest-Conservative) polarity selection

Alexander Nadel: Anytime Weighted MaxSAT with Improved Polarity Selection and Bit-Vector Optimization. FMCAD 2019: 193-202

    • A non-target variable: TORC sets its polarity to its value in the best model so far
      • Only after the initial SAT invocation is completed
      • In practice, finds the next best model much faster!
    • A target variable: TORC sets its polarity to 0
      • The first model and any subsequent model is closer to the ideal
    • Applied by the state-of-the-art anytime MaxSAT solvers

Polosat: a dedicated SAT-based local search algorithm, invoked instead of SAT (next)

Alexander Nadel: On Optimizing a Generic Function in SAT. FMCAD 2020: 205-213

117

8/6/2024

PEG PDS DDI

118 of 194

Polosat for MaxSAT

Polosat: further simulate local search with CDCL SAT

    • M := SAT(H)
    • Run the following loop until M is not improved anymore
      • Go over all the “bad” target bits (not assigned 0 in any model so far)
        • Flip the current bad target bit t:
          • M’ := SAT(H, {¬t}), but stop after 1000 conflicts! (¬t is an assumption)
        • If (satisfiable and M’ improves M) M := M’
    • Always apply TORC: fix targets to 0 and non-targets to the best model so far

118

8/6/2024

Hard Clauses H

  • Satisfiable

Optimization Target T = {tn-1, tn-2 , … , t0}

  • Each target bit ti is a literal (unit clause), associated with an integer weight w(ti) > 0

Output: A model M to H which minimizes the weight of the satisfied target bits ψ = wn-1*tn-1 + … + w1*t1 + … + w0*t0

PEG PDS DDI

119 of 194

Polosat Cont.

Default in state-of-the-art anytime MaxSAT solvers

    • Used by the top 3 solvers in all the 4 anytime categories @ MaxSAT Evaluation 2023

Can be applied to optimize any PB function

Enabler for solving industrial optimization problems at Intel

Recently shown to boost Pseudo-Boolean (PB) Optimization

    • PB Optimization: optimizing an objective function under PB constraints

Markus IserJeremias BergMatti Järvisalo:Oracle-Based Local Search for Pseudo-Boolean Optimization. ECAI 2023: 1124-1131

PEG PDS DDI

120 of 194

Agenda

How does a conflict-driven SAT solver work?

    • The core: backtrack search, Boolean Constraint Propagation (BCP), conflict analysis
    • Follow the first SAT Competition winners (from Chaff till Minisat)

Applying SAT by example

    • Paradigms: incremental SAT solving, SAT-based local search, example encodings
    • Applications: Bounded Model Checking (BMC), proof-based abstraction refinement, bug hunting, anytime MaxSAT

Advanced core SAT algorithms

    • Follow the SAT Competition winners after Minisat & discussion about incremental SAT

120

8/6/2024

PEG PDS DDI

121 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

121

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Glucose

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

abcdSAT

Zheng

He�Chen

Zhou

Li

PEG PDS DDI

122 of 194

RSAT’s Phase Saving

Polarity selection: always choose the latest polarity – aka phase saving

Knot Pipatsrisawat, Adnan Darwiche:A Lightweight Component Caching Scheme for Satisfiability Solvers. SAT 2007: 294-299

122

8/6/2024

a@1

h@5(C5)

f@1(C8)

c@3

¬f@3(C7)

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= ¬c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ h

a@1

b@2

c@3

d@4

e@5

a@1

b@2

C8 = f ∨ ¬a

f@5(C6)

g@3(C1)

C6= ¬e ∨ ¬h ∨ f

g@5(C3)

C7 = ¬f ∨ ¬c ∨ ¬b

c or ¬c?

c@2

PEG PDS DDI

123 of 194

RSAT’s Phase Saving

Polarity selection: always choose the latest polarity – aka phase saving

Knot Pipatsrisawat, Adnan Darwiche:A Lightweight Component Caching Scheme for Satisfiability Solvers. SAT 2007: 294-299

123

8/6/2024

a@1

h@5(C5)

f@1(C8)

¬c@3

¬f@3(C7)

C1= ¬a ∨ f ∨ g

C2= ¬a ∨ f ∨ ¬g

C3= c ∨ ¬f ∨ g

C4= ¬b ∨ ¬f ∨ ¬g

C5= ¬e ∨ h

a@1

b@2

¬c@3

d@4

e@5

a@1

b@2

C8 = f ∨ ¬a

f@5(C6)

g@3(C1)

C6= ¬e ∨ ¬h ∨ f

g@5(C3)

C7 = ¬f ∨ c ∨ ¬b

c or ¬c?

¬c@2

PEG PDS DDI

124 of 194

Phase Saving

Locality principle: refocus on the currently explored subspace

State-of-the-art polarity selection heuristic till 2020!

124

8/6/2024

PEG PDS DDI

125 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

125

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

RSAT

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Glucose

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

126 of 194

CryptoMiniSat

Mate SoosKarsten NohlClaude Castelluccia: Extending SAT Solvers to Cryptographic Problems. SAT 2009: 244-257

Motivation: XOR’s are notoriously difficult

    • Appear frequently in cryptographic problems
    • Pruning doesn’t work for XOR gates

CryptoMiniSat is still under active development!

126

8/6/2024

a ∨ b ∨ ¬q

a ∨ ¬b ∨ q

¬a ∨ b ∨ q

¬a ∨ ¬b ∨ ¬q

a ∨ ¬q

b ∨ ¬q

¬a ∨ ¬b ∨ q

PEG PDS DDI

127 of 194

CryptoMiniSat (as of 2010): Techniques

XOR clauses

    • Identification, separate propagation & watches, binary XORs, Gaussian elimination

Polarity selection:

    • Phase saving + occasional random flipping

Heuristics tuned separately for cryptographic vs. industrial instances

    • based on the percentage of XOR clauses and stability of variable activity

3 techniques presented next (after some preliminary material)

    • On-the-fly subsumption
    • Failed literal probing
    • Hyper-binary resolution

127

8/6/2024

PEG PDS DDI

128 of 194

Conflict Analysis as Resolution

128

8/6/2024

c@2

C4

a@1

b@2

c@2

d@2

e@2

C1=¬b∨c

C2=¬a∨¬c∨d

C3= ¬d∨e

C4=¬a∨¬d∨¬e

C1= ¬b ∨ c

C2= ¬a ∨ ¬c ∨ d

C3= ¬d ∨ e

C4= ¬a ∨ ¬d ∨ ¬e

¬ e@2

d@2

a@1

C4

e@2

C3

C2

b@2

C1

Parent Clause

  • The conflict clause is, in fact, derived by resolution (from the conflict upwards)
  • Rightmost cut in the graph = resolution over the conflicting variable
  • The cut goes one step leftwards = resolution goes one step upwards

PEG PDS DDI

129 of 194

Conflict Analysis as Resolution

129

8/6/2024

c@2

C4

a@1

b@2

c@2

d@2

e@2

¬a∨¬d

C1=¬b∨c

C3= ¬d∨e

C4=¬a∨¬d∨¬e

C1= ¬b ∨ c

C2= ¬a ∨ ¬c ∨ d

C3= ¬d ∨ e

C4= ¬a ∨ ¬d ∨ ¬e

¬ e@2

d@2

a@1

C4

e@2

C3

C2

b@2

C1

C2=¬a∨¬c∨d

  • The conflict clause is, in fact, derived by resolution (from the conflict upwards)
  • Rightmost cut in the graph = resolution over the conflicting variable
  • The cut goes one step leftwards = resolution goes one step upwards

PEG PDS DDI

130 of 194

Conflict Analysis as Resolution

130

8/6/2024

c@2

C4

a@1

b@2

c@2

d@2

e@2

¬a∨¬c

¬a∨¬d

C1=¬b∨c

C3= ¬d∨e

C4=¬a∨¬d∨¬e

C1= ¬b ∨ c

C2= ¬a ∨ ¬c ∨ d

C3= ¬d ∨ e

C4= ¬a ∨ ¬d ∨ ¬e

¬ e@2

d@2

a@1

C4

e@2

C3

C2

b@2

C1

C2=¬a∨¬c∨d

  • The conflict clause is, in fact, derived by resolution (from the conflict upwards)
  • Rightmost cut in the graph = resolution over the conflicting variable
  • The cut goes one step leftwards = resolution goes one step upwards

PEG PDS DDI

131 of 194

Conflict Analysis as Resolution

131

8/11/2024

c@2

C4

a@1

b@2

c@2

d@2

e@2

¬a∨¬b

¬a∨¬c

¬a∨¬d

C1=¬b∨c

C3= ¬d∨e

C4=¬a∨¬d∨¬e

C1= ¬b ∨ c

C2= ¬a ∨ ¬c ∨ d

C3= ¬d ∨ e

C4= ¬a ∨ ¬d ∨ ¬e

¬ e@2

d@2

a@1

C4

e@2

C3

C2

b@2

C1

C2=¬a∨¬c∨d

  • The conflict clause is, in fact, derived by resolution (from the conflict upwards)
  • Rightmost cut in the graph = resolution over the conflicting variable
  • The cut goes one step leftwards = resolution goes one step upwards

PEG PDS DDI

132 of 194

Conflict Analysis as Resolution

132

8/11/2024

c@2

C4

a@1

b@2

c@2

d@2

e@2

¬a∨¬b

¬a∨¬c

¬a∨¬d

C1=¬b∨c

C3= ¬d∨e

C4=¬a∨¬d∨¬e

C1= ¬b ∨ c

C2= ¬a ∨ ¬c ∨ d

C3= ¬d ∨ e

C4= ¬a ∨ ¬d ∨ ¬e

¬ e@2

d@2

a@1

C4

e@2

C3

C2

b@2

C1

C2=¬a∨¬c∨d

  • Variable not in the implication graph?

C0= ¬b ∨ f

f@2

C0=¬b∨f

PEG PDS DDI

133 of 194

Conflict Analysis as Resolution

133

8/11/2024

c@2

C4

a@1

b@2

c@2

d@2

e@2

¬a∨¬b

¬a∨¬c

¬a∨¬d

C1=¬b∨c

C3= ¬d∨e

C4=¬a∨¬d∨¬e

C1= ¬b ∨ c

C2= ¬a ∨ ¬c ∨ d

C3= ¬d ∨ e

C4= ¬a ∨ ¬d ∨ ¬e

¬ e@2

d@2

a@1

C4

e@2

C3

C2

b@2

C1

C2=¬a∨¬c∨d

  • Variable not in the implication graph = not part of the resolvent 🡪 skip over, don’t change the resolvent & continue!

C0= ¬b ∨ f

f@2

¬a∨¬b

C0=¬b∨f

PEG PDS DDI

134 of 194

On-the-fly Subsumption

The idea: if an intermediate resolvent R subsumes clause C 🡪 replace C by R

Youssef Hamadi, Saïd Jabbour, Lakhdar Sais: Learning for Dynamic Subsumption. Int. J. Artif. Intell. Tools 19(4): 511-529 (2010)

HyoJung Han, Fabio Somenzi: On-the-Fly Clause Improvement. SAT 2009: 209-222

Applied by CryptoMinisat, Kissat, CaDiCaL, IntelSAT

134

8/6/2024

PEG PDS DDI

135 of 194

On-the-fly Subsumption Example

135

8/6/2024

c@2

C4

a@1

b@2

c@2

d@2

e@2

¬a∨¬b

¬a∨¬c

¬a∨¬d

C1=¬b∨c

C3= ¬d∨e

C4=¬a∨¬d∨¬e

C1= ¬b ∨ c

C2= ¬a ∨ ¬c ∨ d

C3= ¬d ∨ e

C4= ¬a ∨ ¬d ∨ ¬e

¬ e@2

d@2

a@1

C4

e@2

C3

C2

b@2

C1

C2=¬a∨¬c∨d

Subsumes C4!

Subsumes C2!

C4′= ¬a ∨ ¬d

C2′= ¬a ∨ ¬c

No subsumption

PEG PDS DDI

136 of 194

Failed Literal Probing: the Basics

Chu Min Li, Anbulagan: Heuristics Based on Unit Propagation for Satisfiability Problems. IJCAI (1) 1997: 366-371

Daniel Le Berre: Exploiting the real power of unit propagation lookahead. Electron. Notes Discret. Math. 9: 59-80 (2001)

An inprocessing technique orthogonal to the backtrack search

    • Used by CryptoMinisat, Kissat, CaDiCaL

Carried out at the beginning or after a restart

For every variable v

    • Assign v and BCP
      • If contradiction, add the unit clause (¬v) and continue to the next loop iteration
    • Assign ¬v and BCP
      • If contradiction, add the unit clause (v) and continue to the next loop iteration
    • For every literal l, implied by both v and ¬v, learn the unit clause (l)

136

8/11/2024

PEG PDS DDI

137 of 194

Hyper-Binary Resolution

Fahiem Bacchus: Enhancing Davis Putnam with Extended Binary Clause Reasoning. AAAI/IAAI 2002: 613-619

Fahiem Bacchus, Jonathan Winter: Effective Preprocessing with Hyper-Resolution and Equality Reduction. SAT 2003: 341-355

Inês Lynce, João P. Marques Silva: Probing-Based Preprocessing Techniques for Propositional Satisfiability. ICTAI 2003

�Hyper-binary resolution

Used during preprocessing (CryptoMinisat, Kissat)

    • By manipulating the binary implication graph
      • A graph in which the edges correspond to binary clauses
      • Also handy to derive and merge equivalent literals

137

8/6/2024

l1 ∨ l2 ∨ l3∨ … ∨ ln

¬l1 ∨ l

¬l2 ∨ l

¬ln-1 ∨ l

ln ∨ l

PEG PDS DDI

138 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

138

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

139 of 194

Glucose

Gilles Audemard, Laurent Simon: On the Glucose SAT Solver. Int. J. Artif. Intell. Tools 27(1): 1840001:1-1840001:25 (2018)

A well-known and widely used solver

    • Derived from Minisat
    • Still in use in many incremental applications

Introduced the Literal Block Distance (LBD) measure for clause quality

LBD-based clause deletion and restart strategies

Changes in VSIDS implementation

Binary resolution during conflict analysis

139

8/6/2024

PEG PDS DDI

140 of 194

Glucose’s Literal Block Distance (LBD)

What makes a conflict clause a good one?

LBD: the number of decision levels in the clause

    • Variables are propagated together: related and likely to be propagated together again

Recall: Locality

    • Focus the search on the relevant data
    • Learn strong clauses from the local context

LBD is:

    • calculated when the conflict clause is created
    • updated when a clause is visited during conflict analysis
    • widely used by modern solvers

140

8/6/2024

PEG PDS DDI

141 of 194

Glucose: LBD-based Clause Deletion

Delete half of the clauses based on LBD score

    • Ties are broken, based on activity
    • The deletion occurs every 2000 + 300 * x conflicts, where x is the number of clause deletions so far
    • Deletion is postponed, if the clauses are “too good”
      • Median LBD ≤ 3 🡪 postponed by 1,000 conflicts
      • Highest LBD ≤ 5 🡪 postponed by 1,000 conflicts

Exceptions

    • Glue clauses are kept forever
      • Glue clause: a clause with LBD=2
    • Whenever the LBD goes down, the clause is kept for one more round
    • Keep parent clauses (for correctness)
      • Glucose removes clauses not necessarily at decision level 0

141

8/6/2024

PEG PDS DDI

142 of 194

Glucose: LBD-based Restart Strategy

Intuition: restart, when the latest clauses are bad (their LBD is too high)

When to restart:

    • C: current LBD average over the latest 50 conflicts (since Glucose 2.1)
    • G: global LBD average
    • Restart when C * 0.8 > G
      • 0.8: since Glucose 2.1

Too aggressive:

    • Yields restarts every 50 conflicts
    • Might be performed too close to a satisfying assignment

Postpone restart when the number of assigned literals grows suddenly

    • AC: current average of assigned literals when a conflict occurs (over the latest 5000 conflicts)
    • AG: global average of assigned literals when a conflict occurs
    • Postpone when 1.4 * AC > AG

142

8/6/2024

PEG PDS DDI

143 of 194

VSIDS in Glucose

VSIDS increments activity by an exponentially increasing (g=1/f)#conflict

    • Minisat: f=0.95 🡪 g≈1.05

Since Glucose 2.3

    • every 5000th conflict, f is increased by 0.01, starting at 0.8 until 0.95 is reached

More dynamic at the beginning of the search, stabilizes later

143

8/6/2024

PEG PDS DDI

144 of 194

Binary Resolution during Conflict Analysis

The idea: given a learnt clause C, remove unnecessary literals from C by resolution with satisfied (non-parent!) binary clauses

144

8/6/2024

Gilles Audemard, Jean-Marie Lagniez, Bertrand Mazure, Lakhdar Sais: RCL: Reduce learnt clauses. https://baldur.iti.kit.edu/sat-race-2010/descriptions/solver_10.pdf, 2010

PEG PDS DDI

145 of 194

Binary Resolution Example

145

8/6/2024

C1= ¬a ∨ b

C2= ¬a ∨ ¬b ∨ c

C3= ¬b ∨ ¬c ∨ ¬d ∨ e

C4= ¬b ∨ ¬c ∨ ¬d ∨ ¬e

a@1

b@1

1UIP

C6 = ¬b ∨ ¬c ∨ ¬d

c@1

d@2

e@2

¬ e@2

a@1

b@1

c@1

d@2

C5= b ∨ ¬c

C7 = ¬c ∨ ¬d

  • Minimization is unapplicable
  • Binary resolution with C5 works!
    • C5 is a satisfied non-parent clause
  • The implementation goes over binary watches of C’s literals

PEG PDS DDI

146 of 194

Binary Resolution Heuristic

Applied for newly learnt clauses for which both the following conditions hold:

    • Maximal size of 30
    • Maximal LBD of 6

Standard since Glucose

146

8/6/2024

PEG PDS DDI

147 of 194

Glucose in Non-Incremental Mode

Preprocess() // Variable elimination & subsumption & self-subsuming resolution

While (true)

    • Literal l = Decide() // Updated variable-based EVSIDS
    • BCP(l)
    • If (conflict)
      • ConflictAnalysisLoop() // Minimized 1UIP + binary resolution
    • If (learned an empty clause)
      • Return UNSAT
    • If (all the variables are assigned)
      • Return SAT
    • Occasionally, restart // LBD-based
    • Occasionally, delete conflict clauses // LBD-based

147

8/6/2024

PEG PDS DDI

148 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

148

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

149 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

149

8/11/2024

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat (SatELiteGTI)

CryptoMiniSat

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

COMiniSatPS

Oh

MiniSat-based:

Others:

RSAT

Glucose

Glucose

abcdSAT

abcdSAT

PEG PDS DDI

150 of 194

COMiniSatPS

Chanseok Oh: Between SAT and UNSAT: The Fundamental Difference in CDCL SAT. SAT 2015: 307-323��UNSAT Instance

    • A proof is required
      • Strong conflict clauses are essential
    • Refocus on locally useful variables & clauses to learn stronger clauses 🡪
    • Aggressive restart strategy and VSIDS score update

SAT Instance

    • Can be solved instantly with a perfect oracle
      • Less need for conflict clauses in practice (demonstrated experimentally)
    • Let the solver complete finding a potential model 🡪
    • Slow restart strategy and VSIDS score update

COMiniSatPS: combining SAT & UNSAT stages in every (long enough) solver invocation

Clause deletion: 3-tiered scheme

150

8/6/2024

PEG PDS DDI

151 of 194

COMiniSatPS: Combining SAT & UNSAT Stages

UNSAT stage warm-up: 10,000 initial conflicts

C = 100

While (no solution)

    • SAT stage: C conflicts
    • UNSAT stage: 2*C conflicts
    • C = C*1.1

151

8/6/2024

SAT Stage

UNSAT Stage

Restarts

No-restart

Glucose

VSIDS Score Increment

(g=1/0.999)#conflict

(g=1/0.95)#conflict

PEG PDS DDI

152 of 194

COMiniSatPS: 3-Tiered Clause Management & Deletion

Core: kept forever

    • LBD ≤ 3 (at creation or during conflict analysis)
    • LBD threshold goes up to 5, if at 100,000 conflicts, there are <100 Core clauses

Tier2: bad clauses are relegated to Local

    • 3 < LBD ≤ 6 (at creation or during conflict analysis)
    • Every 10,000 conflicts, clauses not touched for 30,000 conflicts are relegated

Local: bad clauses are deleted

    • LBD > 6 (at creation)
    • Every 15,000 conflicts, the less active half of the clauses is deleted

152

8/6/2024

PEG PDS DDI

153 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

153

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

Maple�COMSPS

PEG PDS DDI

154 of 194

Learning Rate Based (LRB) Decision Heuristic

Jia Hui Liang, Vijay Ganesh , Pascal PoupartKrzysztof Czarnecki:�Learning Rate Based Branching Heuristic for SAT Solvers. SAT 2016: 123-140

Similarly to VSIDS, choose and pick variables, based on activity

Boost variables, which made impact during their latest assignment term

154

8/6/2024

PEG PDS DDI

155 of 194

Learning Rate Based (LRB)

155

8/6/2024

v

Just before unassigning v

C[v]: #conflicts in which v’s score was updated during the latest assignment term

Visited during conflict analysis or belongs to the parents of literals in the new conflict clause

age[v]: the number of conflicts during the latest assignment term

LR[v]: age[v] / C[v]

PEG PDS DDI

156 of 194

LRB Details

When a variable is unassigned, adjust its activity, based on LR[v]

    • const double oldActivity ← activity[var];
    • activity[var] ← P * LR[var] + (1 - P) * oldActivity;
    • P: from 0.4 down to 0.06, decremented by 0.000001 every conflict when LRB is used
      • Down to 0.06 after 340,000 conflicts when LRB is used

The update algorithm uses Exponential Recency Weighted Average (ERWA)

    • used in nonstationary Multi-Armed Bandit (MAB) problems to estimate the average reward of different actions

Sutton, R. S., and Barto, A. G.: Reinforcement learning: An introduction, volume 1. MIT press Cambridge, 1998.

Summary: LRB considers the “local context” of the latest assignment term, more so in the beginning of the search

156

8/6/2024

PEG PDS DDI

157 of 194

MapleCOMSPS: Combining SAT & UNSAT Stages

  1. UNSAT stage warm-up: 10,000 initial conflicts
  2. SAT stage till 2,500 sec. from the beginning
  3. UNSAT stage forever

157

8/6/2024

SAT Stage

UNSAT Stage

Restarts

Luby

Glucose

Decision Heuristic

LRB

Glucose’s EVSIDS (0.8🡪0.95)

PEG PDS DDI

158 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

158

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

159 of 194

MapleLCMDist

DISTANCE decision heuristic for the initial stage (first 50,000 conflicts)

Fan Xiao, Chu-Min Li, Mao Luo, Felip Manyà, Zhipeng Lü, Yu Li: A branching heuristic for SAT solvers based on complete implication graphs. Sci. China Inf. Sci. 62(7): 72103:1-72103:13 (2019)

Vivification aka distillation aka learnt-clause-minimization

    • Cédric Piette, Youssef Hamadi, Lakhdar Sais: Vivifying Propositional Clausal Formulae. ECAI 2008: 525-529
    • HyoJung Han, Fabio Somenzi: Alembic: An Efficient Algorithm for CNF Preprocessing. DAC 2007: 582-587
    • Mao Luo, Chu-Min Li, Fan Xiao, Felip Manyà, Zhipeng Lü: An Effective Learnt Clause Minimization Approach for CDCL SAT Solvers. IJCAI 2017: 703-711
    • Chu-Min Li, Fan Xiao, Mao Luo, Felip Manyà, Zhipeng Lü, Yu Li: Clause vivification by unit propagation in CDCL SAT solvers. Artif. Intell. 279 (2020)

159

8/6/2024

PEG PDS DDI

160 of 194

DISTANCE Decision Heuristic

Observation: at the beginning, variable scores are inaccurate, because they are based on very few conflicts

DISTANCE Heuristic:

    • Yet another separate “activity” priority queue, used for the first 50,000 conflicts
    • Increment v’s activity, depending on the longest distance between v and the conflict
      • The closer v to the conflict, the more v contributes

160

8/6/2024

PEG PDS DDI

161 of 194

DISTANCE: Longest Distance to Conflict

161

8/6/2024

PEG PDS DDI

162 of 194

DISTANCE: Details

distAct[v] is the DISTANCE activity, initialized to 0 for every v

longDist[v]: the longest distance to the conflict for the current conflict

When v contributes to a conflict, distAct[v] is incremented by inc×1/longDist[v]

    • inc: give more weight to recent conflicts
    • Start: inc ← 1
    • After each conflict: inc ← inc / 0.95

162

8/6/2024

PEG PDS DDI

163 of 194

Vivification: an Inprocessing Algorithms

At decision level 0 (inprocessing), go over the clauses and simplify them as follows:

Let C = c1 ∨ c2 ∨ … ∨ cn be a clause

For i in [1,2,…n]

    • If ci is assigned 0, remove ci from C and continue to the next loop iteration
      • ¬c1 ∧ … ∧ ¬ci-1 ⇒ ¬ci ≅ c1 ∨ … ∨ ci-1 ∨ ¬ci
      • Resolve C with c1 ∨ … ∨ ci-1 ∨ ¬ci
    • If ci is assigned 1, replace C by c1 ∨ … ∨ ci-1 ∨ ci and stop
      • ¬c1 ∧ … ∧ ¬ci-1 ⇒ ci ≅ c1 ∨ … ∨ ci-1 ∨ ci
      • c1 ∨ … ∨ ci-1 ∨ ci subsumes C
    • Assign the literal ¬ci
    • Run BCP

163

8/6/2024

PEG PDS DDI

164 of 194

Controlling Vivification in MapleLCMDist

  • Vivify only the learnt clauses
  • When to apply vivification?
    • Immediately after each clause database reduction
      • #clauses: 2000 + 2 × 300 × database-reductions-so-far
  • When to vivify clause C?
    • C has not yet been vivified, and
    • C is a learnt with a small LBD: consider only half of the learnt’s, sorted by LBDs
  • What is the best literal order in literal C
    • Default (as maintained by the solver)
      • More active literals come earlier because of WL management

164

8/6/2024

PEG PDS DDI

165 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

165

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

166 of 194

Up-to-date Conflict Analysis Algorithm �Covers GRASP & Chaff & Modern Solvers

  1. Backtrack before conflict analysis: backtrack to the conflict level δ, if required
    • Required in GRASP and called Non-Chronological Backtracking (NCB) in GRASP
    • Not required in Chaff: current decision level ≡ conflict level
  2. Learn an asserting clause C=[c1, c2@β<δ, c3@@≤β, …, ci@@≤β, …, c|C|@≤β]
    • 1UIP clause in both GRASP & Chaff
  3. Optionally, learn other clauses
    • GRASP: a clause for every other UIP of the conflict decision level
  4. Backtrack: backtrack to a level in [β, β+1, …, δ-1] -- makes the asserting clause unit
    • GRASP -- always δ-1: Chronological Backtracking (CB) in today’s terminology
    • Chaff -- always β: Non-Chronological Backtracking (NCB) in today’s terminology
  5. Flip c1 by implying it in C and run BCP

166

8/6/2024

PEG PDS DDI

167 of 194

Conflict Analysis Evolvement

Maple_LCM_Dist_ChronoBT: the return of Chronological Backtracking (CB)

Alexander Nadel, Vadim Ryvchin: Chronological Backtracking. SAT 2018: 111-121

    • A backtracking heuristic choosing between CB and NCB
      • First 4,000 conflicts (warm-up): NCB
      • After 4,000 conflicts: NCB iff backtrack level - conflict level ≤ 100
      • Today: Maple-based solvers & Cryptominisat & Kissat (no warm-up in Kissat)
        • CaDiCal & IntelSAT also combine NCB & CB, but differently
    • CB algorithm is similar to GRASP’s
    • Integrating CB with post-GRASP BCP data structures turned out to be highly non-trivial
      • Because of simultaneous propagation at several levels
      • BCP must be adjusted to prevent correctness & performance issues
      • Useful BCP invariants are still violated!

167

8/6/2024

1996

GRASP

2001

Chaff

2018

Maple_LCM_Dist_ChronoBT

Chaff’s algorithm is the state-of-the-art

PEG PDS DDI

168 of 194

Integrating CB and BCP

Example of a necessary adjustment

    • ¬c1 and ¬c2 are assigned @1 🡪 the clause is visited by BCP twice
      • Impossible with NCB, where the assigned level is always ≥ max_level(C)
    • Need to swap literals to have two highest literals watched
    • Essential for correctness – in order not to miss conflicts after backtracking!

Useful invariants are still violated even with the adjustments:

    • lowest implication: no assigned literal can be implied at a lower level
    • lowest conflict: every conflict, BCP returns a clause �falsified at the lowest possible level

Intel® SAT Solver (IntelSAT): a new formally proven BCP alg. with a possible solution

Alexander Nadel: Introducing Intel® SAT Solver. SAT 2022.

As of 2022: expecting new formal frameworks and empirical insights!

168

8/6/2024

@30

c2

@20

c1

@30

@1

@20

@1

@1

@20

@1

@30

Falsified literal:

Unassigned literal:

@10

@20

@10

Satisfied literal:

@1

@30

@1

@30

@1

@20

@1

@20

SAT’2024: Robin CoutelierMathias Fleury and Laura Kovács Lazy Reimplication in Chronological Backtracking (abstract)

PEG PDS DDI

169 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

169

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

Maple�LCMDist�ChronoBTDLv3

abcdSAT

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Zheng

He�Chen

Zhou

Li

Haberlandt

Green

PEG PDS DDI

170 of 194

MapleLCMDistChronoBTDLv3�

Duplicate Learnts: screen learnt clauses and add duplicates as permanent clauses

Stepan Kochemazov, Oleg Zaikin, Alexander A. Semenov, Victor Kondratiev: Speeding Up CDCL Inference with Duplicate Learnt Clauses. ECAI 2020: 339-346

170

8/6/2024

PEG PDS DDI

171 of 194

Duplicate Learnts (DL)

Uses clause hash table

Hashes learnts with LBD(C) ≤ lbd_limit=12

Repeated once or twice 🡪 Tier2; Repeated 3-times 🡪 Core forever

Hash size limit = 500,000. When the limit is reached:

    • Purge all clauses repeated once
    • Increase the limit by 10%

DL works well with vivification

    • Vivification may reduce the LBD score of clauses to make them eligible for DL

171

8/6/2024

PEG PDS DDI

172 of 194

MapleLCMDistChronoBTDLv3

Preprocess() // Variable elimination & subsumption & self-subsuming resolution

While (true)

    • Literal l = Decide() // DISTANCE: 50,000 conf. 🡪 LRB: 2,500 sec. from start 🡪 EVSIDS
    • BCP(l)
    • If (conflict)
      • ConflictAnalysisLoop() // minimized 1UIP + binary resolution; Combine CB & NCB
    • If (learned an empty clause)
      • Return UNSAT
    • If (all the variables are assigned)
      • Return SAT
    • Occasionally, restart // Luby: 2,500 sec. from start 🡪 LBD-based
    • Occasionally, delete conflict clauses // 3-tiered LBD-based
    • Occasionally, inprocess // vivification + restore duplicates

172

8/6/2024

PEG PDS DDI

173 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

174 of 194

Kissat vs. Maple-based Solvers

Variable decision heuristic: VMTF for the UNSAT stage

    • Variable-Move-To-Front (VMTF): store variables in a conflict-driven stack and pick the top-most variable from there��L. Ryan: Efficient algorithms for clause-learning SAT solvers. Masters thesis, Simon Fraser University, February 2004

Advanced inprocessing

    • Vivification: the only technique available also in Maple
    • Failed literal probing and hyper-binary resolution (removed in 2022)
    • Bounded variable elimination, equivalent literal substitution, blocked clause elimination, bounded variable addition, …

Armin Biere, Matti JärvisaloBenjamin Kiesl: Preprocessing in SAT Solving. Handbook of Satisfiability 2021: 391-435

Low-level optimizations, not present in Maple

    • Binary clauses are fully inlined
    • Watch lists are contained in a contiguous buffer (requires occasional defragmentation)

New polarity selection algorithm: local search & target phases

    • Subsequent slides: skipping today, tune in for Armin’s tutorial tomorrow!

174

8/6/2024

PEG PDS DDI

175 of 194

Local Search For SAT (example adapted from [Tompkins 2010])

175

8/6/2024

Randomly initialize all variables

While (formula not satisfied)

Select a variable and “flip” it

a

b

c

d

e

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

[Tompkins 2010] Dave A. D. Tompkins. Dynamic Local Search for SAT: Design, Insights and Analysis. PhD Thesis, University of British Columbia, October 2010.

PEG PDS DDI

176 of 194

Local Search For SAT (example adapted from [Tompkins 2010])

176

8/6/2024

Randomly initialize all variables

While (formula not satisfied)

Select a variable and “flip” it

a

b

c

d

e

1

0

0

1

1

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

PEG PDS DDI

177 of 194

Local Search For SAT (example adapted from [Tompkins 2010])

177

8/6/2024

Randomly initialize all variables

While (formula not satisfied)

Select a variable and “flip” it

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

a

b

c

d

e

1

0

0

1

1

1

0

0

0

1

PEG PDS DDI

178 of 194

Local Search For SAT (example adapted from [Tompkins 2010])

178

8/6/2024

Randomly initialize all variables

While (formula not satisfied)

Select a variable and “flip” it

a

b

c

d

e

1

0

0

1

1

1

0

0

0

1

1

1

0

0

1

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

PEG PDS DDI

179 of 194

Local Search For SAT (example adapted from [Tompkins 2010])

179

8/6/2024

Randomly initialize all variables

While (formula not satisfied)

Select a variable and “flip” it

a

b

c

d

e

1

0

0

1

1

1

0

0

0

1

1

1

0

0

1

0

1

0

0

1

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

PEG PDS DDI

180 of 194

Local Search For SAT (example adapted from [Tompkins 2010])

180

8/6/2024

Randomly initialize all variables

While (formula not satisfied)

Select a variable and “flip” it

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

(¬a + b + ¬e) (¬a + ¬b + d) (¬d + ¬e) (¬a + b + c + ¬d)

a

b

c

d

e

1

0

0

1

1

1

0

0

0

1

Selecting a variable:

make = # of clauses that become satisfied if x is flipped

break = # of clauses that become unsatisfied if x is flipped

GSAT

score = makebreak

B. Selman, H. Levesque, D. Mitchell: A new method for solving hard satisfiability problems. In Proceedings of the Tenth National Conference on Artificial Intelligence (AAAI'92), pages 440–446.

PEG PDS DDI

181 of 194

Escaping Local Minima (figure from [Tompkins 2010])

181

8/6/2024

Local minimum: no variable with a positive score

Escaping local minima

GSAT: restarting

WalkSAT: applying random steps (and restarting)

Bart Selman, Henry Kautz, Bram Cohen: Noise strategies for local search. Proceedings AAAI-94, Seattle, WA, USA 1994.

More about local search:

Henry A. Kautz, Ashish Sabharwal, Bart Selman:�Incomplete Algorithms. Handbook of Satisfiability 2021: 213-232

PEG PDS DDI

182 of 194

Kissat’s Target Phases�

Reminder: phase saving (since RSAT, 2006) for polarity selection

    • Always start with the latest polarity

Target phases

Armin Biere, Mathias Fleury: Chasing Target Phases, POS’20

    • In an arithmetic increasing interval in the number of conflicts, use either:
      • the original phase
      • its inverted value
      • current phase flipped
      • random phase
      • the best phase: phase in the longest trail so far
      • target phase: use local search to find phases which minimize #falsified clauses
        • Starting from the current saved phases
    • Different strategy for SAT / UNSAT phases
    • Implemented in CaDiCal since 2019, migrated to Kissat

182

8/6/2024

PEG PDS DDI

183 of 194

Integrating Local Search (LS) into CDCL

Shaowei Cai, Xindi Zhang: Deep Cooperation of CDCL and Local Search for SAT. SAT 2021: 64-81

Explore promising branches by local search

    • Allow some promising branches to be extended to a complete assignment without backtracking, even if conflicts are encountered.
    • Call an LS solver to find a model nearby

Phase selection with local search assignments

    • Same idea as target phase

LS-driven variable activity (score) boost

    • Based on conflict frequency in LS
    • Applied for both VSIDS and LRB activities

Outperforms CDCL & LS portfolio

Best paper award at SAT’21

lstech_maple solver: 2nd in SC’21, SAT category

183

8/6/2024

PEG PDS DDI

184 of 194

Combining Local Search into CDCL SAT: Journal Paper

Shaowei Cai, Xindi Zhang, Mathias Fleury, Armin Biere: Better Decision Heuristics in CDCL through Local Search and Target Phases, Journal of Artificial Intelligence Research 74 (2022) 1515-1563

184

8/6/2024

PEG PDS DDI

185 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

185

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

186 of 194

KissatMAB

The change is in the decision heuristic

Every restart, the solver chooses between:

    • VSIDS
    • CHB: predecessor of LRB

Using Multi-Armed Bandit (MAB) framework

Reward function: “we choose a reward function that estimates the ability of a heuristic to reach conflicts quickly and efficiently.

The reward function to maximize: log2(decisions) / dVars

  1. decisions : the number of decisions
  2. dVars: the number of variables used as decision variables at least once

As many decisions as possible over the same variables 🡪 locality principle!

186

8/6/2024

PEG PDS DDI

187 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

187

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

188 of 194

KissatMAB-HyWalk�

The change is in the local search component

Combines BandSAT, FPS, and some other local search algorithms with different random walking or say local optimal escaping strategies

188

8/6/2024

PEG PDS DDI

189 of 194

SAT Competition & Race Winners (CNF & Appl. & Seq. & Non-incr. & All-inst.)

189

2002

zChaff

2003

Forklift

2004

zChaff

2005

SatELiteGTI

Armin Biere’s& derived:

2006

2007

MiniSat

MiniSat

2008

Precosat

2009

2010

CryptoMiniSat

2011

Glucose

2012

2013

2014

2015

2016

2017

2018

2019

2020

2021

Lingeling

Lingeling

Maple�COMSPS

Maple�LCMDist

Maple�LCMDist�ChronoBT

Maple�LCMDist�ChronoBTDLv3

Kissat

KissatMAB

Moskewicz

Madigan

Zhao

Zhang

Malik

Goldberg

Novikov

Moskewicz

Madigan

Zhao

Zhang

Malik

Eén

Sörensson

Eén

Sörensson

Pipatsrisawat

Darwiche

Eén

Sörensson

Biere

Soos

Audemard

Simon

Audemard

Simon

Biere

Biere

Chen

Liang

Oh

Ganesh

Czarnecki

Poupart

Xiao

Luo

Li

Manya

Lu

Nadel

Ryvchin

Kochemazov

Zaikin

Kondratiev

Semenov

Biere

Fazekas

Fleury

Heisinger

Cherif

Habet

Terrioux

MiniSat-based:

Others:

RSAT

Glucose

2022

2023

KissatMAB-HyWalk

SBVA-CaDiCaL

Haberlandt

Green

Zheng

He�Chen

Zhou

Li

abcdSAT

PEG PDS DDI

190 of 194

CaDiCaL and SBVA-CaDiCaL�

CaDiCaL

    • An incremental SAT solver
    • Around since 2017
    • 64-bit clause indexing
      • Allows one to handle huge instances, but increases the memory footprint
    • First open-source solver with incremental preprocessing (since 2019)

Katalin Fazekas, Armin Biere, Christoph Scholl: Incremental Inprocessing in SAT Solving. SAT 2019: 136-154

      • We have a closed-sourced solver Fiver with incremental preprocessing (since 2012)

Alexander Nadel, Vadim RyvchinOfer Strichman: Preprocessing in Incremental SAT. SAT 2012: 256-269

      • Fiver supports SatELite, whereas CaDiCaL supports more techniques
    • Details: CaDiCaL 2.0 Armin Biere, Tobias Faller, Katalin Fazekas, Mathias Fleury, Nils Froleyks and Florian Pollitt, CAV’24

SBVA-CaDiCaL

    • Smart implementation of Bounded Variable Addition (BVA) inprocessing on top of CaDiCaL�

190

8/6/2024

PEG PDS DDI

191 of 194

Incremental Solvers after Minisat

Glucose

A dedicated feature: ignores assumption literals in LBD calculations

CryptoMinisat

Maple-based SC winners since MapleCOMSPS (SC’16) aren’t incremental, but MergeSAT is: Norbert Manthey: The MergeSat Solver. SAT 2021

SC incremental tracks:

    • 2017 – won by the 2015 SR winner abcdSAT
    • 2020 – won by CryptoMinisat

Kissat isn’t incremental, but CaDiCal is

    • 2024 – CaDiCaL 2.0 shown to outperform CryptoMinisat on SC’20 and some other incremental bench’s

191

8/6/2024

PEG PDS DDI

192 of 194

Incremental Solvers after Minisat: IntelSAT

IntelSAT Alexander Nadel: Introducing Intel(R) SAT Solver. SAT 2022: 8:1-8:23

    • An open-source CDCL solver written from scratch in C++20
    • Optimized towards incremental app’s with rapid mostly SAT queries
      • Triggered by performance needs of industrial optimization problems
    • Application in the paper: anytime unweighted MaxSAT -- improves the state-of-the-art
    • Various applications @ Intel: placement, routing, scheduling, etc.
    • Incremental Lazy Backtracking (ILB):
      • Upon a new incremental query Solve(A), backtrack to the highest possible level, rather than 0
        • Let k be the maximal decision level, whose decision literal appears in A
        • ILB backtracks to k (instead of 0)
      • Implemented in CaDiCaL 2.0
    • Chronological backtracking with reimplication: guarantees lowest implication & lowest conflict

192

8/6/2024

PEG PDS DDI

193 of 194

Is Progress on SC Benchmarks Relevant to Incremental SAT?

Incremental SAT: no progress since 2013 [KIS, SAT’21]

    • Glucose 3.0 (2013) is largely on par with a leading Maple-based solver (2021) on
      • Satisfiability-based MaxSAT: mostly SAT queries
      • Unsatisfiability-based MaxSAT: mostly UNSAT queries
      • Minimal Unsatisfiable Core (MUC) Extraction: mixed queries
    • None of the 5 latest techniques which improve non-incremental SAT has a significant positive impact on incremental SAT

My experience at Intel till 2021: no progress on industrial optimization problems

    • e.g., placement in physical design [CNR, TACAS’21]
    • Triggered IntelSAT development in 2021

CaDiCaL 2.0 CAV’24 paper: progress on a variety of benchmarks, but no results on [KIS, SAT’21] bench’s

My intuitive take (without rigorous empirical evidence) -- it depends on the application:

    • Heavy SAT invocations (e.g., BMC): non-incr. progress is relevant; incremental inprocessing can be helpful
    • Light SAT invocations (e.g., MaxSAT, MUC extraction, PDR): non-incr. progress is less relevant; ILB can be helpful

193

8/6/2024

[CNR, TACAS’21] Aviad Cohen, Alexander Nadel, Vadim Ryvchin: Local Search with a SAT Oracle for Combinatorial Optimization. TACAS (2) 2021: 87-104

[KIS, SAT’21] Stepan Kochemazov, Alexey Ignatiev, João Marques-Silva: Assessing Progress in SAT Solvers Through the Lens of Incremental SAT. SAT 2021: 280-298

PEG PDS DDI

194 of 194

Conclusion

SAT is an unresolved mystery!

Yet, SAT solvers are scalable widely used tools

Main goals for today:

    • Explain how modern SAT solvers work
    • Convey intuition why they work in practice
    • Provide examples of applying SAT

194

8/17/2024

PEG PDS DDI