Formulas #
This file provides typeclasses for formulas and different operations these formulas can support. Note that this file does not implement any of these operations, but it formalizes what these operations should do. More specifically the file contains
- some functions for working with
Validator.VarSet', - definitions and methods for models, partial models, literals, clauses, cubes, CNF-formulas and DNF-formulas, and
- type classes for formulas and various operations on formulas.
VarSet' #
Instances For
Equations
- V.union V' = ⟨(↑V).mergeDedup ↑V', ⋯⟩
Instances For
Model and PartialModel #
Model is usually in the in the context of a formula, where it represents a model of this formula,
i.e. an assignment of variables making the formula true.
It is used to show the correctness of operations.
Equations
- Validator.Formula.Model n = (Fin n → Prop)
Instances For
A set of models.
Equations
Instances For
Partial models are partial assignments. In contrast to Model, these are used at runtime.
Equations
Instances For
Literal #
A Literal is a variable i (represented by (i, true)) or
its negation (represented by (i, false)).
Equations
- Validator.Formula.Literal n = (Fin n × Bool)
Instances For
Equations
Clause #
A clause is a disjuction of literals.
Equations
Instances For
Cube #
A cube is a conjunction of literals.
Equations
Instances For
Equations
- δ.consistent = List.all δ fun (l : Validator.Formula.Literal n) => decide (l.negate ∉ δ)
Instances For
The negation of a clause
Equations
Instances For
The negation of a cube
Equations
Instances For
CNF #
A CNF-formula is a conjunction of clauses.
Equations
Instances For
DNF #
A DNF-formula is a conjunction of cubes.
Equations
Instances For
Formula #
Type class for formulas with variables Fin n. The variables are ordered by ordering <.
- vars (φ : R) : VarSet' n
The variables associated with the formula
φ. Note that not all of these variables need to 'appear' inφ. - models (φ : R) : Models n
The models of the formula
φ - models_equiv_right (φ : R) (M M' : Model n) : (∀ i ∈ ↑(vars φ), M i = M' i) → M ∈ models φ → M' ∈ models φ
If two assignments coincide on the variables of
φ, then the second is a model ofφif the first one is a model ofφ.
Instances
Operations on Formulas #
- consistent (φ : R) : Bool
Instances
The time complexity of andList is generally bad, therefore it should only be used
if the number of conjuncts is bounded.
Equations
Instances For
The timecomplexity of andList is generally bad, therefore it should only be used
if the number of conjuncts is bounded.
Equations
Instances For
- ofPartialModel (V : VarSet' n) : PartialModel V → R
- ofPartialModel_correct {V : VarSet' n} {M : PartialModel V} : models (ofPartialModel V M) = M.models ∧ vars (ofPartialModel V M) = V
Instances
Equations
- Validator.Formula.Model.rename r M i = M (r.rename i)
Instances For
Equations
Instances For
Equations
Instances For
Renaming consistent with order
Instances
Renaming consistent with order