# Debate algorithm

The debate algorithm (formerly DebateTree algorithm and dialectic algorithm) is a recursive algorithm for computing the status of any argument (SUSTAINED or REFUTED, and colored green or red, respectively) out of the structure of its associated debate. The algorithm captures the intuitive idea that an argument should be considered refuted when it has unrefuted objections, and sustained otherwise.
This page aims to merely describe the algorithm. To read about its real-world usefulness in debate sites, see the wikidebate here. To learn about the broader context of the algorithm, see the resources here.

## Algorithm

A debate tree is a tree structure in which every node is an argument. The root node is called the main argument and the rest are called objections. Each objection is aimed at either the main argument, or another objection.
Given a debate tree, the debate algorithm labels each argument as either SUSTAINED or REFUTED based on the following definitions:

### SUSTAINED

    Without sustained objections

### REFUTED

    With sustained objections
Since objections are also arguments, the algorithm will run recursively until the end of the debate tree (the leaves). Arguments at the end have no sustained objections (indeed, they have no objections at all) so they are labeled SUSTAINED, and the algorithm is then able to solve the status of all the other arguments.

## Example

Below is an example of a small debate tree, with sustained arguments colored green and refuted arguments colored red. The structure of this debate tree is the same as the structure of the graph in this article.
* Argument Causing unnecessary suffering to animals is morally wrong. Eating or otherwise exploiting animals is unnecessary and causes much suffering. Therefore, eating or otherwise exploiting animals is morally wrong and should be abolished.
** Objection Non-human animals have no feelings and suffer no pain.
*** Objection Non-human animals behave very similar to us humans under circumstances that would cause us pain: they scream (or produce other loud noises), shake, contort, run, try to avoid the source of pain, etc.
*** Objection Non-human animals, especially mammals and birds, have a nervous system very similar to our own.
** Objection Animals in the wild suffer more, as starvation and predation is a constant threat to them. For a natural equilibrium, all animal species living in the wild live at the brink of starvation, as an excess of food leads to their numbers increasing, then collapsing.
*** Objection Animals in factory farms suffer guaranteed predation at a fraction of their natural life span. They don't lack food, true, but they are systematically mutilated, exploited, denied of basic freedom of movement, electrocuted, kicked, and many, many, many other atrocities. In traditional farms, animals are denied freedom of movement and reproduction, and also suffer guaranteed predation at a fraction of their natural life span.

## Pseudocode

The essence of the debate algorithm can be summed up in a simple, beautiful recursive function:
The function calls itself recursively until it reaches the leaves of the debate tree. The leaves have no objections, so the algorithm returns SUSTAINED for each leaf and from there on solves the status for every other argument in the tree.
An alternative, boolean formulation may be:

## Loops

Consider the following exchange:
* Argument If God existed, then evil wouldn't exist. But evil exists. Therefore, God doesn't exist.
** Objection Your argument is invalid because you're tainted by the Devil.
*** Objection That's an ad hominem fallacy.
**** Objection Your argument is invalid because you're tainted by the Devil.
***** Objection That's an ad hominem fallacy.
****** Objection Your argument is invalid because you're tainted by the Devil.
If each argument is only a copy-paste of the previous one, then this is only a human problem. However, if each argument is a "reuse" of the previous one so that objections are inherited, then this leads to an infinite loop in the debate algorithm.
The possibility of such loops increases sharply when extensions are incorporated, since reusing a single premise is more likely than reusing an entire argument.

## Extensions
### Inner structure

In the basic debate algorithm, the inner structure of the arguments is ignored. It's possible however to give the arguments some structure according to well known logical theories such as propositional logic, and extend the debate algorithm into the new structure.
For example, an extension into the propositional structure of the arguments may work on the following definitions:

#### SOUND

    An argument (or objection) is SOUND when it is VALID and all its premises are TRUE

#### VALID

    An argument (or objection) is VALID when it has no SOUND objections (to its validity)

#### TRUE

    A premise is TRUE when it has no SOUND objections
Or in pseudocode:
The algorithm can be further extended to calculate the truth value of each premise out of its propositional structure in the standard ways, and perhaps even out of its first-order structure.

### Outer structure

This section describes how to apply methods akin to the debate algorithm to draw conclusions regarding a larger debate of which an argument may only be a part of.
There are two kinds of debates: debates about facts and debates about conventions. For example, Does God exist? is a debate about a fact, while Should abortion be legal? is a debate about a convention. The proper way of drawing conclusions differs for each kind of debate.

#### Debates about facts

When debating facts, infer the option with at least one sustained argument for and none against, if every other option has no sustained arguments for.
Needless to say, the current results of the debates aren't necessarily right or wrong. It's impossible to know, for certain anyway, if the current result of a debate is the absolute truth. However, if one option has few arguments, all refuted with several objections, and another option has many arguments with few objections refuted in various ways, then there's good reason to believe the second option. If the state of the debate is clear enough, one may, and should, infer the conclusion, but there will always be a leap of faith somewhere, even if tiny. Absolute certainty can never be achieved. However, when all arguments and all objections have been considered, the result will be our best guess as to the truth of the issue at hand. This is the most humans can aim for, and we should aim for it.
Some key logical consequences are:
* The number of arguments doesn't matter ― There may be just one argument in favor and hundreds against, but if the argument in favor is sustained and the hundreds are refuted, the answer will be what the argument in favor supports. Wikidebates are not a popularity contest.
* Not all arguments for an option need to be sustained in order for that option to prevail ― Just one is required (and none on the other options). In fact, if an issue is truly controversial, it should even be expected that all options will have some refuted arguments.
In pseudocode:

#### Debates about conventions

Debating about conventions (such as laws) is different from debating about facts. When debating about facts, all arguments on the false side must ultimately be wrong, otherwise reality would be contradictory. By contrast, when debating about conventions, there may be sound arguments on all sides, and deciding becomes a matter of weighting the sound arguments on each side.
But what is the "weight" of an argument and how do we measure it? The weight of an argument is its importance and relevance to the debate. And how do we measure weight? There's no agreed method (so far). Each reader must use his or her best judgment to weight the arguments.
The balance of an option is the combined weight of the sustained arguments for it, minus the combined weight of the sustained arguments against it.
In debates about conventions, infer the option with the best balance.
This can be put in pseudocode thus:

## Implementations

The first implementation of the debate algorithm was in Formal Forum, a debate site that featured a propositional extension of the algorithm and encouraged premise reuse. Loops where avoided by automatically checking for them before accepting a submission. However, the creator felt the issue would only get worse over time and with further formalization, and decided to close the forum altogether.
The second implementation of the debate algorithm was for the Wikidebate project. Every wikidebate featured a button that would color each argument according to its status, following the most basic form of the algorithm (no extensions). However, after some debate about the real usefulness of the algorithm, it was removed.