-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
+ substitution contradiction example
- Loading branch information
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
examples/src/main/kotlin/it/unibo/tuprolog/examples/core/SubstitutionContradictionExample.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
} | ||
} |