Portability | non-portable |
---|---|
Stability | experimental |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Safe Haskell | Trustworthy |
- newtype Clause = Clause {}
- clauseLiterals :: Clause -> [Literal]
- newtype Formula = Formula {
- formulaSet :: Set Clause
- formulaEmpty :: Formula
- formulaLiteral :: Literal -> Formula
- formulaNot :: Literal -> Literal -> Formula
- formulaAnd :: Literal -> [Literal] -> Formula
- formulaOr :: Literal -> [Literal] -> Formula
- formulaXor :: Literal -> Literal -> Literal -> Formula
- formulaMux :: Literal -> Literal -> Literal -> Literal -> Formula
Clauses
A disjunction of possibly negated atoms. Negated atoms are represented by negating the identifier.
clauseLiterals :: Clause -> [Literal]Source
Extract the (possibly negated) atoms referenced by a Clause
.
Formulas
A conjunction of clauses
A formula with no clauses
formulaLiteral :: Literal -> FormulaSource
Assert a literal
The boolean not operation
Derivation of the Tseitin transformation:
O ≡ ¬A (O → ¬A& (¬O → A (¬O | ¬A& (O | A)
The boolean and operation
Derivation of the Tseitin transformation:
O ≡ (A & B & C) (O → (A& B & C)) & (¬O → ¬& B & C)) (¬O | (A& B & C)) & (O | ¬(A& B & C)) (¬O | A)& (¬O | B)& (¬O | C)& (O | ¬A | ¬B | ¬
The boolean or operation
Derivation of the Tseitin transformation:
O ≡ (A | B | C) (O → (A | B | C))& (¬O → ¬(A | B | C (¬O | (A | B | C))& (O | ¬(A | B | C)) (¬O | A | B | C)& (O | (¬A& ¬B& ¬C)) (¬O | A | B | C)& (O | ¬A)& (O | ¬B)& (O | ¬C)
The boolean xor operation
Derivation of the Tseitin transformation:
O ≡ A ⊕ B O ≡ ((¬A& B) | (A & ¬B)) (O → ((¬& B) | (A & ¬B)))& (¬O → ¬(& B) | (A & ¬B)))
Left hand side:
O → ((¬& B) | (A & ¬B)) ¬O | ((¬& B) | (A & ¬B)) ¬O | ((¬A | A& (¬A | ¬B& (A | B) & (¬B | B)) ¬O | ((¬A | ¬& (A | B)) (¬O | ¬A | ¬& (¬O | A | B)
Right hand side:
¬O → ¬(& B) | (A & ¬B)) O | ¬((¬& B) | (A & ¬B)) O | (¬(¬& B) & ¬(A& ¬B)) O | ((A | ¬B)& (¬A | B)) (O | ¬A | B)& (O | A | ¬B)
Result:
(¬O | ¬A | ¬& (¬O | A | B)& (O | ¬A | B)& (O | A | ¬B)
:: Literal | Output |
-> Literal | False branch |
-> Literal | True branch |
-> Literal | Predicate/selector |
-> Formula |
The boolean else-then-if or mux operation
Derivation of the Tseitin transformation:
O ≡ (F & ¬P) | (T& P) (O → ((F& ¬P) | (T& P))) & (¬O → ¬(& ¬P) | (T& P)))
Left hand side:
O → ((F& ¬P) | (T& P)) ¬O | ((F& ¬P) | (T& P)) ¬O | ((F | T)& (F | P) & (T | ¬P)& (¬P | P)) ¬O | ((F | T)& (F | P) & (T | ¬P)) (¬O | F | T)& (¬O | F | P)& (¬O | T | ¬P
Right hand side:
¬O → ¬(& ¬P) | (T& P)) O | ¬((F& ¬P) | (T& P)) O | (¬(F& ¬P)& ¬(T& P)) O | ((¬F | P)& (¬T | ¬P) (O | ¬F | P)& (O | ¬T | ¬P
Result:
(¬O | F | T)& (¬O | F | P)& (¬O | T | ¬P& (O | ¬F | P)& (O | ¬T | ¬P