Class Formula<T>
A Boolean Formula. Consists of a set of Clause<T>s which all must be true.
public class Formula<T> : HashSet<Clause<T>>, ISerializable, IDeserializationCallback, ISet<Clause<T>>, ICollection<Clause<T>>, IEnumerable<Clause<T>>, IEnumerable, IEquatable<Formula<T>> where T : IEquatable<T>
Type Parameters
T
The underlying type used to identify/compare Literals.
- Inheritance
-
Formula<T>
- Implements
-
ICollection<Clause<T>>IEnumerable<Clause<T>>IEquatable<Formula<T>>
- Inherited Members
Constructors
Formula()
Creates an empty Formula.
public Formula()
Formula(IEnumerable<Clause<T>>)
Creates a Formula consisting the specified clauses
.
public Formula(IEnumerable<Clause<T>> clauses)
Parameters
clauses
IEnumerable<Clause<T>>
Properties
ContainsEmptyClause
Indicates whether this Formula contains any empty Clauses and is therefore unsatisfiable.
public bool ContainsEmptyClause { get; }
Property Value
IsConsistent
Indicates whether this Formula is a consistent set of Literals, i.e. consists only non-conflicting Unit Clauses.
public bool IsConsistent { get; }
Property Value
Methods
Equals(Formula<T>?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(Formula<T>? other)
Parameters
other
Formula<T>An object to compare with this object.
Returns
- bool
true if the current object is equal to the
other
parameter; otherwise, false.
Equals(object?)
public override bool Equals(object? obj)
Parameters
obj
objectThe object to compare with the current object.
Returns
GetHashCode()
Serves as a hash function for a particular type.
public override int GetHashCode()
Returns
GetLiterals()
Returns a set of all Literal<T>s referenced in the Formula.
public IEnumerable<Literal<T>> GetLiterals()
Returns
- IEnumerable<Literal<T>>
GetPureLiterals()
Returns a set of all Literal<T>s referenced in the Formula that are pure, i.e. do not occur both negated and non-negated.
public IEnumerable<Literal<T>> GetPureLiterals()
Returns
- IEnumerable<Literal<T>>
Simplify()
Returns a simplified copy of the Formula. This applies Unit propagation and Pure Literal elimination.
public Formula<T> Simplify()
Returns
- Formula<T>
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
Operators
operator &(Clause<T>, Formula<T>)
Creates a Formula<T> consisting of all Clauses from an existing Formula plus an additional Clause<T>.
public static Formula<T> operator &(Clause<T> clause, Formula<T> formula)
Parameters
Returns
- Formula<T>
operator &(Formula<T>, Clause<T>)
Creates a Formula<T> consisting of all Clauses from an existing Formula plus an additional Clause<T>.
public static Formula<T> operator &(Formula<T> formula, Clause<T> clause)
Parameters
Returns
- Formula<T>