Package edu.uky.ai.logic
Interface Formula
- All Superinterfaces:
Comparable<Formula>
- All Known Subinterfaces:
Atom
,Literal
,Proposition
- All Known Implementing Classes:
AtomicProposition
,BooleanProposition
,Conjunction
,Constant
,Disjunction
,Implication
,NegatedAtom
,Negation
,Predication
,Term
,Variable
The parent class of all logical formulas.
- Author:
- Stephen G. Ware
-
Method Summary
Modifier and TypeMethodDescriptiondefault int
default boolean
equals
(Formula other, Substitution substitution) Tests whether the formula represented by this object would be the same as another formula under the given substitution.boolean
isGround()
Checks whether this formula contains any variables.substitute
(Substitution substitution) Returns a version of this formula such that any elements that appear in the given substitution are replaced.Finds the bindings that would be necessary to make this formula the same as another formula (if any exist).
-
Method Details
-
compareTo
- Specified by:
compareTo
in interfaceComparable<Formula>
-
equals
Tests whether the formula represented by this object would be the same as another formula under the given substitution.- Parameters:
other
- the other logical formula to be compared tosubstitution
- a substitution- Returns:
- true if the formulas would be the same after performing the substitution, false otherwise
-
isGround
boolean isGround()Checks whether this formula contains any variables.- Returns:
- true if the formula is ground, false otherwise
-
substitute
Returns a version of this formula such that any elements that appear in the given substitution are replaced.- Parameters:
substitution
- the substitution- Returns:
- a formula with replacements from the substitution
-
unify
Finds the bindings that would be necessary to make this formula the same as another formula (if any exist).- Parameters:
other
- the other formulabindings
- an existing set of bindings that will be added to- Returns:
- the bindings that would make both formulas the same, or null if so such bindings exist
-