Skip to content

Commit

Permalink
+ unification w/o occurs-check example
Browse files Browse the repository at this point in the history
  • Loading branch information
lrizzato committed May 7, 2020
1 parent 374937f commit b59daf3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package it.unibo.tuprolog.examples.unify
import it.unibo.tuprolog.core.*
import it.unibo.tuprolog.unify.Unificator

// TODO: with/without occurs-check

fun main() {
val unificator = Unificator.default

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
package it.unibo.tuprolog.examples.unify

import it.unibo.tuprolog.core.Scope
import it.unibo.tuprolog.dsl.unify.prolog
import it.unibo.tuprolog.unify.Unificator

fun main() {
prolog {
Scope.empty {
val term = "g"("X", "Y")
val otherTerm = "g"("f"("X"), "a")

val unificator = Unificator.default

val mgu = unificator.mgu(term, otherTerm, occurCheckEnabled = false)
println(mgu) // {X_0=f(X_0), Y_1=a} => WRONG
}
}
}

0 comments on commit b59daf3

Please sign in to comment.