Boolean formulas #
Tree syntax and semantics for Boolean formulas. Formula size counts tree nodes, so repeated subformulas are counted repeatedly rather than shared as in a Boolean circuit.
A total assignment maps every natural-number variable index to a truth value. It is the environment in which Boolean formulas receive their meaning.
Equations
Instances For
Two assignments agree on a finite set when they give every variable in that set the same value. Differences outside the set are deliberately ignored.
Equations
- ComplexityTheory.BooleanAssignment.AgreeOn indices first second = ∀ index ∈ indices, first index = second index
Instances For
A Boolean formula represented as a tree of variables, constants, and logical connectives. The explicit syntax lets later algorithms inspect and transform formulas rather than treating them as opaque Boolean functions.
- var
(i : ℕ)
: BooleanFormula
The variable
x_i. - tru : BooleanFormula
The constant true.
- fls : BooleanFormula
The constant false.
- neg
(formula : BooleanFormula)
: BooleanFormula
Negation.
- conj
(left right : BooleanFormula)
: BooleanFormula
Conjunction.
- disj
(left right : BooleanFormula)
: BooleanFormula
Disjunction.
Instances For
Equations
- One or more equations did not get rendered due to their size.
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (ComplexityTheory.BooleanFormula.var a) (ComplexityTheory.BooleanFormula.var b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (ComplexityTheory.BooleanFormula.var i) ComplexityTheory.BooleanFormula.tru = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (ComplexityTheory.BooleanFormula.var i) ComplexityTheory.BooleanFormula.fls = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (ComplexityTheory.BooleanFormula.var i) formula.neg = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (ComplexityTheory.BooleanFormula.var i) (left.conj right) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (ComplexityTheory.BooleanFormula.var i) (left.disj right) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.tru (ComplexityTheory.BooleanFormula.var i) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.tru ComplexityTheory.BooleanFormula.tru = isTrue ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.tru formula.neg = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.tru (left.conj right) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.tru (left.disj right) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.fls (ComplexityTheory.BooleanFormula.var i) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.fls ComplexityTheory.BooleanFormula.fls = isTrue ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.fls formula.neg = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.fls (left.conj right) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq ComplexityTheory.BooleanFormula.fls (left.disj right) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq formula.neg (ComplexityTheory.BooleanFormula.var i) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq formula.neg ComplexityTheory.BooleanFormula.tru = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq formula.neg ComplexityTheory.BooleanFormula.fls = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq formula.neg (left.conj right) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq formula.neg (left.disj right) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.conj right) (ComplexityTheory.BooleanFormula.var i) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.conj right) ComplexityTheory.BooleanFormula.tru = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.conj right) ComplexityTheory.BooleanFormula.fls = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.conj right) formula.neg = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.conj right) (left_1.disj right_1) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.disj right) (ComplexityTheory.BooleanFormula.var i) = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.disj right) ComplexityTheory.BooleanFormula.tru = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.disj right) ComplexityTheory.BooleanFormula.fls = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.disj right) formula.neg = isFalse ⋯
- ComplexityTheory.instDecidableEqBooleanFormula.decEq (left.disj right) (left_1.conj right_1) = isFalse ⋯
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Evaluate a Boolean formula under an assignment. This supplies the semantics used by satisfiability and tautology.
Equations
- ComplexityTheory.BooleanFormula.eval assignment (ComplexityTheory.BooleanFormula.var a) = assignment a
- ComplexityTheory.BooleanFormula.eval assignment ComplexityTheory.BooleanFormula.tru = true
- ComplexityTheory.BooleanFormula.eval assignment ComplexityTheory.BooleanFormula.fls = false
- ComplexityTheory.BooleanFormula.eval assignment a.neg = !ComplexityTheory.BooleanFormula.eval assignment a
- ComplexityTheory.BooleanFormula.eval assignment (a.conj a_1) = (ComplexityTheory.BooleanFormula.eval assignment a && ComplexityTheory.BooleanFormula.eval assignment a_1)
- ComplexityTheory.BooleanFormula.eval assignment (a.disj a_1) = (ComplexityTheory.BooleanFormula.eval assignment a || ComplexityTheory.BooleanFormula.eval assignment a_1)
Instances For
The number of nodes in a formula tree. This is the formula-size measure used by later resource bounds.
Equations
Instances For
The finite set of variables occurring in a formula. Variables outside this set cannot affect evaluation.
Equations
Instances For
An assignment satisfies a formula exactly when evaluation returns true; in plain language, the assignment makes the formula true.
Equations
- ComplexityTheory.BooleanFormula.Satisfies assignment formula = (ComplexityTheory.BooleanFormula.eval assignment formula = true)
Instances For
A formula is satisfiable when some assignment satisfies it. Such an assignment is a witness to satisfiability.
Equations
- formula.IsSatisfiable = ∃ (assignment : ComplexityTheory.BooleanAssignment), ComplexityTheory.BooleanFormula.Satisfies assignment formula
Instances For
A formula is a tautology when every assignment satisfies it; its truth does not depend on how its variables are assigned.
Equations
- formula.IsTautology = ∀ (assignment : ComplexityTheory.BooleanAssignment), ComplexityTheory.BooleanFormula.Satisfies assignment formula
Instances For
Every formula tree contains at least one node. There is no empty formula.
Assignments that agree on every variable occurring in a formula evaluate it identically. In plain language, variables absent from the formula do not matter.