package prolog.ast.terms

import prolog.Answers
import prolog.Substitutions
import prolog.ast.Database.Program
import prolog.ast.logic.LogicOperand

/**
 * Ask the Prolog engine.
 *
 * A goal is either an [Atom] or a [CompoundTerm].
 * A goal either [succeeds][prolog.builtins.True], in which case the variables in the compound terms have a binding,
 * or it fails if Prolog fails to prove it.
 */
abstract class Goal : LogicOperand(), Term {
    abstract val functor: Functor

    override fun satisfy(subs: Substitutions): Answers = Program.solve(this, subs)
}