# Improved static symmetry breaking for SAT

Jo Devriendt, Bart Bogaerts,
Maurice Bruynooghe, Marc  Denecker

University of Leuven / Aalto University

Or: the story of BreakID

## Outline

• What's up with symmetry in SAT?
• Our improvements
• Row interchangeability detection
• Stabilizer chain symmetry breaking
• Efficiency optimizations
• Future ideas for symmetry in SAT

## What's up with symmetry in SAT?

• CNF theory T, literal l, variable x, assignment α

• Symmetry σ: permutation of literals

• commutes with negation        σ(l) = ¬σ(¬l)
• preserves satisfaction    σ(α) ⊨ T iff α ⊨ T
• syntactically fixes T                   σ(T) = T

• Set of symmetries Σ generate a mathematical group <Σ> under (composition)

## What's up with symmetry in SAT?

• E.g. pigeonhole problem

• Set of holes {h2,h2,...,hn}
• Set of pigeons {p1 ,p2,...,pn+1}
• Symmetries σ on pigeons and holes
e.g., swapping h1 and h2

• Symmetry group <Σ> of all permutations on pigeons and/or holes
\forall p \colon \exists h \colon Occupies(p,h)
$\forall p \colon \exists h \colon Occupies(p,h)$
\forall p~p'~h\colon Occupies(p,h) \land Occupies(p',h) \Rightarrow p=p'
$\forall p~p'~h\colon Occupies(p,h) \land Occupies(p',h) \Rightarrow p=p'$
\sigma \colon Occupies(p_i,h_1) \leftrightarrow Occupies(p_i,h_2)
$\sigma \colon Occupies(p_i,h_1) \leftrightarrow Occupies(p_i,h_2)$

### Symmetry detection in SAT

• Saucy [1]
• Convert CNF to colored graph
• Automorphisms are syntactical symmetries
• Result: set Σ of generator symmetries for <Σ>

• Very efficient!

### Symmetry breaking in SAT

• Dynamic symmetry breaking
• Static symmetry breaking

• lex-leader symmetry breaking formula sbf(σ) for σ
• based on variable order

•
• Shatter preprocessor [2]
• Given Σ, construct sbf(σ) for each σ∈Σ
• Linear encoding of sbf(σ) into clauses

### avoid symmetrical parts of the search space

\forall i\colon (\forall j < i \colon x_j \Leftrightarrow \sigma(x_j)) \Rightarrow \neg x_i \vee \sigma(x_i)
$\forall i\colon (\forall j < i \colon x_j \Leftrightarrow \sigma(x_j)) \Rightarrow \neg x_i \vee \sigma(x_i)$
x_0 < x_1 < \ldots < x_n
$x_0 < x_1 < \ldots < x_n$

## What's up with symmetry in SAT?

Let's try Shatter on the pigeonhole problem...

Only 2 more instances solved?

## What's up with symmetry in SAT?

Let's try Shatter on the pigeonhole problem...

Only 2 more instances solved?

• Problem lies with generator symmetries Σ
• <Σ> is not completely broken by conjunction of sbf(σ), σ∈Σ
• For pigeonhole, there does exist some small Σ' for which sbf(σ), σ∈Σ' breaks <Σ> completely

In general, Σ lacks information on structure of group <Σ>

## BreakID tries to exploit symmetry group structure

• Detect row interchangeability symmetry subgroups of <Σ>
• Symmetry breaking based on stabilizer chain of <Σ>
• Small performance optimizations

BreakID: symmetry breaking preprocessor similar to Shatter

## Detecting row interchangeability

• Row interchangeability: common form of symmetry
• Stems from interchangeable objects
• Variables can be ordered as rows in matrix
• All permutations of rows are symmetries
• Can be broken completely by constructing sbf only for consecutive row swaps [3]
• Assuming appropriate variable ordering

## Detecting row interchangeability

 Occupies(p1,h1) Occupies(p1,h2) Occupies(p1,h3) Occupies(p2,h1) Occupies(p2,h2) Occupies(p2,h3) Occupies(p3,h1) Occupies(p3,h2) Occupies(p3,h3) Occupies(p4,h1) Occupies(p4,h2) Occupies(p4,h3)

Variable rows for 4 pigeons, 3 holes:

Symmetry due to interchangeable pigeons completely broken by

sbf(swap(p1,p2)) sbf(swap(p2,p3)) sbf(swap(p3,p4))

## Detecting row interchangeability

• Input: CNF theory T, Σ detected by Saucy
• Output: variable matrix M such that rows are interchangeable and <M>⊆<Σ>
1. extract σ1, σ2 ∈Σ that form 2 subsequent row swaps
• forms initial 3-rowed variable matrix M
2. apply every σ∈Σ to all detected rows r∈M so far
• images σ(r) disjoint of M are candidates to extend M
• test if swap r ↔ σ(r) is a symmetry by syntactical check on T
• if success, extend M with σ(r)
3. use Saucy to extend Σ with new symmetry generators by fixing all variable nodes with variable in M, first row excepted

Let's try BreakID on the pigeonhole problem...

• Detects full pigeon subsymmetry
• Poly performance
• 100+ holes are no problem

## Stabilizer chain symmetry breaking

\forall i\colon (\forall j < i \colon x_j \Leftrightarrow \sigma(x_j)) \Rightarrow \neg x_i \vee \sigma(x_i)
$\forall i\colon (\forall j < i \colon x_j \Leftrightarrow \sigma(x_j)) \Rightarrow \neg x_i \vee \sigma(x_i)$
• Recall sbf(σ):
• for i=0:
• Binary symmetry breaking clause

• x is stabilized by <Σ> iff σ(x)=x for all σ∈<Σ>
• x' ∈ orbit(x) under <Σ> iff there exists σ∈<Σ> s.t. σ(x)=x'

• Given symmetry group <Σ> with smallest non-stabilized variable x, with x' ∈ orbit(x) under <Σ>,
is logical consequence of sbf(σ) for all σ∈<Σ>

• Moreover, all binary clauses in sbf(σ) for all σ∈<Σ> are derived this way [4]
\neg x_0 \vee \sigma(x_0)
$\neg x_0 \vee \sigma(x_0)$
\neg x \vee x'
$\neg x \vee x'$

## Stabilizer chain symmetry breaking

• <Σ> has subgroups that have other smallest non-stabilized variables, depending on variable order
• Create stabilizer chain of <Σ> along variable ordering:

• next subgroup Gi is the stabilizer subgroup stabilizing the next non-stabilized variable in ordering
• Gi have different smallest non-stabilized variables x
• for each i: Orbit(x) under Gi leads to binary symmetry breaking clauses
• Derives all binary symmetry breaking clauses of <Σ> under variable ordering
<\Sigma> = G_0 \supset G_1 \supset \ldots \supset 1
$<\Sigma> = G_0 \supset G_1 \supset \ldots \supset 1$

## Stabilizer chain symmetry breaking

 Occupies(p1,h1) Occupies(p1,h2) Occupies(p1,h3) Occupies(p2,h1) Occupies(p2,h2) Occupies(p2,h3) Occupies(p3,h1) Occupies(p3,h2) Occupies(p3,h3) Occupies(p4,h1) Occupies(p4,h2) Occupies(p4,h3)

Occupies(p1 ,h1) < Occupies(p2 ,h1) < Occupies(p3 ,h1) < Occupies(p4 ,h1) < ...

Stabilizer chain for pigeon symmetry consists of 4 subgroups

G0 permutes rows 1-2-3-4,
G1 permutes rows 2-3-4,
G2 swaps rows 3-4,
G3=1

Binary symmetry breaking clauses:

¬Occupies(p1 ,h1) v Occupies(p2 ,h1)
...
¬Occupies(p3 ,h1) v Occupies(p4 ,h1)

## Further improvements on Shatter

• More compact conversion of sbf to CNF [5]
• 3 clauses of size 3 instead of
4 clauses of sizes 3-4
• Limit the size of sbf to 50
• Limit symmetry detection time of Saucy

BreakID combines row interchangeability detection with stabilizer chain symmetry breaking (approximative)

## Symmetry breaking in SAT competitions?

• BreakID overhead is low enough to be competitive, even on asymmetric instances
• Participated succesfully in SAT13, SAT15 competitions
• Experimental results on SAT14 instances
(Glucose as base solver)

## Summary

• BreakID follows in Shatter's footsteps (after ~10 years!)
• Derive group structure information
• Row interchangeability detection
• Stabilizer chain based symmetry breaking
• Both are approximative algorithms
• Efficiency optimizations ensure competitiveness

## Much work remains...

• Combination with computational algebra should improve group structure detection
• Intertwine with graph automorphism detection?
• Good heuristic for variable ordering

• Dynamic symmetry breaking should outperform static symmetry breaking
• Completeness result on row interchangeability for dynamic symmetry breaking?
• First-order level symmetry detection [6]

## Questions?

[1] Symmetry and Satisfiability: An Update - 2010 - Katebi e.a.
[2] Efficient Symmetry-Breaking for Boolean Satisfiability - 2006 - Aloul e.a.
[3] On the importance of row symmetry - 2014 - Devriendt e.a.
[4] Automatic generation of constraints for partial symmetry breaking - 2011 - Jefferson & Petrie
[5] Symmetry and satisfiability - 2009 - Sakallah
[6] On Local Domain Symmetry for Model Expansion - 2016 - Devriendt e.a. (accepted for ICLP)