Literals and bounded-width normal forms #
This module supplies the finite syntax used by switching arguments. A literal
stores the value that makes it true. A LiteralSet stores at most one literal
per variable by using a partial assignment, so contradictory terms and
tautological clauses are excluded by construction. Ordered lists of such sets
form DNF and CNF formulas; the order will later make the canonical decision
tree deterministic.
Restriction keeps the original variable names. A term falsified by a fixed literal is dropped from a DNF, while a clause satisfied by a fixed literal is dropped from a CNF. Empty terms and clauses represent the Boolean constants true and false respectively.
Equations
Instances For
A finite, noncontradictory collection of literals. The partial assignment records the truth value required of each variable that occurs.
- requirements : PartialAssignment n
Partial map from occurring variables to their satisfying values.
Instances For
The empty collection of literals.
Equations
- Algebraic.AC0.LiteralSet.empty = { requirements := Algebraic.PartialAssignment.empty }
Instances For
The one-element collection containing a literal.
Equations
- Algebraic.AC0.LiteralSet.singleton literal = { requirements := Algebraic.PartialAssignment.fix literal.index literal.value }
Instances For
Variables occurring in a literal collection.
Equations
- set.support = set.requirements.fixedVariables
Instances For
Width of a literal collection.
Instances For
Remove the literals whose variables have been fixed by rho. This
operation does not itself check whether those fixed values satisfy or falsify
the removed literals.
Equations
Instances For
Restriction only removes variables from a literal collection.
Every literal remaining after restriction is on a variable left live by the restriction.
Restriction cannot increase the width of a literal collection.
Some fixed literal of set is falsified by rho.
Equations
Instances For
Equations
- set.conflictsWithDecidable rho = id inferInstance
A conflict witnessed by an existing fixed variable persists under every later refinement.
Some fixed literal of set is satisfied by rho.
Equations
Instances For
Equations
- set.hitByDecidable rho = id inferInstance
A conjunction of distinct-variable literals.
Equations
Instances For
A complete input satisfies a term when it gives every occurring literal its required value.
Equations
- term.SatisfiedBy input = ∀ (index : Fin n) (value : Bool), term.requirements index = some value → input index = value
Instances For
Equations
- term.satisfiedByDecidable input = id inferInstance
Restrict a term. none denotes a term made constantly false by a
conflicting fixed literal; otherwise the remaining live literals are returned.
Equations
- term.restrict rho = if Algebraic.AC0.LiteralSet.ConflictsWith term rho then none else some (Algebraic.AC0.LiteralSet.residual term rho)
Instances For
A conflicting partial assignment makes a term false under every completion.
In the absence of a conflict, evaluating the residual term is exactly evaluation of the original term under the partial assignment.
Any residual returned by term restriction has no greater width than the source term.
A disjunction of distinct-variable literals.
Equations
Instances For
A complete input satisfies a clause when it satisfies at least one occurring literal.
Equations
- clause.SatisfiedBy input = ∃ (index : Fin n) (value : Bool), clause.requirements index = some value ∧ input index = value
Instances For
Equations
- clause.satisfiedByDecidable input = id inferInstance
Restrict a clause. none denotes a clause made constantly true by a
satisfied fixed literal; otherwise the remaining live literals are returned.
Equations
- clause.restrict rho = if Algebraic.AC0.LiteralSet.HitBy clause rho then none else some (Algebraic.AC0.LiteralSet.residual clause rho)
Instances For
A fixed literal satisfying a clause makes it true under every completion.
If no fixed literal satisfies a clause, evaluating the residual clause is exactly evaluation of the original clause under the partial assignment.
Any residual returned by clause restriction has no greater width than the source clause.
The constantly false DNF.
Instances For
The constantly true DNF, represented by one empty term.
Equations
Instances For
Every term in the DNF has width at most bound.
Equations
- formula.WidthAtMost bound = ∀ term ∈ formula.terms, Algebraic.AC0.LiteralSet.width term ≤ bound
Instances For
Restrict each term and discard those made constantly false.
Equations
- formula.restrict rho = { terms := List.filterMap (fun (term : Algebraic.AC0.Term n) => term.restrict rho) formula.terms }
Instances For
Restriction preserves an upper bound on DNF term width.
A DNF width bound remains valid after increasing the allowance.
The constantly true CNF.
Instances For
The constantly false CNF, represented by one empty clause.
Equations
- Algebraic.AC0.CNF.bottom = { clauses := [Algebraic.AC0.LiteralSet.empty] }
Instances For
Every clause in the CNF has width at most bound.
Equations
- formula.WidthAtMost bound = ∀ clause ∈ formula.clauses, Algebraic.AC0.LiteralSet.width clause ≤ bound
Instances For
Restrict each clause and discard those made constantly true.
Equations
- formula.restrict rho = { clauses := List.filterMap (fun (clause : Algebraic.AC0.Clause n) => clause.restrict rho) formula.clauses }
Instances For
Restriction preserves an upper bound on CNF clause width.
A CNF width bound remains valid after increasing the allowance.