Interface Literal
public interface Literal
The 
Literal interface represents a logical literal, which can be either a positive or negative
 proposition. Literals are fundamental components in propositional logic and SAT solvers. They can be
 used to construct clauses, represent assumptions, and encode constraints.
 - Author:
- Mathias Hofer
- 
Method SummaryModifier and TypeMethodDescriptionstatic Literalcreate()Creates a new unnamed atom literal.static LiteralCreates a new named atom literal with the specified name.static LiteralCreates a new transient atom literal.getAtom()Retrieves the atom of this literal.getName()Returns the name of this literal.booleanChecks if this literal is positive.booleanChecks if this literal is transient.neg()Returns the negation of this literal.
- 
Method Details- 
isTransientboolean isTransient()Checks if this literal is transient. Transient literals are usually temporary and are not used as permanent identifiers.- Returns:
- trueif the literal is transient,- falseotherwise
 
- 
isPositiveboolean isPositive()Checks if this literal is positive. A positive literal represents a proposition in its original form, whereas a negative literal represents the negation of a proposition.- Returns:
- trueif the literal is positive,- falseif it is negative
 
- 
getAtomLiteral getAtom()Retrieves the atom of this literal. If the literal is a negation, this method returns the encapsulated atom. If the literal is an atom, it returns itself.- Returns:
- the atom of the literal, or this literal if it is an atom
 
- 
getNameString getName()Returns the name of this literal. The name may benullif the literal does not have a specific name (e.g., in the case of transient literals).- Returns:
- the name of the literal, or nullif it does not have a name
 
- 
negLiteral neg()Returns the negation of this literal. The following properties hold for every literall:- l.neg().neg() == l: The negation of the negation returns the original literal.
- l.neg().getAtom() == l.getAtom(): The negation of the literal has the same atom.
 l:- l.neg() == l.neg(): The negation of a literal might not be equal to itself.
 - Returns:
- the negation of this literal
 
- 
createCreates a new unnamed atom literal. This is a default literal without any specific name.- Returns:
- a new unnamed atom literal
 
- 
createCreates a new named atom literal with the specified name. If the provided name isnull, an unnamed atom literal is created instead.- Parameters:
- name- the name of the literal, or- nullfor an unnamed literal
- Returns:
- a new named atom literal, or an unnamed atom literal if the name is null
 
- 
createTransientCreates a new transient atom literal. Transient literals are typically used for temporary or intermediate purposes and do not have a permanent name.- Returns:
- a new transient atom literal
 
 
-