Package org.tweetyproject.lp.nlp.syntax
Class NLPNot
java.lang.Object
org.tweetyproject.logics.commons.syntax.RelationalFormula
org.tweetyproject.logics.fol.syntax.FolFormula
org.tweetyproject.lp.nlp.syntax.NLPNot
- All Implemented Interfaces:
Formula,ClassicalFormula,ComplexLogicalFormula,Conjunctable,Disjunctable,Invertable,LogicStructure,ProbabilityAware,QuantifiedFormula,SimpleLogicalFormula
A default negation of a first order formula, nested logic programs
only allow not quantified formulas. The NLPNot wraps a FOLFormula
and checks that this formula does not contain quantifiers, the functionality
is delegated to the used inner formula instance.
- Author:
- Tim Janus
-
Constructor Summary
ConstructorsConstructorDescriptionNLPNot(FolFormula inner) Ctor: Creates a new default not for nested logic programs by using the given FOL formula as inner formula. -
Method Summary
Modifier and TypeMethodDescriptionclone()Creates a deep copy of this formulaThis method collapses all associative operations appearing in this term, e.g.booleanChecks whether this formula contains any quantification.booleangetAtoms()Processes the set of all atoms which appear in this formulaProcesses the set of all predicates which appear in this formulagetTerms()Processes the set containing all terms of type C.inthashCode()booleanisClosed()Checks whether this formula is closed, i.e.booleanChecks whether this formula is closed, i.e.booleanisDnf()Checks whether this formula is in disjunctive normal form.booleanbooleanChecks whether this formula is well-bound, i.e.booleanisWellBound(Set<Variable> boundVariables) Checks whether this formula is well-bound, i.e.substitute(Term<?> v, Term<?> t) Substitutes all occurrences of term "v" in this formula by term "t" and returns the new formula.toNnf()Makes the negation normal form of this formula.toString()Methods inherited from class org.tweetyproject.logics.fol.syntax.FolFormula
combineWithAnd, combineWithOr, complement, getQuantifierVariables, getSignature, getUniformProbability, toDnfMethods inherited from class org.tweetyproject.logics.commons.syntax.RelationalFormula
allGroundInstances, allSubstitutions, containsTermsOfType, exchange, getFormula, getPredicateCls, getSatisfactionRatio, isGround, isWellFormed, substitute
-
Constructor Details
-
NLPNot
Ctor: Creates a new default not for nested logic programs by using the given FOL formula as inner formula.- Parameters:
inner- The FOL formula used as inner formula.
-
-
Method Details
-
getPredicates
Description copied from interface:SimpleLogicalFormulaProcesses the set of all predicates which appear in this formula- Returns:
- all predicates that appear in this formula
-
isLiteral
public boolean isLiteral()- Returns:
- true if the formula represents a literal in the language or false otherwise
-
getUnboundVariables
- Returns:
- a set of of unbound variables
-
containsQuantifier
public boolean containsQuantifier()Description copied from interface:QuantifiedFormulaChecks whether this formula contains any quantification.- Returns:
- "true" if this formula contains a quantification.
-
isWellBound
public boolean isWellBound()Description copied from interface:QuantifiedFormulaChecks whether this formula is well-bound, i.e. whether no variable bound by a quantifier is again bound by another quantifier within the first quantifier's range.- Returns:
- "true" if this formula is well-bound, "false" otherwise.
-
isWellBound
Description copied from interface:QuantifiedFormulaChecks whether this formula is well-bound, i.e. whether no variable bound by a quantifier is again bound by another quantifier within the first quantifier range. Every variable in "boundVariables" is assumed to be bound already.- Parameters:
boundVariables- the variables assumed to be bound.- Returns:
- "true" if this formula is well-bound, "false" otherwise.
-
isClosed
public boolean isClosed()Description copied from interface:QuantifiedFormulaChecks whether this formula is closed, i.e. whether every variables occurring in the formula is bound by a quantifier.- Returns:
- "true" if this formula is closed, "false" otherwise.
-
isClosed
Description copied from interface:QuantifiedFormulaChecks whether this formula is closed, i.e. whether every variables occurring in the formula is bound by a quantifier. Every variable in "boundVariables" is already assumed to be bound.- Parameters:
boundVariables- the variables assumed to be bound.- Returns:
- "true" if this formula is closed wrt. "boundVariables", "false" otherwise.
-
getTerms
- Returns:
- a set containing all terms of this logical structure
-
getTerms
Description copied from interface:LogicStructureProcesses the set containing all terms of type C. This method uses the equals method of the given Class and therefore does not add terms which are sub classes of type C to the set.- Type Parameters:
C- the type of terms- Parameters:
cls- The Class structure containing type information about the searched term- Returns:
- A set containing all terms of type C of this logical structure
-
toNnf
Description copied from class:FolFormulaMakes the negation normal form of this formula.- Specified by:
toNnfin classFolFormula- Returns:
- the NNF of this formula
-
collapseAssociativeFormulas
Description copied from class:FolFormulaThis method collapses all associative operations appearing in this term, e.g. every a||(b||c) becomes a||b||c.- Specified by:
collapseAssociativeFormulasin classFolFormula- Returns:
- the collapsed formula.
-
isDnf
public boolean isDnf()Description copied from class:FolFormulaChecks whether this formula is in disjunctive normal form.- Specified by:
isDnfin classFolFormula- Returns:
- "true" iff this formula is in disjunctive normal form.
-
substitute
Description copied from class:RelationalFormulaSubstitutes all occurrences of term "v" in this formula by term "t" and returns the new formula. NOTE: if "v" is a variable and bound to a quantifier then "v" is not substituted in that quantifiers inner formula.- Specified by:
substitutein interfaceComplexLogicalFormula- Specified by:
substitutein classFolFormula- Parameters:
v- the term to be substituted.t- the term to substitute.- Returns:
- a formula where every occurrence of "v" is replaced by "t".
- Throws:
IllegalArgumentException- if "v" and "t" are of different sorts (NOTE: this exception is only thrown when "v" actually appears in this formula).
-
clone
Description copied from interface:SimpleLogicalFormulaCreates a deep copy of this formula- Specified by:
clonein interfaceComplexLogicalFormula- Specified by:
clonein interfaceSimpleLogicalFormula- Specified by:
clonein classFolFormula- Returns:
- the cloned formula
-
getAtoms
Description copied from interface:SimpleLogicalFormulaProcesses the set of all atoms which appear in this formula- Specified by:
getAtomsin interfaceSimpleLogicalFormula- Specified by:
getAtomsin classRelationalFormula- Returns:
- all atoms that appear in this formula.
-
getFunctors
- Specified by:
getFunctorsin classRelationalFormula- Returns:
- all functors that appear in this formula.
-
toString
- Specified by:
toStringin classRelationalFormula
-
equals
- Specified by:
equalsin interfaceSimpleLogicalFormula- Overrides:
equalsin classObject
-
hashCode
public int hashCode()- Specified by:
hashCodein interfaceSimpleLogicalFormula- Overrides:
hashCodein classObject
-