Copyright | © Edward Kmett 2010-2014, Johan Kiviniemi 2013 |
---|---|
License | BSD3 |
Maintainer | Edward Kmett <ekmett@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | Trustworthy |
Language | Haskell2010 |
- 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
formulaEmpty :: Formula Source
A formula with no clauses
formulaLiteral :: Literal -> Formula Source
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 → ¬(A & B & C)) (¬O | (A & B & C)) & (O | ¬(A & B & C)) (¬O | A) & (¬O | B) & (¬O | C) & (O | ¬A | ¬B | ¬C)
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 → ((¬A & B) | (A & ¬B))) & (¬O → ¬((¬A & B) | (A & ¬B)))
Left hand side:
O → ((¬A & B) | (A & ¬B)) ¬O | ((¬A & B) | (A & ¬B)) ¬O | ((¬A | A) & (¬A | ¬B) & (A | B) & (¬B | B)) ¬O | ((¬A | ¬B) & (A | B)) (¬O | ¬A | ¬B) & (¬O | A | B)
Right hand side:
¬O → ¬((¬A & B) | (A & ¬B)) O | ¬((¬A & B) | (A & ¬B)) O | (¬(¬A & B) & ¬(A & ¬B)) O | ((A | ¬B) & (¬A | B)) (O | ¬A | B) & (O | A | ¬B)
Result:
(¬O | ¬A | ¬B) & (¬O | A | B) & (O | ¬A | B) & (O | A | ¬B)
The boolean else-then-if or mux operation
Derivation of the Tseitin transformation:
O ≡ (F & ¬P) | (T & P) (O → ((F & ¬P) | (T & P))) & (¬O → ¬((F & ¬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 → ¬((F & ¬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)