STRIPS: plan backward through what actions change
STRIPS 表示
Derive goal regression, preserve undeleted facts and find a shortest plan with an explicit budget and independent forward replay.
stripsThe final step decides what must have been true before it
A fictional workshop prepares an exhibit. Washing makes it clean; priming prepares it for paint; painting produces a painted exhibit. Inspection needs the paint to remain visible. Sealing covers the paint and leaves the exhibit sealed. The goal is to have an exhibit that is both inspected and sealed.
| Action | Must be true before | Becomes true | Becomes false |
|---|---|---|---|
| wash | raw | clean | raw |
| prime | clean | primed | clean |
| paint | primed | painted | primed |
| inspect | painted | inspected | nothing |
| seal | painted | sealed | painted |
Start with only raw true. The sequence wash → prime → paint → inspect → seal works. Swap the last two actions and inspection becomes impossible: painted was deleted. It is not enough to collect one action for each goal and concatenate the lists. Actions can undo conditions needed elsewhere.
Work backward instead. If sealing is last, sealed will be supplied by that action, but inspected must already hold. Sealing also needs painted. The earlier goal is therefore {inspected, painted}. Inspecting can achieve it from {painted}; painting needs {primed}; priming needs {clean}; washing needs {raw}. We have reached a requirement already satisfied by the initial state.
This is goal regression. Each backward node describes required facts, not a complete earlier world. Many complete states can meet the same requirement. Poole and Mackworth, regression planning.
An action changes selected facts and preserves the rest
Let be a finite set of propositional atoms. A state records exactly the atoms that are true; all other declared atoms are false. A positive goal means their conjunction, so it is satisfied when . An empty goal is already satisfied. The atom name not-p is just a string here, not logical negation.
A ground action has positive preconditions , add effects and delete effects . Ground means that object parameters have already been instantiated. We require disjoint add and delete sets, and allow a precondition to also be added or deleted.
The transition is defined only for applicable actions. Facts outside the effects persist. This rule is an explicit model of change; a physical process may have side effects omitted from the model. An action is deterministic, instantaneous and assigned cost one in this example. There are no durations, probabilities, resources or hidden observations.
The name STRIPS has two related uses: the historical planning system and a later restricted action representation. Fikes and Nilsson’s 1971 paper describes first-order world formulas, theorem proving within a world model and means–ends search between models. Its operators were distinct from the robot routines that executed actions. The finite propositional representation and backward BFS below are a teaching implementation, not a reconstruction of that system. Original paper, pp189–193.
For a positive goal, an action can be a relevant final step when it adds a required fact and deletes no required fact. Its regression replaces achieved goals with the action’s preconditions:
The relevance condition prunes actions that contribute nothing to the current goal. The no-delete condition is stronger than a preference: with disjoint effects, a deleted required fact cannot hold immediately afterward. The general backward-planning construction checks both useful effects and consistency; here all requirements are positive propositions. Regression construction and stopping condition.
For any action that deletes no member of , regression is an exact characterization of its successful predecessor states:
To prove the forward direction, the regressed set supplies all preconditions and every required fact not added by the action. No required fact is deleted, so the goal holds afterward. For the reverse direction, applicability supplies the preconditions. Any goal fact not added must have been true beforehand. This argument does not require the relevance condition; relevance only reduces the search.
Search sets of requirements, then replay the plan forward
Start a breadth-first queue at . For every dequeued requirement set, try actions in sorted ID order. Reject irrelevant actions and threats, compute the earlier requirement set, and remember unseen sets. Stop when a generated set is contained in the initial state. Its parent chain lists the actions in execution order: the most recently chosen backward action runs first.
The search is sound by applying the predecessor equivalence repeatedly. It is complete for finite positive STRIPS: if a plan reaches a goal that is not already true, its last useful action adds a goal fact and deletes none. Any trailing action that adds no required fact can be removed without losing that goal. Repeat this reasoning on the shorter prefix and its regressed goal. A shortest plan has no removable trailing action at any such step. BFS therefore finds a plan with the fewest actions, whenever one exists. It does not minimize duration or an unrepresented financial cost, and backward ID order does not promise a lexicographically first forward plan.
There are at most distinct requirement sets for . With actions, straightforward set operations and expected constant-time hash-table lookup give the following loose bounds for one search, excluding the already stored domain:
Each node is expanded at most once, each expansion considers at most actions, and each regression or set hash can touch atoms. Parent records and queued sets account for the space bound. Input normalization takes linear work in the supplied atom occurrences, plus sorting action IDs. These bounds count string comparisons and hash operations at unit cost; exceptionally long names require their own character costs. Each call also spends O(L_initial + L_goal) time reading the raw initial and goal lists before the search; duplicates can make those lengths much greater than n. Normalization stores only distinct atoms. A budget can stop a search sooner without changing the unrestricted bound.
The full program accepts exact list/tuple atom collections, nonempty string names and a list/tuple of four-field action tuples. All referenced atoms must be declared; action IDs must be unique. Duplicate atoms have set semantics. Empty vocabularies and empty action lists are valid. Constructor inputs are copied; the public model fields are not intended to be edited afterward.
A nonnegative integer budget limits started expansions, not discovered nodes or fully scanned expansions. Success may return before the last action scan finishes. unknown means the budget stopped a nonempty frontier; no-plan means the entire reachable regression graph was exhausted. Neither returns a partial plan. A goal already satisfied returns an empty plan even at budget zero. replay separately rejects an unknown or inapplicable action and returns every state, including the initial one.
# Python 3.10+; finite ground positive STRIPS, unit action costs.
from collections import deque
def name(x):
if type(x) is not str or not x:
raise ValueError('names must be nonempty strings')
return x
def atom_set(xs):
if type(xs) not in (list, tuple):
raise ValueError('atom collections must be lists or tuples')
return frozenset(name(x) for x in xs)
class STRIPS:
def __init__(self, atoms, actions):
self.atoms = atom_set(atoms)
if type(actions) not in (list, tuple):
raise ValueError('actions must be a list or tuple')
parsed = {}
for row in actions:
if type(row) is not tuple or len(row) != 4:
raise ValueError('action: (id, preconditions, add, delete)')
key = name(row[0])
pre, add, delete = (atom_set(x) for x in row[1:])
if key in parsed or not (pre | add | delete) <= self.atoms:
raise ValueError('duplicate action id or undeclared atom')
if add & delete:
raise ValueError('add and delete must be disjoint')
parsed[key] = (pre, add, delete)
self.actions = dict(sorted(parsed.items()))
def _set(self, xs):
s = atom_set(xs)
if not s <= self.atoms:
raise ValueError('undeclared atom')
return s
def replay(self, initial, plan):
state = self._set(initial)
if type(plan) not in (list, tuple):
raise ValueError('plan must be a list or tuple of action ids')
history = [state]
for key in plan:
name(key)
if key not in self.actions:
raise ValueError('unknown action')
pre, add, delete = self.actions[key]
if not pre <= state:
raise ValueError('action is inapplicable')
state = (state - delete) | add
history.append(state)
return tuple(history)
def solve(self, initial, goal, budget=None):
start, target = self._set(initial), self._set(goal)
if budget is not None and (type(budget) is not int or budget < 0):
raise ValueError('budget must be None or a nonnegative integer')
queue, parent = deque([target]), {target: None}
expanded = action_tests = 0
def result(status, plan=None):
return dict(status=status, plan=plan, expanded=expanded,
action_tests=action_tests, discovered=len(parent))
def solved(node):
plan = []
while parent[node] is not None:
node, action = parent[node]
plan.append(action)
return result('solved', tuple(plan))
if target <= start:
return solved(target)
while queue:
if budget is not None and expanded >= budget:
return result('unknown')
current = queue.popleft()
expanded += 1 # Started expansions; success may end the scan early.
for key, (pre, add, delete) in self.actions.items():
action_tests += 1
if not add & current or delete & current:
continue
earlier = (current - add) | pre
if earlier in parent:
continue
parent[earlier] = (current, key)
if earlier <= start:
return solved(earlier)
queue.append(earlier)
return result('no-plan')
def exhibit():
return STRIPS(('raw', 'clean', 'primed', 'painted', 'inspected', 'sealed'), (
('wash', ('raw',), ('clean',), ('raw',)),
('prime', ('clean',), ('primed',), ('clean',)),
('paint', ('primed',), ('painted',), ('primed',)),
('inspect', ('painted',), ('inspected',), ()),
('seal', ('painted',), ('sealed',), ('painted',)),
))
if __name__ == '__main__':
model = exhibit()
initial, goal = ('raw',), ('inspected', 'sealed')
answer = model.solve(initial, goal)
print('status:', answer['status'])
print('plan:', answer['plan'])
print('work:', tuple(answer[k] for k in ('expanded', 'action_tests', 'discovered')))
print('states:', tuple(tuple(sorted(s)) for s in model.replay(initial, answer['plan'])))
print('budget 2:', model.solve(initial, goal, 2)['status'])
print('already true:', model.solve(('sealed',), ('sealed',), 0)['plan'])
print('conflicting goal:', model.solve(initial, ('painted', 'sealed'))['status'])
try:
model.replay(('painted',), ('seal', 'inspect'))
except ValueError as error:
print('wrong order:', error)
A deleted fact reveals the wrong order
Run the complete program. It prints:
status: solved
plan: ('wash', 'prime', 'paint', 'inspect', 'seal')
work: (13, 65, 17)
states: (('raw',), ('clean',), ('primed',), ('painted',), ('inspected', 'painted'), ('inspected', 'sealed'))
budget 2: unknown
already true: ()
conflicting goal: no-plan
wrong order: action is inapplicable
The successful plan uses five actions. BFS started 13 requirement-set expansions, tested 65 action candidates and discovered 17 distinct requirement sets. Those counts refer to the backward search, not 17 physical states visited by the exhibit. Some regressed sets have no achievable supporting state; the algorithm can still explore them.
For example, regressing {inspected, sealed} through inspect produces {painted, sealed}. Both are positive atoms, so there is no syntactic contradiction. In this particular domain, however, sealing deletes painted and the consumed preparation stages prevent repainting. The branch has no solution. Starting with both facts true would be accepted by this abstract interface: it does not impose additional real-world invariants on user-supplied states.
An action model is also a set of assumptions
Positive STRIPS makes change easy to inspect, but the finite vocabulary and complete state valuation must be supplied. Schema grounding can generate many actions; this code receives already ground actions and performs no unification. Negative goals, negative preconditions, conditional effects and nondeterministic outcomes need explicit semantics and algorithm changes. Adding a complementary atom does not by itself enforce that exactly one of a positive/complementary pair is true.
Regression may save work when a small goal makes few actions relevant. It can also generate many unreachable requirements, as the exhibit example shows. Forward search examines states reachable from the initial state; backward search examines requirements potentially supporting the goal. Neither direction is uniformly smaller. Domain invariants and admissible heuristics can prune more, but are not included in this implementation.
The search and execution model are separate. The program proves reachability only under its declared transitions. An actual robot or workflow needs observations and an execution monitor to notice failed actions, changed conditions and side effects. A new plan is useful only if its state description remains credible.
Continue with classical planning and forward search, breadth-first search and planning graphs.
Change the conditions, then predict the result
Exercise 1: regress the same goal through two different actions
Answer: Through seal, {inspected, sealed} becomes {inspected, painted}. Through inspect, it becomes {painted, sealed}. The first has a plan from {raw}; the second does not in this action model. Regression does not automatically know which positive combinations are unreachable.
Exercise 2: remove the check for deleted goal facts
Answer: Start at {painted} and ask for {painted, sealed}. Without the threat check, regression through seal gives {painted} and falsely declares success. Forward replay ends at {sealed}, missing painted. The formal program returns no-plan for that query.
Exercise 3: what does a zero budget establish?
Answer: With initial {sealed} and goal {sealed}, it returns solved and an empty plan without expanding a node. With initial {raw} and goal {inspected, sealed}, it returns unknown. In a domain with no actions, an unsatisfied goal still returns unknown at budget zero, then no-plan at budget one when the lone requirement set is exhausted.
Exercise 4: make one of the actions take an hour
Answer: Merely annotating a duration does not change this algorithm: it still minimizes action count. To minimize additive nonnegative costs, store costs and replace BFS with a suitable cost-ordered search over regressed requirements. Durations that overlap or depend on resources need a richer scheduling model. A five-step plan is not thereby the fastest plan.
Original system and modern regression
- Fikes and Nilsson, STRIPS: A New Approach to the Application of Theorem Proving to Problem Solving (1971), Artificial Intelligence 2, pp189–208. Author-hosted original. The article header’s September 1–3 dates describe the IJCAI presentation, not an inferred journal publication day.
- Poole and Mackworth, Artificial Intelligence: Foundations of Computational Agents, third edition, §6.3. Regression planning. Its feature-based treatment is broader than the positive propositional fragment implemented here.
The exhibit, Python implementation, output and exercises were developed for this article. No original paper figure or upstream program is reproduced.
Make a prediction, then check
Initially only painted is true. The sole action seal adds sealed and deletes painted. Can both goal atoms hold afterward?
Learning objectives
- Represent deterministic actions with positive preconditions and add/delete sets; distinguish the historical STRIPS system from the modern finite propositional representation.
- Derive exact predecessor regression and explain goal threats, relevance and completeness for shortest plans.
- Run budgeted backward BFS, validate plans by forward replay and distinguish unknown from exhaustive no-plan.
Prerequisites & connections
Explore related knowledge →References
- STRIPS: A New Approach to the Application of Theorem Proving to Problem Solving
Richard E. Fikes; Nils J. Nilsson · 1971 - Artificial Intelligence: Foundations of Computational Agents, 3e — §6.3 Regression Planning
David L. Poole; Alan K. Mackworth
Version1 · Editorial status: Recorded technical checks completed
View technical check record (AI)
Codex · 2026-09-05 · Codex technical check: primary-source locations, original runnable models, independent finite-state oracles, bilingual review and second-agent cross-checks; not independent human peer review.
- Original bilingual articles with four identical display equations, six stable main anchors, identical complete Python and eight actual output lines, and four answered exercises. Reread the historical-system/modern-representation distinction, positive/negative semantics, grounding, fact persistence, unit costs, empty goals and invariant boundary.
- All nine author tests passed. An independent reference constructs forward Boolean transition matrices and applies Floyd shortest distances, without goal regression. Exhausted all1296 two-atom/two-action domains with20736 queries and216 three-atom/single-action domains with13824 queries, plus80 seed68312 four-atom domains with20480 queries:55040 queries checked for status, minimum action count, atom-by-atom forward replay and count upper bounds. This does not claim exact work-counter equality for every query.
- The exact example returns wash/prime/paint/inspect/seal with13 started expansions,65 action checks and17 discovered requirement sets; compared the full stdout byte for byte. Budgets0–12 return unknown and13 matches the unrestricted result dictionary. An unsatisfied no-action domain is unknown at budget0 and no-plan at1; an already satisfied goal returns an empty plan at0.
- Independent forward replay exposes how omitting the threat guard falsely accepts painted together with sealed; actually executed the inspect/seal order counterexample. Checked unsupported preconditions, empty effects, duplicate atoms, copied input lists, competing plan lengths and not-p as an ordinary atom. Invalid domains, budgets, queries and replay inputs raise ValueError.
- The prose proves exact predecessor equivalence, soundness, useful-action completeness for shortest plans and BFS minimum action count, without promising forward lexicographic minimality. Copying/set-hash costs, extra reading cost for duplicate-heavy query lists and the lack of physical execution validation are explicit. Preliminary peer feedback added O(L_initial+L_goal) per-query input cost and aligned the six standard anchors.
- Actually rendered both languages with the repository display-math plugin, strict KaTeX and React static HTML: four displays, six main headings and four details each, without math errors. The initial render treated plain-set braces as MDX expressions; changed those sets to inline code and reran successfully. Compilation is not claimed as browser or whole-site acceptance.
- Read both complete frozen articles, full Python, four display equations, four answered exercises, metadata and all nine author tests; reran all nine successfully. Code and eight actual stdout lines agree byte for byte across languages, with six anchors in matching order. Author verification of 55,040 queries is now accurately scoped to status, shortest action count, coordinate-wise replay and counter upper bounds.
- The first independent reference enumerates complete Boolean worlds for each action and positive goal, updates each coordinate, and collects exactly the applicable predecessors whose successors satisfy that goal. Their meet gives a positive requirement; all its upward extensions are checked to equal the predecessor model set. No production regression formula is called. The documented relevance filter is applied separately as search policy. Synchronous shortlex path-language relaxation then determines requirement visitation order, without a production-style BFS queue or the author’s forward Floyd distances.
- Across 1,736 domains and 18,536 semantic-predecessor checks, all 279,635 complete result dictionaries matched: status, plan, expanded, action_tests and discovered. Coverage includes all 1,296 two-atom/two-action domains at seven budgets; all 216 three-atom/single-action domains at four budgets; 120 three-atom and 100 four-atom domains using independent seed 882291; empty domains; a tie fixture; and all 64 initial states × two goals × 66 budgets in the exhibit domain.
- A second independent reference enumerates every action word by length and reverse lexicographic order, executing coordinates directly, up to one fewer than the number of complete states. The bound suffices because repeated-state segments can be removed from shortest deterministic finite-state plans. All 42,245 queries matched on shortest plan and tie selection. Another 156,303 returned executions were checked against complete replay histories, not only final goal satisfaction.
- An independent tie fixture returns az→aa rather than ab→zz, confirming that backward ID order does not guarantee chronological lexicographic minimality; exact counters are 2/7/4. Exhibit counters are 13/65/17. Budgets and early success distinguish started from fully scanned expansions; an already true goal returns an empty plan at zero, while an unsatisfied no-action goal is unknown at zero and no-plan at one. Omitting the threat check falsely accepts painted together with sealed; the actual program rejects that regression.
- All 76 invalid cases raise ValueError, covering exact container/name types, action rows, undeclared atoms, duplicate IDs, conflicting effects, queries, budgets and replay. Eighty mutable-input copying and duplication/permutation checks preserve every result field. A further 100,000 initial occurrences and 100,001 goal occurrences correctly produce the empty plan, while making the raw-list reading cost explicit. Public model field mutability is bounded by the documented no-edit usage contract.
- Checked both directions of predecessor equivalence: goals not added must hold beforehand, and undeleted facts persist. Equivalence needs no relevance restriction; relevance is only pruning. Removable noncontributing final actions support completeness for finite positive STRIPS, and unit-cost BFS gives minimum action count. Copying/hashing, parents and queues are covered by the search bounds O((m+1)(n+1)2^n) time and O((n+1)2^n) space outside the stored domain, with raw query reading and name-character costs separate. Instance invariants are not misrepresented as automatic input validation.
- Independent strict MDX, remark-math, repository display-math plugins, KaTeX and actual React static HTML pass in both languages: four displays, six main headings, four details and four strong answers, without math errors or emphasis remnants outside code. All four display MathML TeX annotations match the source exactly. Inline formula multisets agree; only n and 2^n exchange order through translation. Direct article targets exist. No browser or whole-site build was performed.
- Promoted the full prose, equations, code and exercises. Tests read formal MDX only; removed temporary fallbacks/draft skips and updated review assertion to checked. Algorithm and independent references are unchanged; final record binds both locale hashes.
- Publication navigation check: linked completed chapters directly and removed their obsolete planned labels. Unfinished topics still link to the catalogue with their status stated. Reversible replacements are recorded; other technical content is unchanged and both hashes are rebound.
Source locations checked:
- STRIPS: A New Approach to the Application of Theorem Proving to Problem Solving · Actually opened the author-hosted20-page journal PDF via web text. Title p189 lines0–29: authors, journal2(1971)189–208, IJCAI presentation September1–3. P190 lines30–64: first-order wffs, separate theorem proving/means–ends search, footnote distinguishing planning operator from actual robot routine. Pp191–192 lines72–130: parameterized schemata, grounded instances, precondition wff and add/delete lists. P193 lines140–169: relevance, incomplete proofs and subgoals. Pp198–200 lines329–416: derived-clause deletion dependencies, resolution-guided operators with bounded proof effort and world-model storage. Did not visually inspect PDF pages or claim the entire20-page paper was audited. No original implementation executed.
- Artificial Intelligence: Foundations of Computational Agents, 3e — §6.3 Regression Planning · Actually opened and read official third-edition §6.3 lines14–76: partial feature assignments as backward nodes; relevant action chosen as the last step; possible/useful conditions and consistency; predecessor requirements formed from preconditions and remaining goals; termination when the initial state satisfies requirements; graph independent of initial state except stopping/heuristics. The article restricts this to positive propositional atoms with disjoint add/delete effects, and does not claim to reproduce the full feature-based formulation.
- STRIPS: A New Approach to the Application of Theorem Proving to Problem Solving · Independently opened the author-hosted 20-page journal PDF through web text. Read printed pp 189–193 (lines 0–177): title/authors, Artificial Intelligence 2 (1971), 189–208; September 1–3 is the IJCAI presentation interval; first-order world formulas; separate within-model theorem proving and between-model means–ends search; planning operators versus actual robot routines; parameterized schemata instantiated before execution; add/delete lists and precondition formulas. Also read the forward/backward combination description on printed p 195, lines 205–215. These substantiate the historical-system/teaching-program distinction. No source figure, original LISP execution or full-paper visual audit claimed.
- Artificial Intelligence: Foundations of Computational Agents, 3e — §6.3 Regression Planning · Independently opened and read the official third-edition §6.3, lines 14–81: requirement nodes as partial assignments, last-action edge meaning, stop when the initial state satisfies the requirement, possible/useful conditions and consistency, preconditions plus unachieved goals, unattainable requirements and implicit invariants. Source discusses feature-valued and conditional-rule forms more broadly than this article. Source superset pruning is not implemented here; the article correctly describes only equal-set deduplication. Footer distinguishes 2023 book copyright and 2025 HTML generation. No upstream code or figure copied.
Related topics