This repository has been archived on 2025-09-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
2025LogProg-project-GhentPr.../src/prolog/builtins/other.kt
2025-05-09 19:49:37 +02:00

23 lines
758 B
Kotlin

package prolog.builtins
import prolog.Answers
import prolog.Substitutions
import prolog.ast.logic.LogicOperand
import prolog.ast.logic.LogicOperator
import prolog.ast.terms.Goal
class Query(val query: LogicOperand) : LogicOperator("?-", rightOperand = query) {
override fun satisfy(subs: Substitutions): Answers = query.satisfy(subs)
}
/**
* For all alternative bindings of Cond, Action can be proven.
* It does not say which is wrong if one proves wrong.
*
* @see [SWI-Prolog Predicate forall/2](https://www.swi-prolog.org/pldoc/doc_for?object=forall/2)
*/
class ForAll(private val condition: LogicOperand, private val action: Goal) :
Not(Conjunction(condition, Not(action))) {
override fun toString() = "forall($condition, $action)"
}