Skip to content

Commit

Permalink
+ substitution contradiction example
Browse files Browse the repository at this point in the history
  • Loading branch information
lrizzato committed May 8, 2020
1 parent 903db05 commit a5963b5
Showing 1 changed file with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package it.unibo.tuprolog.examples.core

import it.unibo.tuprolog.core.Scope
import it.unibo.tuprolog.core.Substitution

/**
*
*
* @author Lorenzo
*/
fun main() {
Scope.empty {
val term = structOf("father", varOf("X"), atomOf("isaac"))

val sub1 = Substitution.of(varOf("X"), atomOf("abraham"))
val sub2 = Substitution.of(varOf("X"), atomOf("nahor"))

val substitution = sub1 + sub2 // contradiction!
val result = substitution.applyTo(term) // father(X_0, isaac) (substitution could not be performed)

println(substitution)
println(result)
}
}

0 comments on commit a5963b5

Please sign in to comment.