# But It Was True When I Checked: Compiling SHOP-Style Method Preconditions into Partially-Ordered HTN Planning

A compilation keeps SHOP-style method preconditions under partial order

Harrison Oates · arXiv · 2026-11-8

- **Problem** HDDL checks a method's precondition before the method starts, so under partial order unrelated actions can invalidate it before the first action runs. Earlier work could compile only the total-order case, so the first-action semantics had no known compilation.
- **Method** The compilation marks each method's first-action subtask and guards it with two facts.
- **Results** The authors prove that the compiled problem's solutions match exactly the first-action solutions, with no method preconditions left.

## HDDL's check-first reading versus SHOP2

HDDL gives each method an extra check task that carries the precondition and runs before every other subtask of that method. Under total order this matches SHOP2, because only auxiliary tasks that leave the state unchanged can sit between the check and the first action. Under partial order, unrelated actions can run in that gap, so the precondition may be false when the first action executes.

Under the HDDL compilation, the plan that checks the bay, closes it, loads and dispatches the order, and reopens it is a solution. The check passed when it ran, so the order ships through a closed bay. SHOP2 rejects this plan, because after decomposing the shipment its next choice must come from that method. Since decomposition doesn't change the state, the closing of the bay can't slip in before loading.

The authors call the SHOP reading the first-action semantics, in which the precondition must hold directly before the method's first action. The original SHOP planner, which supports only totally ordered methods, meets this by construction. Erol, Hendler and Nau express the same idea with a state constraint that requires the precondition immediately before the first primitive task.

The paper gives this reading as the one in the running example's Figure 2 (ii) and (iii), which are solutions under both semantics. In the running example, the HDDL reading accepts linearisation (i), where the shipment's first action runs while the bay is closed, and the first-action reading rejects it.

## Why the question stayed open

HDDL's designers judged that a system using the first-action reading would need native support, because a compilation is not easily possible. They therefore adopted the compilation semantics and left the first-action reading as a feature for future extensions. Under total order, the IPC 2020 rules demand the precondition in the state where the first action executes.

Under partial order, the rules require it only in some earlier state before that first action.

Later papers have called the partial-order reading problematic, and Höller et al. (2022) accept HDDL's definition for practical reasons. Chen and Bercher (2021) observe that the HDDL reading compiles away easily, while the second version has no obvious compilation. Yousefi and Bercher (2024) exclude method preconditions from their formalism, calling the HDDL interpretation semantically doubtful under partial order.

Lin et al. (2023) extend CYK-based verification to method preconditions, but only under total order.

Ondrčková, Pantůčková and Barták (2024) show that interleaving makes compiling constrained empty methods significantly more difficult under partial order, and they leave it open. Much of the HTN theory and many planners drop method preconditions, on the grounds that HDDL's auxiliary task compiles them away. Behnke, Höller and Biundo (2017) call this a not a real restriction, yet under partial order the argument silently swaps the first-action semantics for HDDL's.

So results for formalisms without method preconditions do not directly carry over to the first-action semantics.

The authors name three challenges that any compilation of the first-action semantics must overcome. First, a method's first action may lie several decompositions below one of several unordered subtasks, and only the plan fixes which subtask produces it. Second, nested methods may share one first action, so their preconditions must hold in the same state.

Third, interleaving lets another task produce an action between a check and the first action, so the compilation must exclude every such intervention. The paper's answer marks the producing subtask nondeterministically and uses a global lock built from two fresh facts.

## Matching SHOP2's runs

SHOP2 keeps a set of tasks it may work on next, starting from the minimal tasks of the network.

The argument for the forward direction is that, after a decomposition, SHOP2 stays below that method until it executes a primitive task. Since decomposition doesn't change the state, that action is the first action of every method on the path. The action therefore runs in the state where each of those preconditions was evaluated.

For the reverse direction, a first-action solution is replayed one action at a time. Before each action ai, the replay decomposes from the top down every task whose method application has ai as its first action.

Goldman's formal semantics of SHOP2 makes the same choice. This matches the first-action semantics that the compilation in the next section targets.

## Marking the first-action subtask

The compilation tracks the first-action subtask by giving each method one variant per candidate subtask, so the chosen variant names the producer. Only minimal subtasks are candidates, because a subtask with a predecessor comes after the entire non-empty yield of that predecessor. Such a subtask therefore cannot contain the first action, so the compilation skips it.

Which subtask produces the first action depends on the plan, so the compilation can't fix the choice in advance. For the shipment method mS, the first action comes from U in some plans and from c in others.

A marked compound subtask becomes a first copy, which passes the obligation to the method that decomposes it. A marked primitive subtask becomes a release action, written with the superscript R for release. Every unmarked subtask becomes a normal copy, which carries no obligation. Following the marks downward from a normal task yields a marked chain through zero or more first copies, ending at a release action.

In the running example, marking U inside the normal variant of S gives the chain m\_S, m\_U, a^R, as in linearisation (ii). Marking c instead gives the chain m\_S, c^R, and a separate chain m\_U, a^R appears, as in linearisation (iii). Marking alone does not enforce the choice, so the compilation adds two fresh facts, free and lock, to protect the interval before the first action.

Exactly one of free and lock holds at any time, and the opening check swaps free for lock. The task network makes an explicit lock owner unnecessary, because each chain's inner checks and release wait for its opening check.

## A lock that guards each window

Marking names the intended first action, but the compilation needs a second mechanism to make that choice hold. It adds two fresh facts, free and lock, and exactly one of them holds at any moment. An opening check at the start of a chain requires the method's precondition and free, then swaps free for lock. Formally, the opening check adds lock and deletes free, while the inner check needs the precondition and lock and changes nothing.

A release action needs lock on top of its own precondition, and it swaps lock back to free. Ordinary actions require free, so an unrelated action can't slip into the gap before the marked action.

The compilation never records an owner for the lock, because the task network makes one unnecessary. A chain that hasn't been opened has its inner checks and release held back behind its opening check. A chain that has finished has already run its inner checks and release. So only the active chain can release the lock, and two facts suffice however many method applications occur.

The ordering constraints of the task network ensure that only the chain that acquires the lock can release it.

The restriction applies only inside lock windows, so the marked subtask gets no ordering against its siblings. The rest of the marked subtask's yield can therefore still interleave with other tasks outside the window. Lemma 3 states that each window is exactly the opening check, the inner checks in chain order, and the release of one marked chain.

Its proof inducts along the linearisation and shows that at most one chain is active at a time.

## Soundness and completeness of the compiled first-action semantics

Soundness and completeness of the compilation rest on Lemma 2, which says each application to a normal task starts exactly one marked chain. The chain runs through zero or more applications to first-copy tasks and ends at one release action in mode R. Every check and every release lies on exactly one chain, so the chains partition the checks and releases of a decomposition.

Along a chain, each check precedes the next check and then the release, so the checks come in chain order.

Lemma 3 then says each lock window is exactly one marked chain's checks and release, so no outside task enters a window. The proof inducts along the linearisation and shows at most one chain is active at a time. While a chain is active, free is false, so only its inner checks and its release can run. Soundness follows: for an application µ, the release r of its chain descends from µ, and only checks sit between µ's check and r.

For completeness, the authors mark in every application µ the subtask containing its first action, which is minimal. They then insert the checks as in Lemma 1, so each block of normal actions and checks restores free. Corollary 1 makes erasing checks and annotations a bijection from compiled solutions to first-action solutions. The marks are fixed by the first actions, and by Lemma 3 the checks' positions are fixed as well.

The authors formalised Definitions 1 and 2, Lemmas 1 to 3, Proposition 1 and Theorem 1 in Lean 4 with Mathlib. The development is publicly available at the GitHub repository named in the paper.

## The running example in numbers

The running example has exactly one complete decomposition, and its final network admits 30 linearisations. Under the HDDL compilation, both checks can be scheduled at the beginning, where p holds, so all 30 linearisations are solutions. Figure 2(i) shows one such linearisation, in which the shipment starts with a while the bay is closed.

The first-action semantics requires each method's precondition to hold in the state directly before that method's first action. Under this reading, the first action of m\_U is always a, and the first action of m\_S is whichever of a and c comes first.

Action a cannot execute strictly between k and r, where p is false, and neither can c if it precedes a. In linearisation (i), a is the first action of both m\_S and m\_U and comes after k, where p is false. In linearisation (ii), both methods start with a, so both preconditions must hold in the initial state. In linearisation (iii), m\_S starts with c, while m\_U starts with a after r, so their preconditions are evaluated in different states.

The compiled problem has 8 methods, and it reproduces linearisations (ii) and (iii) but not (i). If the check is delayed until after k, it fails while p remains false.

## Size and fragments

The compilation produces 2\|N\_C\| compound task names and 2\|N\_P\| + 2\|M\| primitive task names, so the new name counts grow with the original task and method sets. Its description size is quadratic in the problem size in general, because each method gets one variant per minimal subtask. Each variant adds one check task and \|Tm\| ordering pairs, so the cost per variant scales with the method's network.

Under total order, every method has km = 1, so the bound becomes linear in the problem size. The construction runs in polynomial time, and the paper's size bound in equation (2) counts explicit task and ordering lists.

The compiled problem keeps total order, acyclicity, tail recursion and regularity of the original problem. Giving the copies cN and cF the level of c keeps tail recursion, and acyclicity follows because compiled dependencies project back to original ones. Because of this, the known plan-existence bounds carry over to the first-action semantics within these fragments.

Methods without preconditions need no check in their N-variants, so Proposition 4 drops those checks without increasing size. In their F-variants, the marking stays, since those variants still pass on an ancestor's first-action obligation. The construction also applies unchanged to lifted HDDL domains, because marks select subtask occurrences and free and lock are nullary.

## Open problems

Empty methods have no first action, so the authors attach each one's precondition to a no-op placed in its subtask network. The no-op carries the state in which the check is evaluated, and it can also serve as the first action of an ancestor. In their example, the word k r is accepted because the no-op of C can run before k while q still holds.

Requiring q to hold before r, the first action that is not a no-op, would reject that word, so the convention decides which words count as solutions.

That compilation works because all of the pairs are tested in the same state.

The main worked evidence is the running shipping example, where exhaustive enumeration confirms the compiled solutions. The compiled solutions project to exactly 19 first-action solutions, and each of them has a single compiled decomposition. The authors formalised Definitions 1 and 2, Lemmas 1 to 3, Proposition 1 and Theorem 1 in Lean 4 with Mathlib.

Readers can check the proofs in the public Lean development, which is available at the authors' GitHub repository.

## Paper info

- **Authors**: Harrison Oates
- **Venue**: arXiv · Preprint
- **First published**: 2026-11-8
- **Added**: 2026-11-10
- **Updated**: 2026-11-8
- **Version**: v1
- **arXiv**: 2611.11055
- **Category**: cs.AI
- **Original paper terms**: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)
- **What we show**: Paper info, commentary and permitted figures from the original paper

[Original paper ↗](https://arxiv.org/abs/2611.11055v1) · [PDF ↗](https://arxiv.org/pdf/2611.11055v1)

AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.

## Abstract

Method preconditions specify when a method may be applied in hierarchical task network (HTN) planning, but their meaning differs under two established semantics. The SHOP planners, like the classical HTN formalism of Erol, Hendler and Nau, require the precondition to hold immediately before the method's first action. HDDL, the input language of the International Planning Competition's HTN track, instead introduces an auxiliary action to check it; under partial order, unrelated actions may invalidate the precondition before the method starts. HDDL's designers adopted this weaker semantics because the first-action reading could not easily be compiled. Subsequent work has repeatedly identified its compilation under partial order as an open question, with existing transformations limited to total order. We give a compilation of the first-action semantics into standard partially ordered HTN planning without method preconditions using only two additional facts, thereby resolving a longstanding question in the HTN planning community.

## Quote from the paper

Harrison Oates (2026). But It Was True When I Checked: Compiling SHOP-Style Method Preconditions into Partially-Ordered HTN Planning. arXiv:2611.11055v1. https://arxiv.org/abs/2611.11055v1

**BibTeX**

```
@misc{oates2026true,
  title = {{But It Was True When I Checked: Compiling SHOP-Style Method Preconditions into Partially-Ordered HTN Planning}},
  author = {Harrison Oates},
  year = {2026},
  eprint = {2611.11055},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.11055v1}
}
```

## Other paper commentary

- [Learning to Rank Propagators in Constraint Programming](https://refivu.com/en/papers/c113b866-d02f-420e-897f-5b5ecb0f1080-learning-to-rank-propagators-in-constraint-programming.md)
- [Pixels over Symbols: Sensory Realism Improves Behavioral Alignment in Models of Cognition](https://refivu.com/en/papers/f163388c-619b-4473-b0c2-357e1b91ea25-pixels-over-symbols-sensory-realism-improves-behavioral.md)
- [Guiding future global temperature distributions with simulations and observations](https://refivu.com/en/papers/0f0e0eec-05c1-4800-8206-66b04e61e097-guiding-future-global-temperature-distributions-with.md)
- [Beyond the Mean Gap: What Transferred-Angle QAOA Retains on a Superconducting Processor](https://refivu.com/en/papers/8f033d4e-6221-47eb-ba57-a9271b2927e9-beyond-the-mean-gap-what-transferred-angle-qaoa.md)
- [A Reduction of Imitation Learning and Structured Prediction to No-Regret Online Learning](https://refivu.com/en/papers/08306129-4598-48b6-baf3-9d1af09e03a6-a-reduction-of-imitation-learning-and-structured-prediction.md)
- [NICE: Non-linear Independent Components Estimation](https://refivu.com/en/papers/f56da4f3-4308-4b66-a0bf-e0d6e495195a-nice-non-linear-independent-components-estimation.md)
- [Think or Remember: The Exchange Rate of Agentic Inference](https://refivu.com/en/papers/430e6cf8-4d25-4ea8-8672-86be1d22daf9-think-or-remember-the-exchange-rate-of-agentic.md)
- [Identifiable alignment of unpaired representations](https://refivu.com/en/papers/d1142187-968e-4d40-b99f-8cc798e1c8a1-identifiable-alignment-of-unpaired-representations.md)
- [How to "train" a surgeon? Benchmarking generalist agents in surgical scene understanding](https://refivu.com/en/papers/c14fcb0f-7658-4cdb-aab2-a512b0b5e61c-how-to-train-a-surgeon-benchmarking-generalist-agents.md)
- [AbductionBench: Benchmarking Abductive Reasoning in Large Language Models](https://refivu.com/en/papers/5447aa31-8498-47e7-ac8b-ac02bc06c0bc-abductionbench-benchmarking-abductive-reasoning-in-large.md)
- [Machine Hearing: Can Audio LLMs Generalize Beyond Human Auditory Perception?](https://refivu.com/en/papers/0cabc2f0-42fb-4be8-9cca-d705df6b4273-machine-hearing-can-audio-llms-generalize-beyond-human.md)
- [Same Contacts, Different Rooms:Meeting Format Shapes LLM Group Influence Beyond Pairwise Contact Counts](https://refivu.com/en/papers/44bb6582-331e-4190-a4d5-2af78e6b5479-same-contacts-different-rooms-meeting-format-shapes-llm.md)

## Terms in this paper

- [Lean 4](https://refivu.com/en/terms/fd09b069af07-lean-4)
- [no-op](https://refivu.com/en/terms/702845b4e1b7-no-op)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/dfa127c3-d21a-4d60-a1c0-9b867b0008c3-but-it-was-true-when-i-checked-compiling)
