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
  • Method Details

    • isConjunction

      default boolean isConjunction()
      Description copied from interface: FOFormula
      Indicates whether this formula node is a conjunction.
      Specified by:
      isConjunction in interface FOFormula
      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:
      getSubElements in interface fr.inria.rules.dlgpemodel.api.formulas.IConjunction
      Returns:
      the direct sub‑formulas of this conjunction
    • applySubstitution

      default FOFormulaConjunction applySubstitution(Substitution substitution)
      Description copied from interface: FOFormula
      Applies a substitution without evaluating nested functions.
      Specified by:
      applySubstitution in interface FOFormula
      Specified by:
      applySubstitution in interface Substitutable<FOFormula>
      Parameters:
      substitution - the substitution to apply
      Returns:
      the substituted formula
    • applySubstitution

      FOFormulaConjunction applySubstitution(Substitution substitution, boolean evaluate)
      Description copied from interface: FOFormula
      Applies a substitution to this formula.
      Specified by:
      applySubstitution in interface FOFormula
      Specified by:
      applySubstitution in interface Substitutable<FOFormula>
      Parameters:
      substitution - the substitution to apply
      evaluate - whether evaluable functions should be evaluated
      Returns:
      the substituted formula
    • flattenedSubFormulas

      default Stream<FOFormula> flattenedSubFormulas()
      Recursively flattens this conjunction by expanding any nested conjunctions and returning a Stream that 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.