Interface FOFormulaConjunction
- All Superinterfaces:
FOFormula, fr.inria.rules.dlgpemodel.api.formulas.IConjunction, fr.inria.rules.dlgpemodel.api.formulas.IFormula, fr.inria.rules.dlgpemodel.api.sentences.IPrintable, Substitutable<FOFormula>, TermCompound
- All Known Implementing Classes:
FOConjunctionFactBaseWrapper, FOConjunctionImpl
public non-sealed interface FOFormulaConjunction
extends FOFormula, fr.inria.rules.dlgpemodel.api.formulas.IConjunction
Representation of a conjunction (logical AND) of first‑order sub‑formulas.
A conjunction groups several sub‑formulas that are all required to hold
simultaneously. This interface provides helper operations specific to such
compound structures—most notably flattenedSubFormulas(), which
removes any nested conjunctions and exposes only the "atomic" components
of the formula.
- Author:
- Florent Tornil, Guillaume Pérution-Kihli
-
Field Summary
Fields inherited from interface fr.inria.rules.dlgpemodel.api.sentences.IPrintable
WRITER -
Method Summary
Modifier and TypeMethodDescriptiondefault FOFormulaConjunctionapplySubstitution(Substitution substitution) Applies a substitution without evaluating nested functions.applySubstitution(Substitution substitution, boolean evaluate) Applies a substitution to this formula.Recursively flattens this conjunction by expanding any nested conjunctions and returning aStreamthat contains only sub‑formulas which are not conjunctions themselves.Collection<? extends FOFormula> Returns an unmodifiable collection containing the direct sub‑formulas of this conjunction, in their original order.default booleanIndicates whether this formula node is a conjunction.Methods inherited from interface FOFormula
asAtomSet, asBooleanQuery, copy, getPredicates, isAtomic, isDisjunction, isNegationMethods inherited from interface fr.inria.rules.dlgpemodel.api.formulas.IConjunction
exportsMethods inherited from interface fr.inria.rules.dlgpemodel.api.sentences.IPrintable
toDLGPEMethods inherited from interface TermCompound
getAllNestedTerms, getConstants, getLiterals, getNestedTerms, getTerms, getVariables
-
Method Details
-
isConjunction
default boolean isConjunction()Description copied from interface:FOFormulaIndicates whether this formula node is a conjunction.- Specified by:
isConjunctionin interfaceFOFormula- Returns:
- true iff this node of the formula is a conjunction
-
getSubElements
Collection<? extends FOFormula> getSubElements()Returns an unmodifiable collection containing the direct sub‑formulas of this conjunction, in their original order.- Specified by:
getSubElementsin interfacefr.inria.rules.dlgpemodel.api.formulas.IConjunction- Returns:
- the direct sub‑formulas of this conjunction
-
applySubstitution
Description copied from interface:FOFormulaApplies a substitution without evaluating nested functions.- Specified by:
applySubstitutionin interfaceFOFormula- Specified by:
applySubstitutionin interfaceSubstitutable<FOFormula>- Parameters:
substitution- the substitution to apply- Returns:
- the substituted formula
-
applySubstitution
Description copied from interface:FOFormulaApplies a substitution to this formula.- Specified by:
applySubstitutionin interfaceFOFormula- Specified by:
applySubstitutionin interfaceSubstitutable<FOFormula>- Parameters:
substitution- the substitution to applyevaluate- whether evaluable functions should be evaluated- Returns:
- the substituted formula
-
flattenedSubFormulas
Recursively flattens this conjunction by expanding any nested conjunctions and returning aStreamthat contains only sub‑formulas which are not conjunctions themselves.Conceptually, the transformation performed is:
(A ∧ (B ∧ C) ∧ D) ⟼ (A ∧ B ∧ C ∧ D)
The method is implemented lazily—no intermediate collections are created and elements are produced on demand.- Returns:
- a sequential stream of the atomic sub‑formulas of this conjunction, with all nested conjunction layers removed Note: The traversal is depth‑first and preserves the left‑to‑right order of the original formula.
-