Getting Started
This page takes you from nothing to a first working evaluation. If you only want to try the framework out, start with the Web Playground — it needs no project setup at all.
Try it without installing anything
Ready-made environments run Arg2P without any configuration:
- the Web Playground, which runs entirely in your browser;
- the extension of VS Code, which edits
theories as
.arg2pfiles and solves them beside the editor.
Both accept a theory, run queries against it, draw the resulting argumentation graph and let you change the flags interactively.
Your first theory
Arg2P reasons about theories made of rules that can conflict with each other. Here are two premises that support opposite conclusions:
f1 :=> d.
f2 :=> -d.:=> introduces a defeasible premise, and - is strong negation. So this theory says: there is a reason to
believe d, and a reason to believe the opposite. Neither wins, and argumentation tells us precisely that.
Ask the engine what it makes of d:
?- arg2p::solve(d, Res).
Res = [und(d)]d is undecided: it is supported by an argument, that argument is attacked by the one for -d, and
neither defeats the other. Add a preference between the two premises:
f1 :=> d.
f2 :=> -d.
sup(f1, f2).and the answer changes:
?- arg2p::solve(d, Res).
Res = [in(d)]f1 is now stronger, so its argument defeats the other and d is accepted.
Both versions can be run without installing anything: the first one and the one with the preference.
The Language page describes the full syntax: strict rules, undercutting, obligations and permissions, burden of persuasion.
Using it from Kotlin
Add the dependency:
repositories {
mavenCentral()
}
dependencies {
implementation("it.unibo.tuprolog.argumentation:arg2p-jvm:0.25.1")
}Then evaluate a theory and read the labelling:
import it.unibo.tuprolog.argumentation.Arg2p
fun main() {
val (graph) =
Arg2p.of(
"""
f1 :=> d.
f2 :=> -d.
""".trimIndent(),
).graphs()
graph.labellings.forEach {
println("${it.label} : ${it.argument.conclusion}")
}
}which prints:
und : -d
und : dBoth conclusions are undecided.
The Kotlin API page covers the flags, the result model, Prolog goals, causality and how to embed Arg2P in an existing 2P-Kt solver; the same API is in JavaScript and Python.
Using it from JavaScript
{
"dependencies": {
"@tuprolog/arg2p": "0.25.1"
}
}import { Arg2p } from '@tuprolog/arg2p'
const [graph] = Arg2p.of(`
f1 :=> d.
f2 :=> -d.`).graphs()
graph.labellings.forEach(it => console.log(`${it.label} : ${it.argument.descriptor}`))See JavaScript API for the whole API.
Where to go next
| If you want to… | Read |
|---|---|
| Learn the theory language | Language |
| Know which queries you can ask | API & Flags |
| Change semantics or preferences | Flags Reference |
| Evaluate a plain abstract framework | Abstract Evaluation |
| See complete, runnable theories | Examples |
| Understand the engine’s structure | Modules |
| Fix something that went wrong | Troubleshooting |