initial commit
This commit is contained in:
@@ -0,0 +1,76 @@
|
||||
- Most important heuristic, as it can steer the entire solver
|
||||
## Types
|
||||
- Static heuristics (pre-computed once)
|
||||
- Ex.: Natural Order
|
||||
- Dynamic heuristics
|
||||
- Ex.: Dynamic Largest Individual Sum (DLIS) (chose most common variable + phase)
|
||||
- Expensive, needs (full) scanning of (all) clauses
|
||||
- Second order dynamic heuristics
|
||||
- Ex.: VSIDS, ESIDS
|
||||
- Less expensive, good measurement
|
||||
|
||||
# Look-ahead
|
||||
- Instead of scanning static clause counts (DLIS) or scores (VSIDS), actually try each candidate variable
|
||||
- For a candidate $x$: tentatively assign $x$ and separately $\overline x$, run full [propagation (BCP)](Solvers#Boolean Constraint Propagation (BCP)) for each, and measure the effect (# clauses reduced/simplified, # new units)
|
||||
- If one polarity's propagation conflicts -> failed literal -> the other polarity is forced (same primitive as [Variable instantiation](Preprocessing_Inprocessing#Variable instantiation)/[Vivification](Preprocessing_Inprocessing#Vivification / Distillation))
|
||||
- Pick the variable (and often the polarity) that maximizes the combined look-ahead effect of both branches (e.g. product/sum of the two reduction counts, as in march/kcnfs)
|
||||
- Very informative but expensive (full propagation per candidate, both polarities) -> basis of dedicated look-ahead solvers, rather than per-decision use inside CDCL
|
||||
|
||||
# Cut heuristic
|
||||
- Find a variables that 'cuts' the CNF into parts without overlapping variables
|
||||
- Solve parts separately (for all assignments of the cut)
|
||||
- Divide & Conquer approach
|
||||
|
||||
# Horn Form
|
||||
## Definition
|
||||
- A clause is positive if it contains at least 1 positive literal, otherwise it's negative
|
||||
- A Horn clause is a clause with at most one positive literal
|
||||
- A CNF is in Horn Form if all clauses are Horn clauses
|
||||
## Facts
|
||||
- If all clauses in a Horn Form CNF are positive there is a minimal satisfying assignment
|
||||
- This assignment can be found using BCP
|
||||
- The minimal satisfying assignment of the positive part of a Horn Form CNF IFF it is SAT
|
||||
- I.e. if not it is UNSAT
|
||||
## Usefulness/ Heuristic
|
||||
- DP can transform a non Horn from CNF into one by **choosing variables** from clauses with more than one positive literal (non horn clauses) and doing resolution on them.
|
||||
- [BCP](SAT_in_general#Special Case Unit Resolution) runs through a HORN CNF in polynomial time
|
||||
|
||||
|
||||
|
||||
# Variable State Independent Decaying Sum (VSIDS)
|
||||
- Count occurrence of variables in conflict clauses
|
||||
- Priority Queue is updated, and VSIDS is taken from it
|
||||
- Decay/ re-score values after i conflicts (Chaff: $f = 1/2, i = 256$)
|
||||
- multiply all by some $f < 1$
|
||||
- Emphasizes literals contributing to recent conflicts
|
||||
|
||||
#### Additional idea:
|
||||
- Use VSIDS only as secondary heuristic, primarily try to satisfy must recently added clauses
|
||||
## Normalized VSIDS (NVSIDS)
|
||||
- Keep the score between $[0, 1]$
|
||||
- Pick $f = 0.95$ and calculate score like this:
|
||||
`new_score = old_score * f + in_conflict? (1 - f) : 0`
|
||||
- You can defer the re-scoring to later, i.e. only update variables in conflict and then re-score all later on to save time
|
||||
- Can also Bump resolved literals on conflict level, not just learned lits (good for heuristic?!)
|
||||
## Exponential VSIDS (EVSIDS)
|
||||
- Bump by exponential value $g^i = \frac{1}{f}^i$
|
||||
- `new_score = old_score + (1/f)^i`
|
||||
- EVSIDS is just NVSIDS but without scaling
|
||||
$$\frac{f^{-n}}{1-f} \cdot \text{NVSIDS}$$
|
||||
# Decision heuristic Summary table
|
||||
- Old score: s
|
||||
- decay $0 < f < 1$
|
||||
|
||||
| STRATEGY | Bumped | not-bumped | |
|
||||
| -------- | ------------------- | ----------- | -------------------------------------- |
|
||||
| STATIC | $s$ | $s$ | |
|
||||
| INC | $s + 1$ | $s$ | |
|
||||
| SUM | $s + i$ | $s$ | |
|
||||
| VSIDS | $s / 2 + 1$ | $s / 2$ | Only half every so often (every 256) |
|
||||
| NVSIDS | $f \cdot s + (1-f)$ | $f \cdot s$ | |
|
||||
| EVSIDS | $s + f^{-i}$ | $s$ | |
|
||||
| AVG | $(s+i)/2$ | $s$ | average conflict-index decision scheme |
|
||||
| VMTF | $i$ | $s$ | Variable Move to Front |
|
||||
- Turns out AVG (moving average) and EVSIDS are very good
|
||||
## Variable Move to Front
|
||||
- Cheap to implement, aggressive
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
# CNF (Conjunctive Normal Form)
|
||||
- Conjunction of Disjunctions
|
||||
- 'AND' of 'OR's
|
||||
- $(0 \lor 1 \lor -2) \land (0 \lor -5)$
|
||||
# DNF (Disjunctive Normal Form)
|
||||
- Conjunction of Disjunctions
|
||||
- 'AND' of 'OR's
|
||||
- $(15 \land 1 \land -2) \lor (1 \land -5)$
|
||||
- Easy to see if there is a SAT assignment
|
||||
- Is any Clause SAT?
|
||||
- Conversely In CNF finding an UNSAT assignment is easy
|
||||
|
||||
# Variables as Integers
|
||||
- $x, y, z \mapsto 1, 2, 3$
|
||||
- Efficient representation
|
||||
- Can store assignments in an array
|
||||
- Negation $-var$ has a literal meaning in code
|
||||
|
||||
# Encoding Problems to boolean formula
|
||||
- For example $compile:$ `if x then y else z` $\mapsto (x \land y) \lor (\lnot x \land z)$
|
||||
- What do you encode?
|
||||
- Equivalence of two programs?
|
||||
- $compile(A) \cancel\leftrightarrow compile(B)$
|
||||
- Encode this, if its SAT we have a counterexample
|
||||
|
||||
|
||||
# NNF / Negation Normal Form
|
||||
- Mixture of 'AND's and 'OR's
|
||||
- But negation can only be in front of Variables
|
||||
- Can be made easily using De Morgan
|
||||
- Naive transformation from NNF to CNF
|
||||
- by merging via 'OR-distribution'
|
||||
- Merge on: $(a \lor b) \lor (c \land d) \mapsto (a \lor b \lor c) \land (a \lor b \lor d)$
|
||||
- Exponential Fan out
|
||||
|
||||
# Tseitin Transformation
|
||||
- Extract Formula nodes into new variables and create a constraint list
|
||||
- $((a \leftrightarrow b) \land (c \lor \overline{d}))$
|
||||
- $x_1 \leftrightarrow (a \leftrightarrow b)$
|
||||
- $x_2 \leftrightarrow \overline d$
|
||||
- $x_2 \leftrightarrow (c \lor x_2)$
|
||||
- $x_4 \leftrightarrow (x_1 \land x_3)$
|
||||
- Then transform all of them to CNF and conjunct them
|
||||
![[tseitin.png]]
|
||||
- The resulting formula grows linearly in respect to the size of the original formula
|
||||
- Sometimes taking dividing into binary operations is not optimal (xor optimum is 3)
|
||||
|
||||
## Plaisted–Greenbaum (PG)
|
||||
- Only use implication instead of equivalence $\leftrightarrow$
|
||||
- Direction depends on polarity of the subformula's occurrence
|
||||
- Positive polarity: only need $x \rightarrow \varphi$
|
||||
- Negative polarity: only need $\varphi \rightarrow x$
|
||||
- Mixed polarity (e.g. under XOR/biconditional): need both, i.e. full Tseitin $x \leftrightarrow \varphi$
|
||||
- Example $x \leftrightarrow (a \land b)$: positive occurrence needs $(\overline x \lor a) \land (\overline x \lor b)$; negative occurrence needs just $(\overline a \lor \overline b \lor x)$
|
||||
- Positive occurrence: $x$ appears unnegated in $F$, e.g. $F = x \lor c$ (as $a\land b$ becomes true, $F$ can only become 'more satisfied') $\Rightarrow$ only need $x \rightarrow (a \land b)$
|
||||
- Negative occurrence: $x$ appears negated in $F$, e.g. $F = \overline x \lor c$ (mirror case, $F$ becomes 'more satisfied' as $a \land b$ becomes false) $\Rightarrow$ only need $(a \land b) \rightarrow x$
|
||||
@@ -0,0 +1,58 @@
|
||||
# Encoding
|
||||
- Formula -> [CNF](Encoding#CNF (Conjunctive Normal Form)) / [DNF](Encoding#DNF (Disjunctive Normal Form))
|
||||
- Circuit vs Formula
|
||||
- [Tseitin](Encoding#Tseitin Transformation)
|
||||
- Complexities
|
||||
- Benefits
|
||||
- [Proofs](Proofs)
|
||||
# Solving
|
||||
- [CNF](Encoding#CNF (Conjunctive Normal Form))
|
||||
- [What is SAT / UNSAT](SAT_in_general#What is SAT)
|
||||
- Explain meaning for a encoded Circuit ([Encoding Problems to boolean formula](Encoding#Encoding Problems to boolean formula))
|
||||
- Techniques
|
||||
- [DP](Solvers#Davis Putnam Procedure (DP))
|
||||
- [Resolution](SAT_in_general#Resolution)
|
||||
- [DPLL](Solvers#Davis Putnam Logemann Loveland DPLL)
|
||||
- Complexities in Space & Time
|
||||
# [CDCL](Solvers#CDCL)
|
||||
- [Propagation "BCP"](Solvers#Boolean Constraint Propagation (BCP))
|
||||
- [Watch list](<Implementation Details#(Two) Watch scheme>)
|
||||
- [Blocking lit](Implementation Details#Blocking Literal)
|
||||
- Example question: Confluence of conflicts
|
||||
- Answer: Confluent on conflict, not which specific one though
|
||||
- Conflict analysis
|
||||
- [Implication Graph](SAT_in_general#Implication Graph)
|
||||
- [1-UIP, ALL UIP](SAT_in_general#(First) Unique Implication Point (UIP))
|
||||
- Example question: what is smaller? benefits? (see [(First) Unique Implication Point (UIP)](SAT_in_general#(First) Unique Implication Point (UIP)))
|
||||
- [minimization](SAT_in_general#Minimizing the learned clause)
|
||||
- [shrinking](SAT_in_general#Shrinking)
|
||||
- Complexities of CDCL
|
||||
- What is the cost of missing propagations?
|
||||
- [Restarts](Solvers#Restarts) (schemes: [Scheduling](Scheduling))
|
||||
- [Forgetting clauses](Solvers#Reduction)
|
||||
- [Decision Heuristics](<Decision Heuristics>)
|
||||
- [Phase (Saving)](Solvers#Phase saving)
|
||||
# [Inprocessing](Preprocessing_Inprocessing)
|
||||
- [Scheduling](Scheduling)
|
||||
## "Same models"
|
||||
- [Subsumption](Preprocessing_Inprocessing#Subsumption)
|
||||
- [Sweeping](Preprocessing_Inprocessing#Sweeping)
|
||||
- [Vivification](Preprocessing_Inprocessing#Vivification / Distillation)
|
||||
## "Every Model after Works" $M_1 \rightarrow M_2$
|
||||
- [Symmetry breaking](Preprocessing_Inprocessing#Symmetry Breaking)
|
||||
- [Pure literals](Preprocessing_Inprocessing#Pure Literal)
|
||||
- BCA (see [Blocked Clauses / Blocked literal](Preprocessing_Inprocessing#Blocked Clauses / Blocked literal))
|
||||
## "Change Models"
|
||||
- [bounded Variable Elimination](Preprocessing_Inprocessing#Bounded Variable Elimination (BVE))
|
||||
- Blocked Clause Elimination (see [Blocked Clauses / Blocked literal](Preprocessing_Inprocessing#Blocked Clauses / Blocked literal))
|
||||
- [Plaisted-Greenbaum](Encoding#Plaisted–Greenbaum (PG))
|
||||
- [Autarkies](Preprocessing_Inprocessing#Autarky)
|
||||
|
||||
|
||||
# Local Search?
|
||||
- Not specified by Fleury, but lecture was held by Fleury
|
||||
- weird
|
||||
|
||||
# Im weak on
|
||||
- [Glucose](Solvers#Reduction)
|
||||
- [Look ahead](<Decision Heuristics#Look-ahead>)
|
||||
@@ -0,0 +1,71 @@
|
||||
- See [[Solvers#Boolean Constraint Propagation (BCP)]]
|
||||
# Occurrence Stack/ List
|
||||
- Array/Map from literals to clause pointers
|
||||
- Keep track of all Clauses which contain lit
|
||||
#### Specifically for 2 watch
|
||||
- can also be a linked list of clauses (pointer chasing)
|
||||
#### Trick for binary clauses
|
||||
- Store the other literal instead of a pointer to the clause
|
||||
# Clause Counting
|
||||
- Keep track of assigned (false) literals in a clause
|
||||
- If there is only one unassigned literal left (and there is no unassigned literal)
|
||||
- That literal needs to be assigned
|
||||
- Needs to be adjusted during (decision,) propagation and backtracking
|
||||
# Head & Tail scheme (SATO, Zhang'97)
|
||||
- Each clause has head & tail
|
||||
- before head & after tail all literals are falsified
|
||||
- if `head >= tail` => conflict
|
||||
# (Two) Watch scheme
|
||||
- Watch first two instead of all literals in a clause
|
||||
- I.e. Do not keep full occurrence list
|
||||
- You could also watch whatever two literals using a watcher structure
|
||||
- If a watched literal is assigned to false, replace it if possible
|
||||
- If not possible => Assign other True
|
||||
|
||||
## Blocking Literal
|
||||
- Add an additional entry in the watch list, which carries a literal that was recently $\top$ in the clause
|
||||
- If it is still $\top$ no derefering the pointer is needed (cache friendly)
|
||||
# Control and Trail
|
||||
|
||||
- Keep track of assigned variables in order on the trail
|
||||
- Keep track of size of trail after each decision (trail is decided var + propagated)
|
||||
![[control_trail.png]]
|
||||
|
||||
## Finding an UIP
|
||||
- You can traverse the implication graph in reverse order of trail to find the first UIP
|
||||
```
|
||||
for (auto it = trail.rbegin(); it < trail.rend(); ++it) {
|
||||
// Walk backwards in trail
|
||||
// Mark clauses to visit
|
||||
auto var = abs(*it);
|
||||
if (!marked[var]) continue;
|
||||
// Found UIP
|
||||
if (lowest_level == 1) {
|
||||
uip = *it;
|
||||
break;
|
||||
}
|
||||
marked[var] = false;
|
||||
lowest_level--;
|
||||
for (auto other : *implication[var]) {
|
||||
if (var == other)
|
||||
continue;
|
||||
if (var == -other)
|
||||
continue;
|
||||
if (marked[abs (other)])
|
||||
continue;
|
||||
if (levels[abs (other)] == level) {
|
||||
debug ("new literal on highest level %s", debug (other));
|
||||
lowest_level++;
|
||||
}
|
||||
marked[abs(other)] = true;
|
||||
}
|
||||
}
|
||||
|
||||
for (auto it = trail.rbegin(); it != trail.rend(); ++it) {
|
||||
if (marked[abs(*it)]) {
|
||||
marked[abs(*it)] = false;
|
||||
learned_clause.push_back(-*it);
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
@@ -0,0 +1,95 @@
|
||||
- Preprocessing is very good at optimizing the CNF
|
||||
- Its mostly polynomial (not too costly)
|
||||
- But running it until completion can be too much
|
||||
- Inprocessing runs preprocesors after each restart
|
||||
- benefits of preprocessing, less overhead timewise
|
||||
# Bounded Variable Elimination (BVE)
|
||||
- Use resolution to remove a variable
|
||||
- Works only if number of clauses is not increasing (bounded)
|
||||
- Best and most important preprocessing
|
||||
|
||||
# Bounded Variable Addition (BVA)
|
||||
- Conversely reverse the resolution rule to add a variable
|
||||
- Only if you can decrease the number of variables
|
||||
- $(a\lor d), (b\lor d), (c\lor d)$ and $(a\lor e), (b\lor e), (c\lor e)$
|
||||
- >> $(a\lor x), (b\lor x), (c\lor x)$ and $(\overline x \lor d), (\overline x \lor e)$
|
||||
|
||||
# Subsumption
|
||||
- Smaller clause subsumes longer clause (backward subsumption)
|
||||
- Longer clause is subsumed by smaller clause (forwards subsumption)
|
||||
|
||||
# Sweeping
|
||||
- Find literals/nodes that are functionally equivalent (e.g. candidates via random simulation, confirmed with a SAT call)
|
||||
- Merge equivalent literals: substitute one for the other everywhere, removing the redundant variable
|
||||
- Preserves the exact model set (true logical equivalence), unlike Subsumption/BVE which only preserve (un)satisfiability
|
||||
- Example: $(\overline x \lor y) \land (\overline y \lor x) \land (x \lor a) \land (\overline y \lor b)$
|
||||
- Simulation shows $x,y$ always agree; SAT call confirms $\overline{x \leftrightarrow y}$ is UNSAT $\Rightarrow x \leftrightarrow y$
|
||||
- Substitute $y := x$ everywhere: $(x \lor a) \land (\overline x \lor b)$ (the defining clauses for $y$ drop out)
|
||||
|
||||
# Variable instantiation
|
||||
```
|
||||
for l in lits:
|
||||
for c in clauses:
|
||||
assume l and -l' for all other l' in c
|
||||
if all c lead to conflict assign -l
|
||||
```
|
||||
|
||||
# Pure Literal
|
||||
- Find variables which only occur in one phase.
|
||||
- Assign variable to that phase & remove all subsumed clauses
|
||||
|
||||
# Symmetry Breaking
|
||||
- Find symmetries: permutations of variables/literals that leave the CNF invariant (e.g. via automorphisms of the clause-variable incidence graph)
|
||||
- Add symmetry-breaking predicates (SBPs) that pick one canonical representative per symmetric orbit (e.g. lexicographic-leader constraints)
|
||||
- Cuts away redundant, symmetric parts of the search space without losing satisfiability
|
||||
- "Every model after works": a model of the constrained (canonical) formula is still a model of the original
|
||||
- Example: $(x_1 \lor x_2) \land (\overline{x_1} \lor \overline{x_2})$ ("exactly one of $x_1,x_2$") is symmetric under swapping $x_1 \leftrightarrow x_2$
|
||||
- Two models exist: $x_1{=}1,x_2{=}0$ and $x_1{=}0,x_2{=}1$ (mirror images)
|
||||
- Add SBP $(\overline{x_1} \lor x_2)$ (forces $x_1 \le x_2$) to keep only the canonical $x_1{=}0,x_2{=}1$, cutting the mirrored branch from the search
|
||||
|
||||
# Stalmarks Method
|
||||
- Method on triplets (such as results from the Tseitin transformation)
|
||||
- Can transform (in)equalities
|
||||
- BCP over (in)equalities, Structural Rules, Test Rule
|
||||
|
||||
# Autarky
|
||||
- Partial assignments $\sigma$ maybe satisfes subset of a CNF
|
||||
- If all clauses touched by $\sigma$ are satisfied
|
||||
- $\sigma$ is an an autarky
|
||||
- These clauses may be removed
|
||||
### Conditional autarky
|
||||
- an coditinal autarky is an assignment $\alpha = \gamma \cup \beta$
|
||||
- First F is simplified $F|_\gamma$ and then $\beta$ is an autarky of $F|_\gamma$
|
||||
- Relation to (globally) blocked clauses
|
||||
- Let $\gamma = \overline{C \setminus L}, \beta = L$
|
||||
- We have $\gamma \cup \beta \text{ is autarky} \iff L \text{ globally blocked } C$
|
||||
### Computing (conditional) autarkies
|
||||
- Trivial base case: pure literals are already autarkies (touched clauses are all satisfied)
|
||||
- Fixpoint search: tentatively assign a literal, satisfy the clauses it touches, then keep adding literals whose touched clauses are already satisfied, until no touched clause is falsified (else backtrack the guess)
|
||||
- For conditional autarkies: fix $\gamma$ first (simplify $F|_\gamma$), then run the same fixpoint search for $\beta$ on $F|_\gamma$
|
||||
# Blocked Clauses
|
||||
- If we have a blocked clause $C$ containing a literal $l$
|
||||
- and all resolvents of $C$ are tautological (trivially true) we can remove C
|
||||
- (Trivial proof by contradiction)
|
||||
## Set Blocked Clauses
|
||||
- Extension to generalize the blocked literal to a Set $L$
|
||||
- Similar idea Set blocked Clause $C$, and all Clauses $D$ which contain a $l \in \overline L$
|
||||
$$
|
||||
(C \setminus L) \cup \overline L \cup D\; \text{tautological}
|
||||
$$
|
||||
# Vivification / Distillation
|
||||
- Try to set literals in clauses to false and find out which other literals are implied
|
||||
- Maybe even the clause is implied
|
||||
```
|
||||
for c in clauses:
|
||||
for i in len (c):
|
||||
lit = c[i]
|
||||
assign (-lit)
|
||||
propagate ()
|
||||
if eval(c) == True:
|
||||
// Implies itself somehow
|
||||
mark_clause_for_removal (c)
|
||||
for other in c[i+1..]:
|
||||
if is_assigned (other):
|
||||
mark_lit_for_removal (other)
|
||||
```
|
||||
@@ -0,0 +1,16 @@
|
||||
- used to verify UNSAT results
|
||||
- Idea is to derive empty clause
|
||||
# RUP
|
||||
- Reverse Unit Propagation
|
||||
- Proofs only by [Unit propagation](SAT_in_general#Special Case Unit Resolution)
|
||||
# RAT
|
||||
- Reverse Asymmetric Tautology
|
||||
- Idea: If all Resolutions end in Tautologies (or tautology by RUP) clause can be removed
|
||||
- Supports more than just [UP](SAT_in_general#Special Case Unit Resolution)
|
||||
- Way to represent [Blocked Clause removal](Preprocessing_Inprocessing#Blocked Clauses / Blocked literal)
|
||||
- Replace need for tautology with RUP condition
|
||||
# Redundancy
|
||||
- A clause in a Formula is redundant
|
||||
- Simplifying F by setting C to false implies any Formula simplified by another assignment
|
||||
- $F_\alpha \models F_\omega$ , where $\omega$ satisfies $C$
|
||||
- The idea of Propagation Redundancy (PR) is more general even than RAT
|
||||
@@ -0,0 +1,19 @@
|
||||
# SAT Solving Exam Prep
|
||||
|
||||
Notes for the SAT Solving oral exam (Fleury). Start with the summary, then drill into
|
||||
individual topic files as needed; `questions.md` collects oral-exam-style questions
|
||||
linking back into all of them.
|
||||
|
||||
## Start here
|
||||
- [Fleury Summary of stuff.md](<Fleury Summary of stuff.md>) — topic checklist for the exam, links out to every other file
|
||||
- [questions.md](questions.md) — oral-exam-style questions, organized by topic, linked back to the notes
|
||||
|
||||
## Topic notes
|
||||
- [Encoding.md](Encoding.md) — CNF/DNF, NNF, Tseitin & Plaisted-Greenbaum transformations
|
||||
- [SAT_in_general.md](SAT_in_general.md) — SAT/UNSAT, resolution, implication graph, UIP, clause minimization/shrinking
|
||||
- [Solvers.md](Solvers.md) — DP, DPLL, backjumping, CDCL, clause reduction, restarts, phase saving
|
||||
- [Implementation Details.md](<Implementation Details.md>) — watched literals, occurrence lists, trail, finding a UIP
|
||||
- [Decision Heuristics.md](<Decision Heuristics.md>) — VSIDS family, look-ahead, cut heuristic, Horn form
|
||||
- [Preprocessing_Inprocessing.md](Preprocessing_Inprocessing.md) — BVE/BVA, subsumption, sweeping, symmetry breaking, autarkies, blocked clauses
|
||||
- [Scheduling.md](Scheduling.md) — arithmetic/geometric/Luby restart schedules
|
||||
- [Proofs.md](Proofs.md) — RUP, RAT, redundancy
|
||||
@@ -0,0 +1,41 @@
|
||||
# What is SAT
|
||||
- Satisfiability of a (CNF) formula
|
||||
- Empty formula is SAT (Intersection of nothing)
|
||||
- Empty Clause is UNSAT (union of nothing)
|
||||
|
||||
# Resolution
|
||||
```
|
||||
C u {l} D u {-l}
|
||||
------------------------
|
||||
C u D
|
||||
```
|
||||
## Special Case: Unit Resolution
|
||||
```
|
||||
C u {-l} {l}
|
||||
------------------------
|
||||
C
|
||||
```
|
||||
|
||||
# Implication Graph
|
||||
- Array/ Graph from literals/ variables to clauses/ reasons
|
||||
- Maps a variable to the clause that lead to its assigning (only for [Unit Resolution](SAT_in_general#Special Case Unit Resolution))
|
||||
- Logical end is the empty clause/ initial conflict clause $\kappa$
|
||||
- (Normally hyprgraph with input nodes (reasons) and output node 'edge is the clause')
|
||||
![[implication_graph.png]]
|
||||
## (First) Unique Implication Point (UIP)
|
||||
- A UIP is a node in the implication graphs lowest level which fully implies the conflict (together with all higher levels)
|
||||
- The first UIP is typically what we want
|
||||
- “pulls in” as few decision levels as possible
|
||||
- Other strategies include last UIP, all UIP, where all decisions are used as a clause
|
||||
- All UIP typically is a smaller clause but less useful
|
||||
|
||||
## Minimizing the learned clause
|
||||
- Often the learned clause resulting from conflict analysis can be made smaller using self-subsumption
|
||||
![[self_subsumption_learned_clause.png]]
|
||||
- Here even h could then be removed, as e follows from Unit and d, i.e. we can construct a self subsumption only using an additional unit. But this is algorithmically more challenging)
|
||||
## Shrinking
|
||||
- Follow-up to [minimization](SAT_in_general#Minimizing the learned clause) (Sörensson & Biere, "Minimizing Learned Clauses")
|
||||
- Minimization only reuses reasons already in the implication graph (self-subsumption)
|
||||
- Shrinking instead assumes the negation of the (minimized) learned clause's literals and runs fresh unit propagation
|
||||
- If a conflict is reached using only a subset of them, the rest were unnecessary -> drop them
|
||||
- More expensive (does real propagation work), but can shrink clauses further than minimization alone
|
||||
@@ -0,0 +1,15 @@
|
||||
# Arithmetic
|
||||
Reset after
|
||||
$$r' = r + c$$
|
||||
# Geometric
|
||||
Reset after
|
||||
$$r' = r * q$$
|
||||
# LUBY / Reluctant Doubling
|
||||
|
||||
```
|
||||
// Where v is the actually intereting part
|
||||
(u,v) = (1,1)
|
||||
(u', v') = (u & -u == v ? (u + 1, 1) : (u + 2v))
|
||||
//Doubles every so often
|
||||
/ Series: 1 1 2 1 1 2 4 1 1 2 4 8 ...
|
||||
```
|
||||
+103
@@ -0,0 +1,103 @@
|
||||
# Davis Putnam Procedure (DP)
|
||||
```
|
||||
while True:
|
||||
if [] in formula:
|
||||
return UNSAT
|
||||
//remove all variables that occur only in one phase
|
||||
vars = one_phased(formula)
|
||||
for var in vars:
|
||||
for clause in formula:
|
||||
if var in formula:
|
||||
remove(clause)
|
||||
|
||||
var = decide(formula)
|
||||
|
||||
// Add non trivial resolvants
|
||||
formula += resolution(var, formula)
|
||||
|
||||
for clause in formula:
|
||||
if var in formula:
|
||||
remove(clause)
|
||||
|
||||
if formula is []:
|
||||
return SAT
|
||||
```
|
||||
- Notice that
|
||||
- Adding a resolvant always preservers SAT (resolution rule)
|
||||
- Adding any clause always preserves UNSAT
|
||||
|
||||
- Removing any clause always preserves SAT
|
||||
- Removing a clause containing a 'one phase variable' preserves UNSAT (reverse of resolution rule)
|
||||
# Davis Putnam Logemann Loveland DPLL
|
||||
## Boolean Constraint Propagation (BCP)
|
||||
- Given a unit clause $l$
|
||||
1. Remove all subsumed clauses, i.e. $C$ where $l \in C$
|
||||
2. Remove $\lnot l$ from all $C$ (which contain it) [Unit Prop](SAT_in_general#Special Case Unit Resolution)
|
||||
```
|
||||
def dpll(formula):
|
||||
if [] in formula:
|
||||
return UNSAT
|
||||
vars = one_phased(formula)
|
||||
for var in vars:
|
||||
for clause in formula:
|
||||
if var in formula:
|
||||
remove(clause)
|
||||
if formula is []:
|
||||
return SAT
|
||||
|
||||
var = decide()
|
||||
if dpll(formula + [var]) == SAT:
|
||||
return SAT
|
||||
return dpll(formula + [-var])
|
||||
```
|
||||
- Correct because of theorem of Shanon
|
||||
- $f(x) = (x \land f(1)) \lor (\overline x \land f(0))$
|
||||
-
|
||||
# Backjumping
|
||||
- If some conflict has been derived without using specific assignments/ decision
|
||||
- We can skip over that decision when flipping: ![[backjump.png]]
|
||||
- If conflict stems from for example from (1 2) (1 -2)
|
||||
- Removes 'bad decisions'/ 'useless' from the trail
|
||||
- Can reduce search space from exponential to quadratic in number of bad decisions
|
||||
- Whatever that means
|
||||
|
||||
# CDCL
|
||||
- DPLL with learning
|
||||
- On conflict, learn a conflict clause which will help in further exploration
|
||||
- Usually the first UIP of the [implication graph](SAT_in_general#Implication Graph) is used as conflict clause
|
||||
- After learning a conflict:
|
||||
- Back-jump to the lowest level in the implication graph supporting the UIP
|
||||
- Assign negated UIP literal
|
||||
- this is why first UIP is good (“pulls in” as few decision levels as possible)
|
||||
## Reduction
|
||||
- Not all clauses are useful forever
|
||||
- Useless via Subsumption, or trivially satisfied by units
|
||||
- Try to reduce the amount of clauses you need to consider in BCP
|
||||
- Schedule throwing away clauses
|
||||
- geometric, Luby, arithmetic scheme
|
||||
- Consider various heuristics
|
||||
- Size
|
||||
- Last Recently Used (LRU),
|
||||
- Clause Move To Front (CMTF)
|
||||
- Clause Scores similar to VSIDS
|
||||
- Glucose/ Literal Block Distance (LBD)
|
||||
- LBD = number of distinct decision levels among a (learned) clause's literals
|
||||
- Low LBD ("glue clause"): literals tightly related across few levels -> likely useful, keep
|
||||
- High LBD: literals span many levels, weakly related -> good deletion candidate
|
||||
- Used flag
|
||||
## Restarts
|
||||
- Schedule restarts every so often can improve performance
|
||||
- Throw away the trail
|
||||
- Keep (most) learned clauses, phase saving, other state
|
||||
- Idea:
|
||||
- The solver might have zoomed in on an efficient part of the search space
|
||||
- For SAT instances might stuck in a UNSAT part
|
||||
- For UNSAT instances might miss a shorter proof
|
||||
- Avoid going down the same path by keeping what was learned
|
||||
- Clauses, phase saving, variable scoring
|
||||
|
||||
## Phase saving
|
||||
- Whenever assigning a variable, save the phase it is assigned
|
||||
- When deciding on a variable assign the saved phase
|
||||
- Idea: Go down the right branch of the search tree
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 84 KiB |
@@ -0,0 +1,85 @@
|
||||
# Encoding
|
||||
- What is CNF, what is DNF, and why is finding a satisfying assignment easy in DNF but hard in CNF (and vice versa for falsifying assignments)? [CNF](Encoding#CNF (Conjunctive Normal Form)) / [DNF](Encoding#DNF (Disjunctive Normal Form))
|
||||
- How would you encode "are two programs equivalent?" as a SAT instance, and what does a SAT result tell you? [Encoding Problems to boolean formula](Encoding#Encoding Problems to boolean formula)
|
||||
- What is NNF? Why does the naive NNF -> CNF transformation (OR-distribution) blow up exponentially? [NNF](Encoding#NNF / Negation Normal Form)
|
||||
- Walk through the Tseitin transformation on a small formula. Why does the resulting CNF only grow linearly, and why is splitting into binary operations sometimes not optimal (e.g. XOR)? [Tseitin](Encoding#Tseitin Transformation)
|
||||
- What does Plaisted-Greenbaum change compared to plain Tseitin? Give a concrete positive-polarity and negative-polarity example and state which single implication direction suffices in each case. [PG](Encoding#Plaisted–Greenbaum (PG))
|
||||
- When does a subformula need the *full* biconditional even under PG?
|
||||
- Translating a formula *into* NNF can itself blow up exponentially even before any CNF step — why does $f \leftrightarrow g \mapsto (f\land g)\lor(\overline f\land \overline g)$ double the size, why does this compound when IFF/XOR are nested, and how does Tseitin sidestep it? [Negation Normal Form](lect02#Negation Normal Form)
|
||||
|
||||
# Complexity
|
||||
- SAT is in NP, UNSAT is in coNP — concretely, what's the certificate in each case, and who has an easy time (finder vs. checker)? Is NP = coNP? [P, NP and CO-NP](lect02#P, NP and CO-NP)
|
||||
- In what sense is SAT the "NP king"? What does it actually buy you that every NP problem reduces to SAT? [P, NP and CO-NP](lect02#P, NP and CO-NP)
|
||||
|
||||
# SAT Fundamentals
|
||||
- Define SAT/UNSAT. Why is the empty formula SAT and the empty clause UNSAT? [What is SAT](SAT_in_general#What is SAT)
|
||||
- State the resolution rule and derive unit resolution as its special case. [Resolution](SAT_in_general#Resolution)
|
||||
- Describe the Davis-Putnam procedure. Which operations preserve SAT, which preserve UNSAT, and why? [DP](Solvers#Davis Putnam Procedure (DP))
|
||||
- How does DPLL differ from DP? Why is DPLL correct (Shannon expansion)? [DPLL](Solvers#Davis Putnam Logemann Loveland DPLL)
|
||||
- *(past oral exam question)* Why does DP terminate? [Oral Exam](lect05#Oral Exam)
|
||||
- *(past oral exam question)* Why doesn't DP's termination show that SAT is solvable in polynomial time — how many resolvents can eliminating one variable add, and how does that compound over all variables? [Oral Exam](lect05#Oral Exam)
|
||||
- What is Horn form? Why can a satisfiability check on a positive Horn-form CNF be done in polynomial time via BCP alone? [Horn Form](<Decision Heuristics#Horn Form>)
|
||||
|
||||
# CDCL Core
|
||||
- What does CDCL add on top of plain DPLL? [CDCL](Solvers#CDCL)
|
||||
- What is backjumping, and how/why can it reduce the search space from exponential to quadratic in the number of "bad" decisions? [Backjumping](Solvers#Backjumping)
|
||||
- What is the implication graph and what does a (first) UIP represent in it? [Implication Graph](SAT_in_general#Implication Graph) / [UIP](SAT_in_general#(First) Unique Implication Point (UIP))
|
||||
- Compare 1-UIP vs. all-UIP learning: which clause is typically smaller, and why is 1-UIP still usually preferred?
|
||||
- Sketch the algorithm for finding the first UIP by walking the trail backwards. [Finding an UIP](<Implementation Details#Finding an UIP>)
|
||||
- What is self-subsumption-based minimization of a learned clause? [Minimizing](SAT_in_general#Minimizing the learned clause)
|
||||
- How does shrinking differ from minimization — why can it remove literals that minimization cannot, and at what cost? [Shrinking](SAT_in_general#Shrinking)
|
||||
- In what sense is conflict analysis confluent, and in what sense is it not?
|
||||
- CDCL can undo assignments via backjumping and restarts — so why does it still terminate? What quantity only ever grows across conflicts? [Termination](lect06#Termination)
|
||||
- After learning a conflict clause, to which decision level do you backjump, and in what sense is the learned clause a "shortcut" for the conflict you just derived through several decisions? [Backjumping](lect06#Backjumping)
|
||||
- A UIP can be defined graph-theoretically as a *dominator* of the conflict node in the implication graph — what does that mean, and what would a dominator on a higher (non-last) decision level correspond to? [Lecture 07](lect07)
|
||||
- What is a *cut* in the implication/conflict graph? How does it split the graph into a "reason side" and "conflict side", and how does the learned clause relate to the literals crossing the cut? [Cut in Conflict graphs](tutorial#Cut in Conflict graphs)
|
||||
|
||||
# BCP / Implementation
|
||||
- Compare the occurrence list, the head/tail scheme, and the two-watched-literal scheme: what does each need to update on assignment vs. on backtracking? [Occurrence Stack](<Implementation Details#Occurrence Stack/ List>) / [Head & Tail](<Implementation Details#Head & Tail scheme (SATO, Zhang'97)>) / [Two Watch](<Implementation Details#(Two) Watch scheme>)
|
||||
- Why don't the two watched literals need any bookkeeping on backtrack, unlike a full occurrence/counting scheme?
|
||||
- What is a blocking literal, and why is it needed given the watch invariant already guarantees the watched literals aren't false? [Blocking Literal](<Implementation Details#Blocking Literal>)
|
||||
- What's the special-case trick for binary clauses in the watch scheme, and why does it work only there? [Trick for binary clauses](<Implementation Details#Trick for binary clauses>)
|
||||
- Why is the trail useful for both propagation bookkeeping and UIP search? [Control and Trail](<Implementation Details#Control and Trail>)
|
||||
- How do decision level, control stack, and trail relate operationally — what exactly does the control stack let you "undo", and what does the trail hold that the control stack doesn't? [Easy Sat Unit Prop Example](lect04#Easy Sat Unit Prop Example)
|
||||
|
||||
# Restarts & Clause Management
|
||||
- Why can restarts improve performance even though they discard the trail? What state survives a restart, and why is that specifically kept? [Restarts](Solvers#Restarts)
|
||||
- Give the reset formulas for arithmetic, geometric, and Luby restart schedules. What tradeoff is each trying to balance? [Scheduling](Scheduling)
|
||||
- Why does the Luby sequence look like 1,1,2,1,1,2,4,1,1,2,4,8,...?
|
||||
- Name several heuristics for deciding which learned clauses to forget, and explain what LBD measures and why a low-LBD ("glue") clause is considered valuable. [Reduction](Solvers#Reduction)
|
||||
- What does Glucose's restart trigger compare, and why does that indicate the solver is "stuck"?
|
||||
|
||||
# Decision Heuristics
|
||||
- Contrast static, dynamic, and second-order dynamic decision heuristics. Where does DLIS sit vs. VSIDS, and why? [Types](<Decision Heuristics#Types>)
|
||||
- Walk through VSIDS scoring and periodic decay. How do NVSIDS and EVSIDS reformulate the same idea, and why is EVSIDS just unscaled NVSIDS? [VSIDS](<Decision Heuristics#Variable State Independent Decaying Sum (VSIDS)>)
|
||||
- What is phase saving, and why does re-using the saved phase after a restart help rather than hurt exploration? [Phase saving](Solvers#Phase saving)
|
||||
- Explain look-ahead based variable selection. Why is it too expensive to run on every CDCL decision, and where else in your notes does the same "assign, propagate, check for conflict" primitive show up? [Look-ahead](<Decision Heuristics#Look-ahead>)
|
||||
- What is the cut heuristic, and how is it a divide & conquer approach to solving? [Cut heuristic](<Decision Heuristics#Cut heuristic>)
|
||||
|
||||
# Preprocessing / Inprocessing
|
||||
- What's the difference between preprocessing and inprocessing, and why run simplification again after every restart instead of once up front?
|
||||
- Explain Bounded Variable Elimination — why must the clause count not increase for it to apply? [BVE](Preprocessing_Inprocessing#Bounded Variable Elimination (BVE))
|
||||
- Explain Bounded Variable Addition as BVE's reverse, with an example. When is it worth applying? [BVA](Preprocessing_Inprocessing#Bounded Variable Addition (BVA))
|
||||
- Distinguish forward and backward subsumption. [Subsumption](Preprocessing_Inprocessing#Subsumption)
|
||||
- What does sweeping do, and why does it preserve the *exact* model set where subsumption/BVE only preserve (un)satisfiability? [Sweeping](Preprocessing_Inprocessing#Sweeping)
|
||||
- What is variable instantiation (failed-literal probing), and how does vivification generalize the same "assign, propagate, check" idea to whole clauses instead of single literals? [Variable instantiation](Preprocessing_Inprocessing#Variable instantiation) / [Vivification](Preprocessing_Inprocessing#Vivification / Distillation)
|
||||
- What is a pure literal, and why is fixing it always safe? [Pure Literal](Preprocessing_Inprocessing#Pure Literal)
|
||||
- What is symmetry breaking? Give a symmetry-breaking predicate for the "exactly one of $x_1,x_2$" constraint and explain what it removes. [Symmetry Breaking](Preprocessing_Inprocessing#Symmetry Breaking)
|
||||
- Define autarky. What is a conditional autarky, and how does it relate to globally blocked clauses? [Autarky](Preprocessing_Inprocessing#Autarky)
|
||||
- Sketch how you'd compute a (conditional) autarky via fixpoint search. [Computing autarkies](Preprocessing_Inprocessing#Computing (conditional) autarkies)
|
||||
- What is a blocked clause, and why is it always safe to remove one (proof idea via resolvent tautology)? [Blocked Clauses](Preprocessing_Inprocessing#Blocked Clauses)
|
||||
- How does the set-blocked-clause generalization extend the single blocked-literal condition? [Set Blocked Clauses](<Preprocessing_Inprocessing#Set Blocked Clauses>)
|
||||
- What does Stalmark's method operate on, and how does that differ from Tseitin/CNF-based reasoning? [Stalmarks Method](Preprocessing_Inprocessing#Stalmarks Method)
|
||||
- Sort BVE, BCE, Subsumption, Sweeping, Pure literals, and Symmetry breaking into "same models" / "every model after works" / "changes models" — justify each placement.
|
||||
|
||||
# Proofs
|
||||
- Why do UNSAT results need proofs, and what's the basic idea (deriving the empty clause)? [Proofs](Proofs)
|
||||
- What is RUP, and why is checking an RUP proof cheap? [RUP](Proofs#RUP)
|
||||
- What is RAT, and in what sense is it strictly more general than RUP? [RAT](Proofs#RAT)
|
||||
- How does RAT let you represent blocked-clause removal in a proof? [RAT](Proofs#RAT)
|
||||
- What does it mean for a clause to be (semantically) redundant, and how does Propagation Redundancy (PR) generalize RAT? [Redundancy](Proofs#Redundancy)
|
||||
|
||||
# Big Picture
|
||||
- Trace one SAT instance end to end: how might you encode it (Tseitin/PG), which inprocessing techniques could simplify it, how would CDCL solve it, and what would an UNSAT proof for it look like?
|
||||
- Compare the three "Watch scheme" implementations for the same underlying goal — what does each optimize for (memory, cache locality, backtrack cost)?
|
||||
- Both look-ahead decision making and failed-literal probing (variable instantiation) share a mechanism — what is it, and why is one used as a decision heuristic and the other as preprocessing?
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 127 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 208 KiB |
Reference in New Issue
Block a user