Documentation

CslibFrontier.Computability.Complexity.Problems.TQBF

The problem of true quantified Boolean formulas #

TQBF is the set of true closed quantified Boolean formulas over variables numbered by ℕ: formulas without free variables whose value is true Sipser, Section 8.3 Arora and Barak, Section 4.2. A closed formula has the same value under every assignment (Cslib.Logic.PL.QBF.eval_eq_of_closed), so the assignment fun _ => false in the definition is immaterial. Instances are formulas, not words, and every formula is an instance: formulas with a free variable are simply not in TQBF. Formulas are not required to be in prenex form; the prenex formulas of the textbooks are among them.

A formula is encoded by its tokens in prefix (Polish) order (Cslib.Logic.PL.QBF.tokens): the kind of each node, with its variable for variables and quantifiers and 0 otherwise, as a framed list of framed pairs of the kind in unary and the variable in binary (Cslib.Complexity.encQBF). The prefix order makes the encoding injective without delimiters (Cslib.Logic.PL.QBF.tokens_append_inj), and every node takes at least three bits, so a formula with n nodes has an encoding of length at least 3 * n.

Boundary cases: the empty list is the tokens of no formula; the formulas without variables are built from top and bot, and top ∈ TQBF while bot ∉ TQBF; a variable on its own is never closed, so var v ∉ TQBF, while ex v (var v) ∈ TQBF and all v (var v) ∉ TQBF.

Main definitions #

Main results #

References #

Tokens #

The kinds of nodes of a quantified Boolean formula.

  • var : Kind

    A variable.

  • top : Kind

    The constant true.

  • bot : Kind

    The constant false.

  • not : Kind

    Negation.

  • and : Kind

    Conjunction.

  • or : Kind

    Disjunction.

  • ex : Kind

    Existential quantification.

  • all : Kind

    Universal quantification.

Instances For

    The tokens of a formula in prefix order: the kind of each node, with its variable for variables and quantifiers, and 0 for the other nodes.

    Instances For

      Interpret an existing formula token as its constructor. Nonzero payloads on constants and connectives are rejected. Variables and quantifiers retain their binary-encoded variable.

      Instances For
        theorem Cslib.Logic.PL.QBF.parseFuel_tokens (φ : QBF ℕ) (rest : List (Kind × ℕ)) (fuel : ℕ) (hf : φ.tokens.length ≤ fuel) :

        Parsing a formula's tokens recovers it and leaves the following suffix untouched.

        theorem Cslib.Logic.PL.QBF.tokens_append_inj {φ ψ : QBF ℕ} {r r' : List (Kind × ℕ)} (h : φ.tokens ++ r = ψ.tokens ++ r') :
        φ = ψ ∧ r = r'

        Tokens in prefix order determine the formula, and what follows them.

        Every formula has a token.

        A formula has one token for each of its nodes.

        The index of a kind, from 0 for variables to 7 for universal quantifiers.

        Instances For

          Kinds encoded by their index in unary.

          Instances For
            @[reducible, inline]

            Tokens encoded as framed pairs of the kind in unary and the variable in binary.

            Instances For

              Formulas encoded by their tokens in prefix order (Cslib.Logic.PL.QBF.tokens), as a list of framed tokens.

              Instances For

                A formula is encoded as the list of its framed tokens in prefix order.

                Every node takes at least three bits.

                True closed formulas #

                The true closed quantified Boolean formulas over variables numbered by natural numbers Sipser, Section 8.3, Arora and Barak, Section 4.2.

                Instances For

                  A formula is in TQBF exactly when it is closed and true under the assignment fun _ => false.

                  A closed formula is in TQBF exactly when it is true under some, equivalently every, assignment.

                  The constant true is a true closed formula.

                  The constant false is not true.

                  A variable on its own is not closed.