Algorithm Search⌘K

Algorithmcore

Justification-based truth maintenance

Also called JTMS, Doyle truth maintenance system.

Records a justification for each derived belief and relabels beliefs in and out when assumptions change, keeping the belief set well founded.

Time
O(n s) worst
Space
O(n + s) extra
Where
n = the number of nodes; s = the total size of all justifications
Properties
deterministicincremental
Origin
Jon Doyle, 1979

A justification-based truth maintenance system (JTMS) is a bookkeeping layer under a reasoner. The reasoner tells it the justifications of its beliefs, each of the form "believe xx if all of these nodes are IN and all of those are OUT", and the JTMS labels each node IN or OUT so that every IN node has a non-circular argument from the current premises. When a premise is retracted, or a new justification arrives, it relabels only the nodes that depend on the change. Doyle's system of 1979 allowed out-lists, which make the beliefs nonmonotonic: a node can go OUT because another node came IN. This page gives the logic behind the labels, the well-founded semantics of the network read as a logic program, and an incremental relabelling procedure that computes it, with a third label UNDEC for the nodes that the semantics leaves open. The labels Doyle's own procedure picks on such nodes correspond to the stable models of the network.

In plain words

A reasoning program draws many conclusions, and some of them rest on guesses that may turn out to be wrong. A truth maintenance system keeps, for each conclusion, the reasons that support it. A reason can say "believe this if those things are believed" and also "believe this unless that other thing is believed". When a guess is withdrawn, the system finds every conclusion that rested on it and checks again whether some other reason still supports it. A conclusion that only supports itself in a circle is not believed. When reasons contradict each other in a circle, as in "believe A unless B" and "believe B unless A", the system leaves both open in place of picking one at random.

The problem

A network NN is a finite set of nodes and justifications (x,I,O)(x, I, O), read as the rule

x←b1,…,bk,not c1,…,not clx \leftarrow b_1, \ldots, b_k, \mathit{not}\ c_1, \ldots, \mathit{not}\ c_l

with in-list I={b1,…,bk}I = \{b_1, \ldots, b_k\} and out-list O={c1,…,cl}O = \{c_1, \ldots, c_l\}. A premise has both lists empty; an assumption is a premise that the reasoner can retract. The network is a ground normal logic program. Its semantics here is the well-founded model (T,F)(T, F), the least fixed point of the operator W(T,F)=(TN(T,F),UN(T,F))W(T, F) = (T_N(T, F), U_N(T, F)), where TNT_N gives the nodes with a justification whose in-list is in TT and whose out-list is in FF, and UNU_N is the greatest unfounded set: the largest set UU such that each justification of a node of UU has an in-node in F∪UF \cup U or an out-node in TT. The labels are IN for TT, OUT for FF and UNDEC for the rest.

The task is incremental: keep the labels equal to the well-founded model while justifications are added and removed one at a time. For a network without a cycle through an out-list the model is two-valued and equals the unique stable model, and so the unique labelling in Doyle's sense. With even cycles through out-lists there can be several stable models, and with odd cycles there can be none; deciding whether a network has a stable model is NP-complete (Elkan 1990), while the well-founded model can be computed in polynomial time.

The algorithm

After a justification of xx is added or removed, RELABEL(x)(x) runs. The affected set SS is xx and every node that depends on xx, directly or through other nodes, through the in-list or the out-list of a justification. The labels outside SS stay as they are.

  1. RELABEL(x)
  2. 1S ← x and every node that depends on x through in-lists or out-lists, transitively
  3. 2remove the labels of the nodes of S
  4. 3repeat
  5. 4while some unlabeled node y of S has a justification whose in-list is all IN and whose out-list is all OUT do
  6. 5label y IN
  7. 6P ← the least set of nodes of S that are not OUT such that y ∈ P when y has a justification whose in-nodes are each IN, UNDEC or in P, and whose out-nodes are not IN
  8. 7label OUT each unlabeled node of S that is not in P
  9. 8until line L7 labels no node
  10. 9label UNDEC each node of S that is still unlabeled

Lines L4 and L5 are the step TNT_N: a node with a valid justification is IN. Lines L6 and L7 are the step UNU_N: PP holds the nodes that could still get a non-circular argument, and every unlabeled node outside PP is in an unfounded set, so it is OUT. A positive loop, such as s←ss \leftarrow s, never enters PP and goes OUT. This is the alternating fixpoint of the well-founded semantics, run only on the affected nodes. A node with no justification is OUT from the start.

Example

The network has the justifications flies←bird,not abnormal\mathit{flies} \leftarrow \mathit{bird}, \mathit{not}\ \mathit{abnormal} and abnormal←penguin\mathit{abnormal} \leftarrow \mathit{penguin}.

change affected set SS rounds labels after
assume bird\mathit{bird} bird, flies bird IN by the premise; flies IN: bird is IN and abnormal is OUT bird IN, flies IN, abnormal OUT, penguin OUT
assume penguin\mathit{penguin} penguin, abnormal, flies penguin IN, abnormal IN; flies has the out-node abnormal IN, so it is not in PP and goes OUT penguin IN, abnormal IN, flies OUT
retract penguin\mathit{penguin} penguin, abnormal, flies round 1: no node gets IN; P={flies}P = \{\mathit{flies}\}, so penguin and abnormal go OUT; round 2: flies IN penguin OUT, abnormal OUT, flies IN

Now add p←not qp \leftarrow \mathit{not}\ q and q←not pq \leftarrow \mathit{not}\ p. Neither justification is valid while both nodes are unlabeled, and both nodes are in PP, so both end UNDEC. The network has two stable models here, and Doyle's procedure would pick one of them. Assuming qq makes qq IN and then pp OUT.

Correctness

The correctness proof has three parts. First, the nodes outside SS do not depend on the change, so by the splitting set theorem their old labels are still their well-founded labels. Second, each IN label is given by a justification whose nodes are already correctly IN and OUT, and each OUT label goes to a set that is unfounded for the current labels, so every label is a well-founded label (soundness). Third, when the loop stops, the IN and OUT sets form a fixed point of WW, and since the well-founded model is the least fixed point and the labels lie below it, the two are equal.

Proof: Incremental relabelling of a JTMS gives the well-founded labellingfull

A network NN is a finite set of justifications (x,I,O)(x, I, O), read as the rules x←I,not Ox \leftarrow I, \mathit{not}\ O of a ground normal logic program. A partial labelling is a pair (T,F)(T, F) of disjoint sets of nodes, the IN nodes and the OUT nodes; the other nodes are undecided. We order pairs by (T,F)≤(T′,F′)(T, F) \le (T', F') when T⊆T′T \subseteq T' and F⊆F′F \subseteq F'.

Definitions and known facts

  • TN(T,F)T_N(T, F) is the set of nodes with a justification whose in-list is inside TT and whose out-list is inside FF.
  • A set UU is unfounded with respect to (T,F)(T, F) when each justification (x,I,O)(x, I, O) with x∈Ux \in U has an in-node in F∪UF \cup U or an out-node in TT. A union of unfounded sets is unfounded, so there is a greatest unfounded set UN(T,F)U_N(T, F).
  • WN(T,F)=(TN(T,F),UN(T,F))W_N(T, F) = (T_N(T, F), U_N(T, F)). Both parts grow when (T,F)(T, F) grows, so WNW_N is monotone, and the well-founded model is its least fixed point (Van Gelder, Ross and Schlipf 1991; see well-founded semantics). We write it (T∗,F∗)(T^*, F^*) for the network after the change.

Lemma 1 (supported nodes). For a partial labelling (T,F)(T, F), let Pos\mathrm{Pos} be the least set of nodes such that y∈Posy \in \mathrm{Pos} whenever yy has a justification with no in-node in FF, every in-node in Pos\mathrm{Pos}, and no out-node in TT. Then UN(T,F)U_N(T, F) is the complement of Pos\mathrm{Pos}.

Proof. A node y∉Posy \notin \mathrm{Pos} fails the rule for each of its justifications, so each has an in-node in FF, an in-node outside Pos\mathrm{Pos}, or an out-node in TT. So the complement of Pos\mathrm{Pos} is unfounded. Conversely, let UU be unfounded and build Pos\mathrm{Pos} in stages. A node enters Pos\mathrm{Pos} by a justification whose in-nodes are in Pos\mathrm{Pos} already, hence not in UU by induction, and not in FF, and whose out-nodes are not in TT. This justification breaks the unfounded condition, so the node is not in UU. □\square

Lemma 2 (splitting). Let DD be a set of nodes such that every justification of a node of DD mentions only nodes of DD, and let NDN_D be the justifications of the nodes of DD. Then the well-founded model of NN, restricted to DD, is the well-founded model of NDN_D.

Proof. For x∈Dx \in D, membership of xx in TN(T,F)T_N(T, F) depends only on T∩DT \cap D and F∩DF \cap D. A set U⊆DU \subseteq D is unfounded for NN exactly when it is unfounded for NDN_D, and UN(T,F)∩DU_N(T, F) \cap D is unfounded, since the justifications of its nodes mention only nodes of DD. So WN(T,F)W_N(T, F) restricted to DD is WNDW_{N_D} of the restriction, and by induction the iterates of WNW_N and WNDW_{N_D} from (∅,∅)(\emptyset, \emptyset) agree on DD. This is the splitting set theorem for the well-founded semantics. □\square

The procedure

We use RELABEL(x)(x) of the page, called after a justification of xx was added or removed, when the labels were the well-founded model of the network before the change. Line L1 computes the set SS of nodes that depend on xx. Let DD be the set of the other nodes.

Lemma 3. No justification of a node of DD mentions a node of SS, and the justifications of the nodes of DD did not change. So after line L2, every node of DD carries its label in (T∗,F∗)(T^*, F^*), with UNDEC for undecided.

Proof. If a justification of dd mentions s∈Ss \in S, then dd depends on ss and line L1 puts dd in SS. The changed justification belongs to x∈Sx \in S. By Lemma 2, applied before and after the change, the labels of DD are the well-founded labels of NDN_D, which is the same network before and after. □\square

Lemma 4 (soundness). At every moment, the IN nodes are in T∗T^* and the OUT nodes are in F∗F^*.

Proof. By Lemma 3 this holds after line L2, and the labels of DD never change afterwards. We show that each new label keeps it.

Line L5 labels yy IN by a justification whose in-nodes are IN, so in T∗T^*, and whose out-nodes are OUT, so in F∗F^*. Then y∈TN(T∗,F∗)=T∗y \in T_N(T^*, F^*) = T^*.

Line L7 labels OUT the set UU of unlabeled nodes of SS that are not in PP. Take y∈Uy \in U and a justification (y,I,O)(y, I, O). Since yy is not OUT and y∉Py \notin P, this justification breaks the rule of line L6: either an out-node is IN, or an in-node bb is not IN, not UNDEC and not in PP. In the second case bb is OUT, or bb is unlabeled, and then b∈Sb \in S (all nodes of DD are labelled) and b∈Ub \in U. So UU is unfounded with respect to the current labels, and since unfoundedness is kept when the labels grow, UU is unfounded with respect to (T∗,F∗)(T^*, F^*). So U⊆UN(T∗,F∗)=F∗U \subseteq U_N(T^*, F^*) = F^*. □\square

Lemma 5 (termination). Each round of lines L3 to L8, except the last, labels a node at line L7. Each pass of line L4 labels a node or ends the inner loop. Labels in SS only change from none to a label. So the procedure stops.

Theorem

When RELABEL(x)(x) stops, IN, OUT and UNDEC are exactly the true, false and undefined nodes of the well-founded model of the new network.

Proof. Let (T′,F′)(T', F') be the final IN and OUT sets. By Lemma 4, (T′,F′)≤(T∗,F∗)(T', F') \le (T^*, F^*). We show that (T′,F′)(T', F') is a fixed point of WNW_N. Since (T∗,F∗)(T^*, F^*) is the least fixed point, then (T∗,F∗)≤(T′,F′)(T^*, F^*) \le (T', F'), and the two are equal.

TN(T′,F′)=T′T_N(T', F') = T'. On DD this holds by Lemma 3 and Lemma 2, because (T∗,F∗)(T^*, F^*) is a fixed point and the labels on DD agree with it. A node of SS labelled IN got its label by a justification that was valid at that time, and labels never change once set, so the justification is still valid. A node of SS labelled UNDEC was unlabeled in the last pass of line L4, so it has no valid justification. A node yy of SS labelled OUT is in F∗F^*; if a justification of yy were valid in (T′,F′)≤(T∗,F∗)(T', F') \le (T^*, F^*), it would be valid in (T∗,F∗)(T^*, F^*) and put yy in T∗T^*, which is disjoint from F∗F^*.

UN(T′,F′)=F′U_N(T', F') = F'. On DD this holds as before. Each node of SS labelled OUT at line L7 belongs to a set that was unfounded for the labels of that time, and so for (T′,F′)(T', F'); so F′⊆UN(T′,F′)F' \subseteq U_N(T', F'). For the other direction we use Lemma 1. In the last round, line L7 labelled nothing, so every node of SS that ends UNDEC is in the set PP of that round, and the IN labels did not change after it. The nodes of T′T', the UNDEC nodes of DD and the nodes of PP are all in Pos(T′,F′)\mathrm{Pos}(T', F'): the nodes of DD because Pos\mathrm{Pos} on DD is the complement of F∗∩DF^* \cap D by Lemma 2; an IN node of SS by induction on the order of labelling, through the justification that made it IN; a node of PP by induction on the stages of PP, through the justification that put it in PP, whose in-nodes are IN, UNDEC or in PP, so not OUT, and whose out-nodes are not IN. So UN(T′,F′)U_N(T', F'), the complement of Pos\mathrm{Pos}, holds only OUT nodes. ■\blacksquare

Corollaries

  • If the network has no cycle through an out-list (it is stratified), its well-founded model is two-valued, so no node ends UNDEC, and the labelling is the unique stable model.
  • If the final labelling has no UNDEC node, the network has exactly one stable model, and it is the set of IN nodes. This is the general fact that a two-valued well-founded model is the unique stable model.
  • The labels do not depend on the order of the changes, only on the final network, because each call ends at the well-founded model.

Complexity

The repeat loop runs at most ∣S∣+1|S| + 1 rounds, since each round but the last labels a node OUT. With a counter for each justification, as in Horn-SAT forward chaining, lines L4 to L7 cost O(s)O(s) in each round. So one change costs O(n s)O(n\, s) in the worst case, and O(∣S∣⋅sS)O(|S| \cdot s_S) when only the affected part SS, with justifications of total size sSs_S, is scanned. The implementation rescans the affected justifications without counters, for clarity. The space is O(n+s)O(n + s) for the nodes, the justifications and the lists of dependents. The computation is polynomial because it does not choose between stable models; finding a two-valued labelling of the kind that Doyle's procedure looks for is NP-complete (Elkan 1990).

Properties

  • Incremental. Only the nodes that depend on the change are relabelled.
  • Well founded. An IN node has a non-circular argument from the premises; a node that only supports itself is OUT.
  • Cautious. Where the network leaves a choice, as in an even loop through out-lists, the labels say UNDEC. Doyle's labelling instead picks a stable model.
  • Order independent. The labels depend only on the current network, not on the order of past changes.
  • Single context. A JTMS holds one set of beliefs at a time. To compare different sets of assumptions, it must relabel each time; the ATMS keeps all contexts at once.

Variants and improvements

  • Contradictions and dependency-directed backtracking. A contradiction node marks a set of beliefs that cannot hold together. When it goes IN, Doyle's system traces its justifications back to the assumptions under it, records a nogood, and adds a justification that makes one of those assumptions OUT. This is smarter than chronological backtracking, which undoes the last choice whatever it was. This page describes it but does not implement it.
  • Monotonic JTMS. With empty out-lists, labelling is forward chaining on Horn clauses, and retraction is the removal of the nodes that lost all support, as in incremental view maintenance.
  • Stable labellings. Doyle's procedure, and later TMS designs, choose a two-valued labelling on even loops; these labellings are the stable models of the network (Elkan 1990). See stable model semantics.
  • LTMS. McAllester's logic-based TMS takes clauses in place of justifications and labels nodes by unit propagation.
  • ATMS. The assumption-based TMS of de Kleer labels each node with the minimal sets of assumptions under which it holds.

When to use it

Use a JTMS under a rule engine or a planner that makes assumptions and must withdraw them cheaply, when one set of beliefs is active at a time. It is the cache of a production system whose conclusions must disappear when their premises do. Use an ATMS when many alternative sets of assumptions must be compared at the same time, as in diagnosis.

Pitfalls

  • Circular support. A naive relabeller that keeps a node IN while some justification is valid can keep a self-supporting loop IN after its real support is gone. The unfounded step of lines L6 and L7 is what rules this out.
  • Odd loops. A justification such as r←not rr \leftarrow \mathit{not}\ r has no two-valued labelling, so a procedure that looks for one, as Doyle's does, cannot succeed on such a network. The well-founded labels give UNDEC.
  • Relabelling too much. Relabelling the whole network after each change is correct but slow; the affected set must include the nodes that depend through out-lists too, or the labels go wrong.
  • Mixing up OUT and false. OUT means "not believed now", not "believed false". A node and its negation are two separate nodes, tied together only by a contradiction node.

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.

justification_based_truth_maintenance.pyI0RawGitHub
# SPDX-License-Identifier: MIT
# A justification-based truth maintenance system for the page
# https://algorithm.tamnd.com/justification-based-truth-maintenance/. The authors are listed in prov/.
"""A justification-based truth maintenance system (JTMS) with nonmonotonic justifications.

A node is any hashable value. A justification of a node x has an in-list and
an out-list: it is valid when every node of the in-list is IN and every node
of the out-list is OUT, and then x is believed. A justification with both lists
empty is a premise; an assumption is a premise that can be removed again.

Each node has the label IN, OUT or UNDEC. The labels are the well-founded
model of the network read as the normal logic program x <- ins, not outs:
IN is true, OUT is false and UNDEC is undefined. After each change only the
changed node and the nodes that depend on it are labelled again.
"""


IN, OUT, UNDEC = "IN", "OUT", "UNDEC"


class JTMS:
    def __init__(self):
        self.justs = {}  # id -> (node, ins, outs)
        self.of_node = {}  # node -> set of justification ids
        self.users = {}  # node -> set of nodes with a justification that mentions it
        self.label = {}
        self.next_id = 0
        self.relabelled = 0  # the number of nodes that relabel has visited

    def add_node(self, x):
        if x not in self.label:
            self.label[x] = OUT
            self.of_node[x] = set()
            self.users[x] = set()

    def justify(self, x, ins=(), outs=()):
        """Add the justification x <- ins, not outs and return its id."""
        for y in (x, *ins, *outs):
            self.add_node(y)
        jid = self.next_id
        self.next_id += 1
        self.justs[jid] = (x, tuple(ins), tuple(outs))
        self.of_node[x].add(jid)
        for y in (*ins, *outs):
            self.users[y].add(x)
        self.relabel(x)
        return jid

    def assume(self, x):
        return self.justify(x)

    def retract(self, jid):
        """Remove a justification. The users lists may keep x; a larger closed set to relabel is still correct."""
        x, _, _ = self.justs.pop(jid)
        self.of_node[x].discard(jid)
        self.relabel(x)

    def is_in(self, x):
        return self.label.get(x) == IN

    def _valid(self, jid):
        _, ins, outs = self.justs[jid]
        return all(self.label[y] == IN for y in ins) and all(self.label[y] == OUT for y in outs)

    def relabel(self, x):
        affected, stack = {x}, [x]  # @line L1
        while stack:
            y = stack.pop()
            for z in self.users[y]:
                if z not in affected:
                    affected.add(z)
                    stack.append(z)
        self.relabelled += len(affected)
        for y in affected:  # @line L2
            self.label[y] = None
        while True:  # @line L3
            changed = True
            while changed:  # @line L4
                changed = False
                for y in affected:
                    if self.label[y] is None and any(self._valid(j) for j in self.of_node[y]):
                        self.label[y] = IN  # @line L5
                        changed = True
            possible = set()  # @line L6
            grew = True
            while grew:
                grew = False
                for y in affected:
                    if y in possible or self.label[y] == OUT:
                        continue
                    for j in self.of_node[y]:
                        _, ins, outs = self.justs[j]
                        if all(self.label[b] in (IN, UNDEC) or b in possible for b in ins) and all(self.label[c] != IN for c in outs):
                            possible.add(y)
                            grew = True
                            break
            new_out = [y for y in affected if self.label[y] is None and y not in possible]
            for y in new_out:  # @line L7
                self.label[y] = OUT
            if not new_out:  # @line L8
                break
        for y in affected:  # @line L9
            if self.label[y] is None:
                self.label[y] = UNDEC
test_justification_based_truth_maintenance.py 118 lines
# SPDX-License-Identifier: MIT
# Part of https://algorithm.tamnd.com/justification-based-truth-maintenance/. The authors are listed in prov/.

import random
import unittest
from itertools import combinations

from justification_based_truth_maintenance import IN, OUT, UNDEC, JTMS


def subsets(universe):
    for k in range(len(universe) + 1):
        yield from combinations(universe, k)


def unfounded(rules, u, true, false):
    """Each rule for an atom of u has an in-node that is false or in u, or an out-node that is true."""
    for h, ins, outs in rules:
        if h in u and not (any(b in false or b in u for b in ins) or any(c in true for c in outs)):
            return False
    return True


def wfs_brute(rules, universe):
    """The well-founded model as the least fixpoint of W(T, F) = (T_P(T, F), greatest unfounded set), all by brute force."""
    true, false = frozenset(), frozenset()
    while True:
        new_true = frozenset(h for h, ins, outs in rules if all(b in true for b in ins) and all(c in false for c in outs))
        gus = set()
        for s in subsets(universe):
            if unfounded(rules, set(s), true, false):
                gus.update(s)
        new_false = frozenset(gus)
        if (new_true, new_false) == (true, false):
            return true, false
        true, false = new_true, new_false


def least_model(definite):
    m = set()
    while True:
        nxt = {h for h, ins in definite if all(b in m for b in ins)}
        if nxt <= m:
            return m
        m |= nxt


def stable_models_brute(rules, universe):
    out = []
    for s in subsets(universe):
        s = set(s)
        reduct = [(h, ins) for h, ins, outs in rules if not any(c in s for c in outs)]
        if least_model(reduct) == s:
            out.append(frozenset(s))
    return out


def labels_from(universe, true, false):
    return {x: IN if x in true else OUT if x in false else UNDEC for x in universe}


class TestJTMS(unittest.TestCase):
    def test_page_example(self):
        t = JTMS()
        t.justify("flies", ins=["bird"], outs=["abnormal"])
        t.justify("abnormal", ins=["penguin"])
        a_bird = t.assume("bird")
        self.assertEqual((t.label["bird"], t.label["flies"], t.label["abnormal"]), (IN, IN, OUT))
        a_penguin = t.assume("penguin")
        self.assertEqual((t.label["penguin"], t.label["abnormal"], t.label["flies"]), (IN, IN, OUT))
        t.retract(a_penguin)
        self.assertEqual((t.label["abnormal"], t.label["flies"]), (OUT, IN))
        t.retract(a_bird)
        self.assertEqual(t.label["flies"], OUT)

    def test_loops(self):
        t = JTMS()
        t.justify("p", outs=["q"])
        t.justify("q", outs=["p"])  # an even loop: two stable models, so the well-founded labels are UNDEC
        self.assertEqual((t.label["p"], t.label["q"]), (UNDEC, UNDEC))
        t.justify("r", outs=["r"])  # an odd loop: no stable model
        self.assertEqual(t.label["r"], UNDEC)
        t.justify("s", ins=["s"])  # a positive loop has no support
        self.assertEqual(t.label["s"], OUT)
        t.assume("q")
        self.assertEqual((t.label["p"], t.label["q"]), (OUT, IN))

    def test_random_against_brute_force(self):
        rng = random.Random(20261115)
        undecided = 0
        for _ in range(250):
            n = rng.randint(1, 8)
            universe = list(range(n))
            t = JTMS()
            for x in universe:
                t.add_node(x)
            live = {}
            for _ in range(14):
                if live and rng.random() < 0.35:
                    jid = rng.choice(sorted(live))
                    t.retract(jid)
                    del live[jid]
                else:
                    x = rng.randrange(n)
                    ins = tuple(rng.sample(universe, rng.randint(0, min(2, n))))
                    outs = tuple(rng.sample(universe, rng.randint(0, min(2, n))))
                    live[t.justify(x, ins, outs)] = (x, ins, outs)
                rules = list(live.values())
                true, false = wfs_brute(rules, universe)
                self.assertEqual(t.label, labels_from(universe, true, false))
                undecided += len(true) + len(false) < n
            if len(true) + len(false) == n:
                self.assertEqual(stable_models_brute(rules, universe), [true])
        self.assertGreater(undecided, 100)  # the random networks do reach the UNDEC case


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

History

Doyle (1979) introduced the truth maintenance system at MIT, with SL justifications that have in-lists and out-lists, the requirement of well-founded support, and dependency-directed backtracking from the work of Stallman and Sussman. McAllester gave the logic-based TMS around 1980, and de Kleer (1986) the assumption-based TMS. Elkan (1990) showed that the labellings of a nonmonotonic TMS are the stable models of the network read as a logic program, and that finding one is NP-complete. Forbus and de Kleer (1993) gave the standard textbook treatment.

References

  1. Jon Doyle, A truth maintenance system, Artificial Intelligence 12(3), 231 to 272 (1979), the definitions of nodes, SL justifications with in-lists and out-lists, well-founded support, the relabelling procedure and dependency-directed backtracking
  2. Charles Elkan, A rational reconstruction of nonmonotonic truth maintenance systems, Artificial Intelligence 43(2), 219 to 234 (1990), the reading of the labellings of a nonmonotonic TMS as stable models, and the proof that finding one is NP-complete
  3. Kenneth D. Forbus and Johan de Kleer, Building Problem Solvers, MIT Press (1993), the chapters on the justification-based TMS, its interface to a rule engine, and contradiction handling
  4. Allen Van Gelder, Kenneth A. Ross and John S. Schlipf, The well-founded semantics for general logic programs, Journal of the ACM 38(3), 620 to 650 (1991), unfounded sets and the definition of the well-founded model as the least fixed point of the operator W

Where this leads

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