# What is a quantified Boolean formula?

by Stephen M. Walker II, Co-Founder / CEO

## What is a quantified Boolean formula?

A quantified Boolean formula (QBF) is an extension of propositional logic that allows for quantification over boolean variables using the `universal (∀)`

and `existential (∃)`

quantifiers. Unlike regular Boolean formulas, which only consist of logical connectives like `AND (∧)`

, `OR (∨)`

, `NOT (¬)`

, and parentheses, QBFs can also include these quantifiers at the beginning of the formula to specify whether all or some values of a particular variable must satisfy certain conditions.

Here is an example of a quantified Boolean formula:

```
∀x∃y (x ∨ y)
```

This QBF states that for every possible value of the boolean variable `x`

, there exists at least one value of the boolean variable `y`

such that either `x`

is true or `y`

is true. In other words, this formula is satisfied if and only if it is impossible to assign truth values to both variables in a way that makes the entire expression false.

Quantified Boolean formulas have important applications in computer science, particularly in areas like program verification, knowledge representation, and automated reasoning. They provide a more expressive language for specifying complex properties of computational systems, which can be automatically checked using various algorithms and tools based on QBF solving techniques. Some common methods for solving QBFs include:

**Quantified Resolution**— This is a refutation-based approach that applies resolution steps to the negated QBF, aiming to derive a contradiction (i.e., a pair of complementary literals) in order to prove its unsatisfiability. The algorithm maintains an ordered set of clauses and performs various operations such as unit propagation, subsumption elimination, and learning new clauses based on detected conflicts.**Quantified DPLL (QDPLL)**— This is a search-based method that combines the Davis-Putnam-Logemann-Loveland (DPLL) algorithm with QBF solving techniques like variable substitution and context splitting. The algorithm recursively assigns truth values to boolean variables while maintaining an "active stack" of quantified variables, which can be used to backtrack if a contradiction is detected during the search process.**Quantified CNF Transformation**— This approach converts a given QBF into an equivalent Conjunctive Normal Form (CNF) formula that can be solved using classical SAT solvers like DPLL or Conflict-Driven Clause Learning (CDCL). The transformation involves applying various syntactic rules and simplification steps, such as eliminating redundant quantifiers or replacing nested quantified variables with new ones.**Quantified BDDs (QBDDs)**— This method uses binary decision diagrams (BDDs) to represent QBFs in a compact and efficient manner. The algorithm constructs a hierarchical network of nodes representing boolean variables and their corresponding literals, which can be traversed using various search strategies and optimization techniques to determine the truth value of the quantified formula.

Solving QBFs is an NP-hard problem in general, but there exist various specialized algorithms and heuristics that can efficiently handle specific classes of formulas or instances with certain characteristics (e.g., small size, low treewidth, etc.).

## What is the satisfiability problem?

The satisfiability problem, often referred to as SAT, is a fundamental decision problem in computer science and mathematics that asks whether there exists an assignment of truth values (e.g., true or false) to the variables in a given Boolean formula such that the entire expression evaluates to true. In other words, the goal is to determine if the formula can be "satisfied" by some set of inputs.

Boolean formulas are built using logical connectives like `AND (∧)`

, `OR (∨)`

, `NOT (¬)`

, and parentheses. A typical example of a Boolean formula might look like this:

```
(x ∧ y) ∨ z
```

Here, the variables `x`

, `y`

, and `z`

can either be true (represented as "1") or false (represented as "0"), and the entire expression evaluates to true if and only if either the conjunction of `x`

and `y`

is true or `z`

is true.

A SAT solver is an algorithm or tool that takes a Boolean formula as input and returns either "SAT" (meaning the formula is satisfiable) or "UNSAT" (meaning the formula is not satisfiable). There are various methods for solving SAT problems, some of which include:

**Davis-Putnam-Logemann-Loveland (DPLL) algorithm**— This is a backtracking-based search method that recursively assigns truth values to boolean variables while maintaining a stack of open branches and clauses that can be used for conflict detection and resolution. The algorithm applies various heuristics to prioritize the order in which variables are assigned, aiming to explore only relevant parts of the search space and reduce the overall number of computational steps required to find a satisfying assignment (if one exists).**Conflict-Driven Clause Learning (CDCL)**— This is an extension of the DPLL algorithm that incorporates additional techniques like unit propagation, variable substitution, and context splitting to improve its performance on hard instances. CDCL solvers maintain a dynamic list of learned clauses, which are derived from detected conflicts during the search process and can be used to guide subsequent decision-making steps based on their relevance and usefulness for eliminating potential inconsistencies.**WalkSAT**— This is a randomized algorithm that uses local search techniques to explore the neighborhood of an initial assignment of truth values to boolean variables, iteratively making small adjustments (i.e., flipping the value of a single variable) and evaluating the impact on the overall satisfaction of the formula. WalkSAT solvers often employ various heuristics for selecting which variable to flip next, aiming to maximize progress towards finding a satisfying assignment while minimizing the risk of getting stuck in local optima or plateaus.**Quantified Boolean Formula (QBF) solving techniques**— While not strictly applicable to SAT problems, some advanced solvers can handle quantified Boolean formulas by incorporating additional mechanisms for managing nested quantifiers and context information within the search process. These methods can be particularly useful for addressing more complex types of logic expressions that involve existential or universal quantification over boolean variables (e.g., ∀x∃y (x ∨ y)).

Solving SAT problems is an NP-complete problem in general, meaning that no efficient algorithm exists for finding a satisfying assignment to all instances of the problem (unless P = NP). However, there have been significant advancements in SAT solver technology over the past few decades, with modern tools capable of handling increasingly large and complex formulas from various application domains (e.g., software verification, cryptography, machine learning, etc.).

## What is the Boolean satisfiability problem?

The Boolean satisfiability problem, often referred to as SAT or B-SAT, is a fundamental problem in logic and computer science. It involves determining if there exists an interpretation that satisfies a given Boolean formula. In other words, it asks whether the variables of a given Boolean formula can be consistently replaced by the values TRUE or FALSE in such a way that the entire formula evaluates to TRUE. If this is the case, the formula is called satisfiable. If no such assignment exists, the formula is unsatisfiable

## What is the difference between a quantified Boolean formula and a Boolean formula?

A Boolean formula is a mathematical formula used to describe a logical relationship between two values, usually denoted as 0 and 1. It is built from variables and operators AND, OR, NOT, and parentheses.

A Quantified Boolean formula (QBF), on the other hand, is a generalization of a Boolean formula in which variables can be quantified. This means that variables in a QBF are quantified by existential or universal quantifiers, at the beginning of the sentence. Such a formula is equivalent to either true or false (since there are no free variables). If such a formula evaluates to true, then that formula is in the language TQBF.

## What is the difference between the satisfiability problem and the Boolean satisfiability problem?

The Boolean satisfiability problem is a specific instance of the satisfiability problem where the formula in question is a Boolean formula. It is also NP-complete and of central importance in many areas of computer science, including theoretical computer science, artificial intelligence, database theory, and hardware verification.