Package net.sf.tweety.logics.fol.syntax
Class FolAtom
- java.lang.Object
-
- net.sf.tweety.logics.commons.syntax.RelationalFormula
-
- net.sf.tweety.logics.fol.syntax.FolFormula
-
- net.sf.tweety.logics.fol.syntax.FolAtom
-
- All Implemented Interfaces:
net.sf.tweety.commons.Formula,net.sf.tweety.logics.commons.syntax.interfaces.Atom,net.sf.tweety.logics.commons.syntax.interfaces.ClassicalFormula,net.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula,net.sf.tweety.logics.commons.syntax.interfaces.Conjunctable,net.sf.tweety.logics.commons.syntax.interfaces.Disjunctable,net.sf.tweety.logics.commons.syntax.interfaces.Invertable,net.sf.tweety.logics.commons.syntax.interfaces.LogicStructure,net.sf.tweety.logics.commons.syntax.interfaces.ProbabilityAware,net.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula,net.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
public class FolAtom extends FolFormula implements net.sf.tweety.logics.commons.syntax.interfaces.Atom
An atom in first-order logic, i.e. a predicate and a list of argument terms.- Author:
- Matthias Thimm
-
-
Constructor Summary
Constructors Constructor Description FolAtom()Default-Ctor: Creates new empty FOL-AtomFolAtom(net.sf.tweety.logics.commons.syntax.Predicate predicate)Creates a new atom with the given predicate and initializes an empty argument list.FolAtom(net.sf.tweety.logics.commons.syntax.Predicate predicate, List<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> arguments)Creates a new atom with the given predicate and list of termsFolAtom(net.sf.tweety.logics.commons.syntax.Predicate predicate, net.sf.tweety.logics.commons.syntax.interfaces.Term<?>... terms)FolAtom(FolAtom other)
-
Method Summary
Modifier and Type Method Description voidaddArgument(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> term)Appends the given argument to this atom's arguments and returns itself.FolAtomclone()FolFormulacollapseAssociativeFormulas()This method collapses all associative operations appearing in this term, e.g.booleancontainsQuantifier()booleanequals(Object obj)List<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>getArguments()Set<FolAtom>getAtoms()Set<net.sf.tweety.logics.commons.syntax.Functor>getFunctors()StringgetName()net.sf.tweety.logics.commons.syntax.PredicategetPredicate()Returns the predicate of this atomSet<net.sf.tweety.logics.commons.syntax.Predicate>getPredicates()Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>getTerms()<C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>>
Set<C>getTerms(Class<C> cls)Set<net.sf.tweety.logics.commons.syntax.Variable>getUnboundVariables()inthashCode()booleanisClosed()booleanisClosed(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)booleanisComplete()Checks whether this atom is complete, i.e.booleanisDnf()Checks whether this formula is in disjunctive normal form.booleanisLiteral()booleanisWellBound()booleanisWellBound(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)net.sf.tweety.logics.commons.syntax.interfaces.Atom.RETURN_SET_PREDICATEsetPredicate(net.sf.tweety.logics.commons.syntax.Predicate newer)FolAtomsubstitute(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t)FolFormulatoNnf()Makes the negation normal form of this formula.StringtoString()-
Methods inherited from class net.sf.tweety.logics.fol.syntax.FolFormula
combineWithAnd, combineWithOr, complement, getQuantifierVariables, getSignature, getUniformProbability, toDnf
-
Methods inherited from class net.sf.tweety.logics.commons.syntax.RelationalFormula
allGroundInstances, allSubstitutions, containsTermsOfType, exchange, getFormula, getPredicateCls, getSatisfactionRatio, isGround, isWellFormed, substitute
-
-
-
-
Constructor Detail
-
FolAtom
public FolAtom()
Default-Ctor: Creates new empty FOL-Atom
-
FolAtom
public FolAtom(net.sf.tweety.logics.commons.syntax.Predicate predicate)
Creates a new atom with the given predicate and initializes an empty argument list.- Parameters:
predicate- the predicate of the atom.
-
FolAtom
public FolAtom(net.sf.tweety.logics.commons.syntax.Predicate predicate, net.sf.tweety.logics.commons.syntax.interfaces.Term<?>... terms)
-
FolAtom
public FolAtom(net.sf.tweety.logics.commons.syntax.Predicate predicate, List<? extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> arguments)Creates a new atom with the given predicate and list of terms- Parameters:
predicate- the predicate of the atomarguments- the arguments (terms) of the atom
-
FolAtom
public FolAtom(FolAtom other)
-
-
Method Detail
-
addArgument
public void addArgument(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> term) throws IllegalArgumentExceptionAppends the given argument to this atom's arguments and returns itself.- Specified by:
addArgumentin interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom- Parameters:
term- an argument to be added- Throws:
IllegalArgumentException- if the given term does not correspond to the expected sort or the argument list is complete.
-
substitute
public FolAtom substitute(net.sf.tweety.logics.commons.syntax.interfaces.Term<?> v, net.sf.tweety.logics.commons.syntax.interfaces.Term<?> t) throws IllegalArgumentException
- Specified by:
substitutein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Specified by:
substitutein classFolFormula- Throws:
IllegalArgumentException
-
getAtoms
public Set<FolAtom> getAtoms()
- Specified by:
getAtomsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
getAtomsin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
isComplete
public boolean isComplete()
Checks whether this atom is complete, i.e. whether every argument is set.- Specified by:
isCompletein interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom- Returns:
- "true" if the atom is complete.
-
getUnboundVariables
public Set<net.sf.tweety.logics.commons.syntax.Variable> getUnboundVariables()
- Specified by:
getUnboundVariablesin interfacenet.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
-
getPredicates
public Set<net.sf.tweety.logics.commons.syntax.Predicate> getPredicates()
- Specified by:
getPredicatesin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
-
getFunctors
public Set<net.sf.tweety.logics.commons.syntax.Functor> getFunctors()
- Specified by:
getFunctorsin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
isClosed
public boolean isClosed()
- Specified by:
isClosedin interfacenet.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
-
isClosed
public boolean isClosed(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)
- Specified by:
isClosedin interfacenet.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
-
isWellBound
public boolean isWellBound()
- Specified by:
isWellBoundin interfacenet.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
-
isWellBound
public boolean isWellBound(Set<net.sf.tweety.logics.commons.syntax.Variable> boundVariables)
- Specified by:
isWellBoundin interfacenet.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
-
containsQuantifier
public boolean containsQuantifier()
- Specified by:
containsQuantifierin interfacenet.sf.tweety.logics.commons.syntax.interfaces.QuantifiedFormula
-
getPredicate
public net.sf.tweety.logics.commons.syntax.Predicate getPredicate()
Returns the predicate of this atom- Specified by:
getPredicatein interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom- Returns:
- the predicate of this atom
-
getArguments
public List<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getArguments()
- Specified by:
getArgumentsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom- Returns:
- the arguments of this atom.
-
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.
-
isLiteral
public boolean isLiteral()
- Specified by:
isLiteralin interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula
-
toString
public String toString()
- Specified by:
toStringin classnet.sf.tweety.logics.commons.syntax.RelationalFormula
-
toNnf
public FolFormula toNnf()
Description copied from class:FolFormulaMakes the negation normal form of this formula.- Specified by:
toNnfin classFolFormula- Returns:
- the NNF of this formula
-
collapseAssociativeFormulas
public FolFormula 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.
-
hashCode
public int hashCode()
-
equals
public boolean equals(Object obj)
-
getTerms
public Set<net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> getTerms()
- Specified by:
getTermsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
-
getTerms
public <C extends net.sf.tweety.logics.commons.syntax.interfaces.Term<?>> Set<C> getTerms(Class<C> cls)
- Specified by:
getTermsin interfacenet.sf.tweety.logics.commons.syntax.interfaces.LogicStructure
-
clone
public FolAtom clone()
- Specified by:
clonein interfacenet.sf.tweety.logics.commons.syntax.interfaces.ComplexLogicalFormula- Specified by:
clonein interfacenet.sf.tweety.logics.commons.syntax.interfaces.SimpleLogicalFormula- Specified by:
clonein classFolFormula
-
setPredicate
public net.sf.tweety.logics.commons.syntax.interfaces.Atom.RETURN_SET_PREDICATE setPredicate(net.sf.tweety.logics.commons.syntax.Predicate newer)
- Specified by:
setPredicatein interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom
-
getName
public String getName()
- Specified by:
getNamein interfacenet.sf.tweety.logics.commons.syntax.interfaces.Atom
-
-