# Symmetric explanation learning: Effective dynamic symmetry handling for SAT

Jo Devriendt, Bart Bogaerts,
Maurice Bruynooghe, Marc  Denecker

University of Leuven

## 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 {h1,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 <Σ>

• BreakID [7]
• Find "the right" generators

## Symmetry exploitation in SAT

Two classes of techniques

• Dynamic symmetry exploitation
• Static symmetry exploitation/breaking

## Symmetry exploitation in SAT

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

•
• Shatter and BreakID preprocessors [2,7]
• Given Σ, construct sbf(σ) for each σ∈Σ
• Linear encoding of sbf(σ) into clauses
• Very good results in recent SAT competitions

### static 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)$
x_0 < x_1 < \ldots < x_n
$x_0 < x_1 < \ldots < x_n$

## Symmetry exploitation in SAT

• Takes symmetries into account during search
• Requires dedicated solvers
• SymChaff [3]
• Symmetry propagation for SAT (SP) [4]
• Symmetric Learning Scheme (SLS) [5]
• ...

## Symmetric learning

• Modern SAT solvers learn new clauses during search
• Typically by resolution, but the idea works for any proof system
• Learnt clauses are logical consequences of the theory
• Whenever c is a consequence of T, so is σ(c)
• Why not also learn σ(c)?

## Symmetric learning

• Learning σ(c) for all  σ∈<Σ>:
1. infeasible [6] (simpy too many σ)
2. How to ensure that no duplicate/subsumed clauses are learnt?
• Various algorithms exist that make some choice on which symmetries to apply (SP, SEL)
• None of them performs as well as state-of-the art static symmetry breaking
• We present a novel algorithm in this family: symmetric explanation learning

## Symmetric explanation learning

• Idea: we prefer to learn clauses with a high chance of propagation
• Even better: we prefer to only learn clauses that propagate at least once
• Idea: symmetries typically permute only a fraction of the literals
• Hence, if c is unit, σ(c) has a good chance of being unit as well
• This notion of "interesting" candidate learned clause is dynamic

## Symmetric explanation learning

• Proposal: whenever c propagates, store σ(c) in a separate clause store θ for each σ∈Σ
• Propagation on θ happens with low priority: only if standard unit propagation is at a fixpoint
• Whenever a clause in θ propagates, we learn it (we upgrade it to a "normal" learned clause)
• Whenever we backtrack over the level where c propagated, we remove σ(c) from θ

## SEL: Properties

• Duplicate/subsumed clauses are never learnt
• Combinatorial explosion of learnt clauses is contained by:
• Only considering candidates σ(c) for σ∈Σ (not σ∈<Σ>) and c a learnt clause
• Removing candidates upon backtracking
• Still allows for transitive effects (learning σ(σ'(c)) if σ'(c) propagates at least once)

## SEL: Optimizations

• Standard two-watched literal scheme applied to θ
• Do not store σ(c) if it is satisfied at the time of c's propagation
• Store a simplification of σ(c) in θ:
• Remove all false literals at the time of c's propagation
• Restore original σ(c) if needed

## SEL vs SLS

• SLS: learn σ(c) for each learned clause c and each σ∈Σ
• SLS: possibly learns useless clauses (shows up in experiments)
• SEL: possibly misses useful clauses
• SLS: no (intrinsic) mechanism to avoid duplicates
• SLS: no transitive effects (possibly misses useful clauses)

## SEL vs SP

• SP: similar idea to SEL: heuristic to guarantee that symmetric learnt clause propagates at least once
• SP: based on weak activity
• SP vs SEL: whenever SP learns σ(c), so does SEL (not vice versa)

## Notation

• State:
•   : assignment (list of literals)
•   : decision literals
•   : learned clause store
•   : explanation (maps propagated literals to the clause that propagated them)
•   : symmetrical learned clause store

\langle\alpha,\gamma,\Delta,\mathcal{E},\Theta\rangle
$\langle\alpha,\gamma,\Delta,\mathcal{E},\Theta\rangle$
\alpha
$\alpha$
\gamma
$\gamma$
\Delta
$\Delta$
\mathcal{E}
$\mathcal{E}$
\Theta
$\Theta$

## SEL: Experiments

• Limits:
• 5000s
• 16GB
• Benchmarks
• app14, hard14
• app16, hard16
• highly symmetric instances
• Solvers:
• Glucose 4.0
• Glucose 4.0 + BreakID
• Glucose 4.0 + SEL
• Glucose 4.0 + SP
• Glucose 4.0 + SLS

# If SEL does not outperform static symmetry breaking... Why bother?

## Symmetry exploitation in SAT

Static symmetry breaking:

• Compatible with any solver (simple preprocessing!)
• Discards models a priori

Dynamic symmetry exploitation (SEL):

• Simple idea
• Requires dedicated solvers
• Does not discard models a priori
• Compatible with other inference tasks, such as:
• Model counting
• (partial) MAXSAT
• Optimization
• "Lazy"

## Summary

• We presented the first general-purpose dynamic symmetry exploitation technique +/- on par with static symmetry breaking
• Based on symmetric learning; propagation-directed selection of learnt clauses
• No completeness results yet. Under which conditions on Σ is SEL guaranteed to never visit two symmetrical assignments?

## 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.
[7] Improved Static Symmetry Breaking for SAT - 2016 - Devriendt e.a.

# An open research problem:

## Do 7825 pigeons fit in 7824 holes?

• impossible for SAT solvers
• trivial on the first-order level
\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'$

## 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.
[7] Improved Static Symmetry Breaking for SAT - 2016 - Devriendt e.a.

## (really, this time)

By krr

### SEL

SAT17

• 419
Loading comments...