Object

io.chymyst.util

ConjunctiveNormalForm

Related Doc: package util

Permalink

object ConjunctiveNormalForm

Helper functions that perform computations with Boolean formulas while keeping them in the conjunctive normal form.

A Boolean formula in CNF is represented by a list of lists of an arbitrary type T. For instance, the Boolean formula (a || b) && (c || d || e) is represented as

List( List(a, b), List(c, d, e) )

These helper methods will compute disjunction, conjunction, and negation of Boolean formulas in CNF, outputting the results also in CNF. Simplifications are performed only in so far as to remove exact duplicate terms or clauses such as a || a or (a || b) && (a || b).

The type T represents primitive Boolean terms that cannot be further simplified or factored to CNF. These terms could be represented by expression trees or in another way; the CNF computations do not depend on the representation of terms.

Note that negation such as ! a is considered to be a primitive term. Negation of a conjunction or disjunction, such as ! (a || b), can be simplified to CNF.

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. ConjunctiveNormalForm
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type CNF[T] = List[List[T]]

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. def conjunction[T](a: CNF[T], b: CNF[T]): CNF[T]

    Permalink

    Compute a && b where a and b are Boolean formulas in CNF.

    Compute a && b where a and b are Boolean formulas in CNF.

    T

    Type of primitive Boolean terms.

    a

    A Boolean formula in CNF.

    b

    A Boolean formula in CNF.

    returns

    The resulting Boolean formula in CNF.

  7. def disjunction[T](a: CNF[T], b: CNF[T]): CNF[T]

    Permalink

    Compute a || b where a and b are Boolean formulas in CNF.

    Compute a || b where a and b are Boolean formulas in CNF.

    T

    Type of primitive Boolean terms.

    a

    A Boolean formula in CNF.

    b

    A Boolean formula in CNF.

    returns

    The resulting Boolean formula in CNF.

  8. def disjunctionOneClause[T](a: List[T], b: CNF[T]): CNF[T]

    Permalink

    Compute a || b where a is a single "clause", i.e.

    Compute a || b where a is a single "clause", i.e. a disjunction of primitive Boolean terms, and b is a Boolean formula in CNF.

    T

    Type of primitive Boolean terms.

    a

    A list of primitive Boolean terms. This list represents a single disjunction clause, e.g. List(a, b, c) represents a || b || c.

    b

    A Boolean formula in CNF.

    returns

    The resulting Boolean formula in CNF.

  9. def disjunctionOneTerm[T](a: T, b: CNF[T]): CNF[T]

    Permalink

    Compute a || b where a is a single Boolean term and b is a Boolean formula in CNF.

    Compute a || b where a is a single Boolean term and b is a Boolean formula in CNF.

    T

    Type of primitive Boolean terms.

    a

    Primitive Boolean term that cannot be simplified; does not contain disjunctions or conjunctions.

    b

    A Boolean formula in CNF.

    returns

    The resulting Boolean formula in CNF.

  10. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  12. def falseConstant[T]: CNF[T]

    Permalink

    Represents the constant false value in CNF.

  13. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  14. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  15. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. def negation[T](negateOneTerm: (T) ⇒ T)(a: CNF[T]): CNF[T]

    Permalink

    Compute ! a where a is a Boolean formula in CNF.

    Compute ! a where a is a Boolean formula in CNF.

    T

    Type of primitive Boolean terms.

    negateOneTerm

    A function that describes the transformation of a primitive term under negation. For instance, negateOneTerm(a) should return ! a in the term's appropriate representation.

    a

    A Boolean formula in CNF.

    returns

    The resulting Boolean formula in CNF.

  19. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  20. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  21. def oneTerm[T](a: T): CNF[T]

    Permalink

    Injects a single primitive term into a CNF.

  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  23. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  24. def trueConstant[T]: CNF[T]

    Permalink

    Represents the constant true value in CNF.

  25. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  26. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  27. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped