Algorithm Search⌘K

Algorithmadvanced

Assumption-based truth maintenance

Also called ATMS, de Kleer ATMS.

Labels each node with the minimal consistent sets of assumptions from which it follows, so a reasoner can work in all contexts at once; the labels can be exponential.

Time
2^O(a k) s worst
Space
O(a n 2^a) extra
Where
a = the number of assumptions; k = the largest number of antecedents of a justification; n = the number of nodes; s = the number of justifications
Properties
deterministicincrementalmonotone
Origin
Johan de Kleer, 1986

An assumption-based truth maintenance system (ATMS) records, for each node, every minimal set of assumptions under which the node holds. A justification-based TMS keeps one set of beliefs and relabels it when an assumption changes. The ATMS keeps all contexts at once: the label of a node is the list of its minimal consistent environments, sets of assumptions from which the node follows by the Horn justifications. A nogood is a minimal set of assumptions that derives a contradiction, and no label holds a superset of one. The reasoner can then ask whether a node holds in any context by one subset test, and switch contexts for free. The price is that labels can be exponential in the number of assumptions.

In plain words

Suppose a reasoner works with guesses and wants to compare many combinations of guesses. In place of keeping one combination at a time, the ATMS writes next to each conclusion the smallest combinations of guesses that are enough to reach it. It also keeps a list of the combinations that lead to a contradiction, and drops every entry that contains one of them. To know whether a conclusion holds for some set of guesses, check whether one of its entries is part of that set. Nothing is ever retracted: a new rule only adds entries, and a new contradiction only removes the entries that contain it. The lists can be very long, because each choice between two guesses can double them.

The problem

There is a set AA of assumptions, a set of nodes that contains AA and a contradiction node ⊥\bot, and a set JJ of justifications, Horn clauses

x←a1,…,akx \leftarrow a_1, \ldots, a_k

over nodes. For an environment E⊆AE \subseteq A, the closure Cl(E)\mathrm{Cl}(E) is the least set that contains EE and is closed under JJ, which forward chaining computes. EE is inconsistent when ⊥∈Cl(E)\bot \in \mathrm{Cl}(E); the nogoods are the minimal inconsistent environments. The label of a node xx must be

  • sound: each environment in it derives xx;
  • consistent: each environment in it is consistent;
  • minimal: no environment in it is a superset of another;
  • complete: each consistent environment that derives xx is a superset of one of them.

So L(x)L(x) is the set of minimal consistent environments EE with x∈Cl(E)x \in \mathrm{Cl}(E). In logical terms, E∈L(x)E \in L(x) when J∪E⊨xJ \cup E \models x and J∪E⊭⊥J \cup E \not\models \bot. Reiter and de Kleer (1987) characterized the labels by the prime implicates of the justifications, the clauses of the form ¬a1∨⋯∨¬am∨x\neg a_1 \vee \cdots \vee \neg a_m \vee x that follow from JJ and are minimal. The task is incremental: keep all labels and the nogood list correct while assumptions and justifications are added.

The algorithm

A queue holds pairs (node, environments) that wait to enter a label. Adding an assumption aa queues (a,{{a}})(a, \{\{a\}\}). Adding a justification x←a1,…,akx \leftarrow a_1, \ldots, a_k queues xx with the minimal consistent unions of one environment from each antecedent label, and runs PROPAGATE.

  1. PROPAGATE(Q)
  2. 1while Q is not empty do
  3. 2(x, E) ← remove the first pair of Q; drop the environments of E that contain a nogood
  4. 3N ← the minimal environments of E that have no subset in L(x)
  5. 4if N is empty then continue with the next pair at L1
  6. 5if x = ⊥ then NOGOOD(e) for each e in N; continue at L1
  7. 6remove from L(x) every environment that has a subset in N; add N to L(x)
  8. 7for each justification y ← b_1, …, b_k that has x among its antecedents do
  9. 8append (y, COMBINE(the justification, x, N)) to Q
  10. COMBINE(y ← b_1, …, b_k, x, N)
  11. 9for each position i with b_i = x, choose an environment of N at i and one of L(b_l) at each other position l
  12. 10take the union of each choice, and keep the unions that contain no nogood
  13. 11return the minimal ones among them
  14. NOGOOD(e)
  15. 12if no nogood is a subset of e then add e to the nogoods and remove the nogoods that contain e
  16. 13remove from every label the environments that contain e

Only the new environments NN of a node travel on to its consumers (lines L7 to L9). Labels never lose an environment except to a smaller one or to a nogood, so the ATMS is monotone: there is no retraction and no relabelling.

Example

The assumptions are A,B,CA, B, C, and the justifications are added in this order.

step justification effect
1 x←A,Bx \leftarrow A, B L(x)={{A,B}}L(x) = \{\{A, B\}\}
2 y←By \leftarrow B L(y)={{B}}L(y) = \{\{B\}\}
3 y←Cy \leftarrow C L(y)={{B},{C}}L(y) = \{\{B\}, \{C\}\}
4 z←x,yz \leftarrow x, y the unions are {A,B}∪{B}={A,B}\{A, B\} \cup \{B\} = \{A, B\} and {A,B,C}\{A, B, C\}; the minimal one gives L(z)={{A,B}}L(z) = \{\{A, B\}\}
5 z←yz \leftarrow y {B}\{B\} and {C}\{C\} enter, and {A,B}\{A, B\} leaves because {B}\{B\} is a subset: L(z)={{B},{C}}L(z) = \{\{B\}, \{C\}\}
6 ⊥←A,B\bot \leftarrow A, B {A,B}\{A, B\} becomes a nogood; it leaves L(x)L(x), so L(x)L(x) is empty; L(z)L(z) does not change

Now zz holds in the context {B,C}\{B, C\}, because {B}\{B\} is a subset of it, and in no context that contains both AA and BB, because such a context is inconsistent.

Correctness

The correctness proof shows that every environment that enters a label derives its node (soundness), that lines L2, L3, L6, L12 and L13 keep labels minimal and free of nogoods, and a quiescence lemma: when the queue is empty, for every justification and every choice of label environments of its antecedents, the union contains a nogood or has a subset in the label of the consequent. The reason is that the antecedent environment that entered its label last sent this union, or a subset of it, down the queue. Completeness then follows by induction on a forward chaining derivation, and the same argument shows that the nogoods are exactly the minimal inconsistent environments. Labels with these four properties are unique, so the result does not depend on the order of the additions.

Proof: ATMS label propagation gives sound, consistent, minimal and complete labelsfull

Let AA be the set of assumptions and JJ the set of justifications x←a1,…,akx \leftarrow a_1, \ldots, a_k, Horn clauses over nodes, where the node ⊥\bot stands for a contradiction. For an environment E⊆AE \subseteq A, let Cl(E)\mathrm{Cl}(E) be the set of nodes that follow from EE and JJ by forward chaining; an assumption aa is in Cl(E)\mathrm{Cl}(E) when a∈Ea \in E. EE is inconsistent when ⊥∈Cl(E)\bot \in \mathrm{Cl}(E). Since Cl\mathrm{Cl} is monotone, every superset of an inconsistent environment is inconsistent. A label L(x)L(x) is

  • sound when x∈Cl(E)x \in \mathrm{Cl}(E) for each E∈L(x)E \in L(x);
  • consistent when each E∈L(x)E \in L(x) is consistent;
  • minimal when no element of L(x)L(x) is a proper subset of another;
  • complete when each consistent EE with x∈Cl(E)x \in \mathrm{Cl}(E) has a subset in L(x)L(x).

The four properties fix the label: it is the set of minimal consistent environments that derive xx. The goal is that, when the queue is empty, every label has the four properties and the nogood list is the set of minimal inconsistent environments.

We use the procedures of the page. Adding the assumption aa queues (a,{{a}})(a, \{\{a\}\}); adding a justification jj queues its consequent with COMBINE(j)(j) over the full labels. Line L8 queues a consequent with the products that use the new environments NN of one antecedent.

Lemma 1 (soundness and consistency of the nogoods)

Every nogood is inconsistent, and every environment in a label derives its node.

Proof. By induction on the steps. An environment enters a queue as {a}\{a\} for an assumption aa, or as a union e1∪⋯∪eke_1 \cup \cdots \cup e_k of label environments of the antecedents of a justification x←a1,…,akx \leftarrow a_1, \ldots, a_k. In the first case a∈Cl({a})a \in \mathrm{Cl}(\{a\}). In the second case ai∈Cl(ei)⊆Cl(e1∪⋯∪ek)a_i \in \mathrm{Cl}(e_i) \subseteq \mathrm{Cl}(e_1 \cup \cdots \cup e_k) for all ii by the induction hypothesis and monotonicity, so xx is in the closure of the union. An environment that line L5 turns into a nogood derives ⊥\bot in the same way. Lines L6 and L13 only remove environments or add queued ones. □\square

Lemma 2 (consistency and minimality)

At every moment, each label is minimal and contains no superset of a nogood, and the nogood list holds no two environments one of which contains the other.

Proof. Line L2 drops the queued environments that contain a nogood, and line L13 removes from every label the environments that contain a new nogood. Line L3 keeps only the minimal new environments that no old one is a subset of, and line L6 removes the old ones that a new one is a subset of. Line L12 adds a nogood only when no old nogood is a subset of it (the procedure checks this first) and removes the old ones that contain it. □\square

So, by Lemma 1, a nogood is inconsistent, and with Lemma 2, an environment in a label contains no nogood. After Lemma 4 below, this means it is consistent.

Lemma 3 (quiescence)

When the queue is empty, for every justification x←a1,…,akx \leftarrow a_1, \ldots, a_k and every choice of ei∈L(ai)e_i \in L(a_i), the union u=e1∪⋯∪eku = e_1 \cup \cdots \cup e_k contains a nogood, or x≠⊥x \ne \bot and uu has a subset in L(x)L(x). For k=0k = 0 this says that ∅\emptyset is in L(x)L(x), or is a nogood. Also, for each assumption aa, the set {a}\{a\} contains a nogood or has a subset in L(a)L(a).

Proof. An environment that has once been in a label and is in it now has been in it all the time in between, since removed environments contain a nogood (line L13) or a smaller label environment (line L6), and line L3 never adds an environment with a subset in the label. Fix the choice e1,…,eke_1, \ldots, e_k and let eie_i be the one that entered its label last; if k=0k = 0, or no eie_i was added after the justification, take the moment when the justification was added. At that moment line L8 (or the queueing at JUSTIFY) put on the queue a set of environments that contains uu or a subset u′u' of it, since COMBINE keeps the minimal unions of all products that use eie_i at its position and the current labels at the others, which already hold the other ele_l. When this item is popped, u′u' is either dropped at line L2, because it contains a nogood, or dropped at line L3, because it has a subset in L(x)L(x), or added to L(x)L(x), or turned into a nogood when x=⊥x = \bot. In each case, from then on u′u' contains a nogood or has a subset in L(x)L(x), because nogoods are only replaced by subsets and label environments only by subsets or by removal through a nogood that they contain. Since u′⊆uu' \subseteq u, the same holds for uu. The argument for {a}\{a\} is the same, with the item queued when aa became an assumption. □\square

Lemma 4 (completeness)

When the queue is empty, for every environment EE and every node x∈Cl(E)x \in \mathrm{Cl}(E), either EE contains a nogood, or x≠⊥x \ne \bot and EE has a subset in L(x)L(x).

Proof. By induction on the step at which forward chaining from EE derives xx. If xx is an assumption in EE, Lemma 3 for {a}\{a\} gives the claim. Otherwise xx is derived by a justification x←a1,…,akx \leftarrow a_1, \ldots, a_k with each ai∈Cl(E)a_i \in \mathrm{Cl}(E) derived earlier. By the induction hypothesis, EE contains a nogood, and we are done, or each aia_i has some ei∈L(ai)e_i \in L(a_i) with ei⊆Ee_i \subseteq E. Then u=e1∪⋯∪ek⊆Eu = e_1 \cup \cdots \cup e_k \subseteq E, and Lemma 3 gives a nogood inside uu, or a subset of uu in L(x)L(x), both inside EE. □\square

Theorem

When the queue is empty, every label L(x)L(x) is sound, consistent, minimal and complete, and the nogoods are exactly the minimal inconsistent environments.

Proof. Soundness is Lemma 1 and minimality is Lemma 2. A consistent EE contains no nogood, since nogoods are inconsistent (Lemma 1); so by Lemma 4 every consistent EE with x∈Cl(E)x \in \mathrm{Cl}(E) has a subset in L(x)L(x), which is completeness. An inconsistent EE has ⊥∈Cl(E)\bot \in \mathrm{Cl}(E), so by Lemma 4 it contains a nogood. So a label environment, which contains no nogood (Lemma 2), is consistent. Finally, every inconsistent environment contains a nogood, every nogood is inconsistent, and no nogood contains another; so a nogood has no inconsistent proper subset, and every minimal inconsistent environment, which contains a nogood, equals it. ■\blacksquare

Labels can be exponential

Take 2n2n assumptions A1,B1,…,An,BnA_1, B_1, \ldots, A_n, B_n and the justifications xi←Aix_i \leftarrow A_i, xi←Bix_i \leftarrow B_i for each ii, and g←x1,…,xng \leftarrow x_1, \ldots, x_n. Then L(xi)={{Ai},{Bi}}L(x_i) = \{\{A_i\}, \{B_i\}\}, and an environment derives gg exactly when it holds AiA_i or BiB_i for every ii. There are no nogoods, so the minimal such environments are the 2n2^n sets that pick one of Ai,BiA_i, B_i for each ii, and none of them contains another. So ∣L(g)∣=2n|L(g)| = 2^n for an input of size O(n)O(n), and any procedure that writes the labels needs exponential time on this family.

Complexity

Labels can be exponential. With assumptions A1,B1,…,An,BnA_1, B_1, \ldots, A_n, B_n and justifications xi←Aix_i \leftarrow A_i, xi←Bix_i \leftarrow B_i and g←x1,…,xng \leftarrow x_1, \ldots, x_n, the label of gg holds all 2n2^n choices of one assumption from each pair, and no choice contains another. So any procedure that writes out the labels takes exponential time on an input of size O(n)O(n); the proof page gives the details. In general each label has at most 2a2^a environments, a combination step over kk antecedents forms at most 2ak2^{a k} unions, and each node gets new environments at most 2a2^a times, which gives a bound of the form 2O(ak)s2^{O(a k)} s on the time and O(a n 2a)O(a\, n\, 2^a) on the space. The cost is not only in the size of the output: deciding whether a node has any consistent environment is NP-complete when nogoods are present (Selman and Levesque 1990). To see the hardness, take assumptions p+p^+ and p−p^- for each variable pp of a CNF formula, the justification ⊥←p+,p−\bot \leftarrow p^+, p^-, a justification c←p+c \leftarrow p^+ for each positive literal pp of a clause cc and c←p−c \leftarrow p^- for each negative one, and g←c1,…,cmg \leftarrow c_1, \ldots, c_m; then gg has a consistent environment exactly when the formula is satisfiable. In practice the labels stay small when the assumptions are few or the nogoods cut the products early, and ATMS implementations use bit vectors for environments and a table of all environments, so that a subset test is a few machine operations.

Properties

  • Multiple contexts. All consistent sets of assumptions are represented at once; a query in a context is a subset test against the label.
  • Monotone. Justifications and assumptions are only added. Inconsistency removes environments, but no node is ever relabelled because a premise was withdrawn.
  • Unique result. The labels and nogoods depend only on the justifications, not on the order in which they were added.
  • Horn only. The basic ATMS handles Horn justifications. Disjunctions of assumptions need the extensions of de Kleer's second paper.
  • Exponential labels. The size of a label can be 2a/22^{a/2} even with no nogoods.

Variants and improvements

  • Focusing. Restrict the labels to environments inside a set of contexts of interest, to avoid the exponential growth outside them.
  • Disjunctions and the CMS. De Kleer's extensions add choose-sets of assumptions; Reiter and de Kleer's clause management system accepts arbitrary clauses and answers with prime implicates.
  • Diagnosis. In consistency-based diagnosis, the assumptions say that components work, the nogoods are the conflict sets, and the diagnoses are the minimal hitting sets of the nogoods, as in Reiter's HS-tree and de Kleer and Williams's GDE.
  • Abduction. The label of an observation lists its minimal consistent explanations by assumptions, the Horn case of abductive reasoning.
  • Lazy labels. Compute the label of a node only when it is asked for, with backward search from the node.

When to use it

Use an ATMS when a problem solver must compare many alternative sets of assumptions, as in model-based diagnosis, qualitative physics and design spaces, and when switching between contexts must be cheap. Use a JTMS when one context is active at a time, when the justifications need nonmonotonic out-lists, or when the number of assumptions is large and unfocused.

Pitfalls

  • Label explosion. A few independent binary choices multiply the label size. Focus the labels or keep the number of assumptions per problem small.
  • Forgetting minimality. If supersets are not removed from labels and from the nogood list, they grow fast and the subset tests slow down.
  • Late nogoods. A nogood that arrives late must remove environments from every label, not only from the nodes near the contradiction.
  • Treating the label as a probability. A label says under which assumptions a node holds, not how likely the node is.

Implementations

Each implementation follows the pseudocode above. A comment @line links a line of code to a line of the pseudocode. Point at a line of the pseudocode to see the matching code. The build runs the native tests of each language.

assumption_based_truth_maintenance.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# An assumption-based truth maintenance system for the page
# https://algorithm.tamnd.com/assumption-based-truth-maintenance/. The authors are listed in prov/.
"""An assumption-based truth maintenance system (ATMS), after de Kleer (1986).

Nodes are hashable values. Some nodes are assumptions. A justification is a
Horn clause x <- a_1, ..., a_k over nodes; with k = 0 the node x is a premise.
The node FALSE stands for a contradiction: a justification FALSE <- a_1, ...,
a_k says that the antecedents cannot hold together.

An environment is a frozenset of assumptions. It is inconsistent when FALSE
follows from it, and the minimal inconsistent environments are the nogoods.
The label of a node is the set of environments in which the node holds, kept
sound (each one derives the node), consistent (none contains a nogood),
minimal (none is a superset of another) and complete (every consistent
environment that derives the node contains one of them).

Labels only grow under new justifications, except that a new nogood removes
the environments that contain it. Propagation sends only the new environments
of a node to the justifications that use the node.
"""

from collections import deque
from itertools import product

FALSE = "FALSE"


def minimal(envs):
    """The environments of envs that have no proper subset in envs, without duplicates."""
    envs = sorted(set(envs), key=len)
    out = []
    for e in envs:
        if not any(o <= e for o in out):
            out.append(e)
    return out


class ATMS:
    def __init__(self):
        self.label = {FALSE: []}
        self.assumptions = set()
        self.justs = []  # (consequent, antecedents)
        self.consumers = {FALSE: []}  # node -> indices of the justifications that use it
        self.nogoods = []

    def add_node(self, x):
        if x not in self.label:
            self.label[x] = []
            self.consumers[x] = []

    def add_assumption(self, a):
        self.add_node(a)
        self.assumptions.add(a)
        self._run(deque([(a, [frozenset([a])])]))

    def consistent(self, env):
        return not any(n <= env for n in self.nogoods)

    def holds(self, x, env):
        """True when x holds in the environment env: some label environment is a subset of env."""
        return self.consistent(env) and any(e <= env for e in self.label.get(x, []))

    def justify(self, x, antecedents):
        self.add_node(x)
        for a in antecedents:
            self.add_node(a)
        k = len(self.justs)
        self.justs.append((x, tuple(antecedents)))
        for a in set(antecedents):
            self.consumers[a].append(k)
        self._run(deque([(x, self._combine(k, None, None))]))

    def _combine(self, k, changed, delta):
        """The minimal consistent unions of one environment from the label of each antecedent of justification k.
        When changed is a node, only the products that take an environment of delta for one occurrence of it."""
        _, ants = self.justs[k]
        lists = [self.label[a] for a in ants]
        products = []
        if changed is None:
            products.append(lists)
        else:
            for i, a in enumerate(ants):  # @line L9
                if a == changed:
                    products.append(lists[:i] + [delta] + lists[i + 1 :])
        envs = []
        for ls in products:
            for choice in product(*ls):
                e = frozenset().union(*choice)  # @line L10
                if self.consistent(e):
                    envs.append(e)
        return minimal(envs)  # @line L11

    def _run(self, queue):
        while queue:  # @line L1
            x, envs = queue.popleft()  # @line L2
            envs = [e for e in envs if self.consistent(e)]
            new = minimal(e for e in envs if not any(o <= e for o in self.label[x]))  # @line L3
            if not new:  # @line L4
                continue
            if x == FALSE:  # @line L5
                for e in new:
                    self._nogood(e)
                continue
            self.label[x] = [o for o in self.label[x] if not any(e <= o for e in new)] + new  # @line L6
            for k in self.consumers[x]:  # @line L7
                queue.append((self.justs[k][0], self._combine(k, x, new)))  # @line L8

    def _nogood(self, env):
        if not self.consistent(env):
            return
        self.nogoods = [n for n in self.nogoods if not env <= n] + [env]  # @line L12
        for x in self.label:  # @line L13
            self.label[x] = [e for e in self.label[x] if not env <= e]
test_assumption_based_truth_maintenance.py 110 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/assumption-based-truth-maintenance/. The authors are listed in prov/.

import random
import unittest
from itertools import combinations

from assumption_based_truth_maintenance import ATMS, FALSE


def closure(env, justs):
    """Every node that follows from the assumptions of env by the Horn justifications."""
    known = set(env)
    changed = True
    while changed:
        changed = False
        for x, ants in justs:
            if x not in known and all(a in known for a in ants):
                known.add(x)
                changed = True
    return known


def brute_force(assumptions, nodes, justs):
    """Labels and nogoods from every environment: the minimal consistent environments that derive each node."""
    envs = [frozenset(c) for k in range(len(assumptions) + 1) for c in combinations(sorted(assumptions), k)]
    closed = {e: closure(e, justs) for e in envs}
    bad = [e for e in envs if FALSE in closed[e]]
    nogoods = {e for e in bad if not any(o < e for o in bad)}
    labels = {}
    for x in nodes:
        good = [e for e in envs if FALSE not in closed[e] and x in closed[e]]
        labels[x] = {e for e in good if not any(o < e for o in good)}
    return labels, nogoods, envs, closed


class TestATMS(unittest.TestCase):
    def check_properties(self, atms, assumptions, nodes, justs):
        labels, nogoods, envs, closed = brute_force(assumptions, nodes, justs)
        self.assertEqual(set(atms.nogoods), nogoods)
        for x in nodes:
            label = atms.label[x]
            self.assertEqual(len(label), len(set(label)))
            for e in label:
                self.assertIn(x, closed[e])  # sound
                self.assertNotIn(FALSE, closed[e])  # consistent
                self.assertFalse(any(o < e for o in label))  # minimal
            for e in envs:  # complete
                if FALSE not in closed[e] and x in closed[e]:
                    self.assertTrue(any(o <= e for o in label))
            self.assertEqual(set(label), labels[x])

    def test_page_example(self):
        t = ATMS()
        for a in "ABC":
            t.add_assumption(a)
        t.justify("x", ["A", "B"])
        t.justify("y", ["B"])
        t.justify("y", ["C"])
        self.assertEqual(set(t.label["y"]), {frozenset("B"), frozenset("C")})
        t.justify("z", ["x", "y"])
        self.assertEqual(set(t.label["z"]), {frozenset("AB")})
        t.justify("z", ["y"])
        self.assertEqual(set(t.label["z"]), {frozenset("B"), frozenset("C")})
        t.justify(FALSE, ["A", "B"])
        self.assertEqual(t.nogoods, [frozenset("AB")])
        self.assertEqual(t.label["x"], [])
        self.assertEqual(set(t.label["z"]), {frozenset("B"), frozenset("C")})
        self.assertTrue(t.holds("z", frozenset("BC")))
        self.assertFalse(t.holds("z", frozenset("AB")))

    def test_random_against_brute_force(self):
        rng = random.Random(20261115)
        with_nogoods = 0
        for _ in range(150):
            assumptions = ["A" + str(i) for i in range(rng.randint(1, 6))]
            derived = ["n" + str(i) for i in range(rng.randint(1, 4))]
            nodes = assumptions + derived
            t = ATMS()
            for a in assumptions:
                t.add_assumption(a)
            for x in derived:
                t.add_node(x)
            justs = []
            for _ in range(rng.randint(1, 10)):
                x = FALSE if rng.random() < 0.15 else rng.choice(derived + assumptions[:1])
                ants = tuple(rng.sample(nodes, rng.randint(0 if x != FALSE else 1, min(3, len(nodes)))))
                justs.append((x, ants))
                t.justify(x, ants)
                self.check_properties(t, assumptions, nodes, justs)
            with_nogoods += bool(t.nogoods)
        self.assertGreater(with_nogoods, 30)  # the random cases do reach contradictions

    def test_exponential_label(self):
        for n in range(1, 8):
            t = ATMS()
            xs = []
            for i in range(n):
                t.add_assumption("A" + str(i))
                t.add_assumption("B" + str(i))
                t.justify("x" + str(i), ["A" + str(i)])
                t.justify("x" + str(i), ["B" + str(i)])
                xs.append("x" + str(i))
            t.justify("g", xs)
            self.assertEqual(len(t.label["g"]), 2**n)
            self.assertTrue(all(len(e) == n for e in t.label["g"]))


if __name__ == "__main__":
    unittest.main()

History

De Kleer (1986) introduced the ATMS in three papers in one issue of Artificial Intelligence: the basic system, its extensions, and its use in problem solving. It grew from his work with Brown on qualitative physics and with Williams on diagnosis, where the GDE of de Kleer and Williams (1987) used it to find conflict sets. Reiter and de Kleer (1987) gave the logical foundations through prime implicates. Forbus and de Kleer (1993) gave the standard implementation in their textbook.

References

  1. Johan de Kleer, An assumption-based TMS, Artificial Intelligence 28(2), 127 to 162 (1986), the definitions of assumptions, environments, nogoods and labels, the four label properties, and the label update algorithm
  2. Johan de Kleer, Extending the ATMS, Artificial Intelligence 28(2), 163 to 196 (1986), disjunctions of assumptions and other extensions of the basic ATMS
  3. Raymond Reiter and Johan de Kleer, Foundations of assumption-based truth maintenance systems: preliminary report, Proceedings of the Sixth National Conference on Artificial Intelligence (AAAI-87), 183 to 188 (1987), the characterization of ATMS labels and of the clause management system by prime implicates
  4. Kenneth D. Forbus and Johan de Kleer, Building Problem Solvers, MIT Press (1993), the chapters on the ATMS, its implementation and its use in problem solvers
  5. Bart Selman and Hector J. Levesque, Abductive and default reasoning: a computational core, Proceedings of the Eighth National Conference on Artificial Intelligence (AAAI-90), 343 to 348 (1990), the hardness of finding an assumption-based explanation over Horn clauses

About this page

The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.

LadderLevelWhat the next level needs
Human proofH1 sketch
  • a full proof of time.worst
  • a full proof of space.extra
LeanL0 no Lean part
  • name a Lean module in the lean field (07)
Code (python)I0 not checked yet
  • the tests did not run in this build
VisualV0 none
  • add viz/scene.ts or a figure (10)
WritingW2 basic
  • a scene preset for the example