= Solution
Index the coins so that $c_1$ is smallest and $c_n$ largest. Choose $s_1$ as the initial stack and $s_2$ as the destination, assuming $k\ge2$. The <static predicate> facts describing size are
$$
S_{\mathrm{size}}=\{\operatorname{Smaller}(c_i,c_j):1\le i<j\le n\}.
$$
No size comparison with $g$ is needed: moving onto empty ground will have a separate <action schema>. The initial <STRIPS> state is
$$
\boxed{
I=S_{\mathrm{size}}
\cup\{\operatorname{OnTop}(c_i,c_{i+1}):1\le i<n\}
\cup\{\operatorname{OnTop}(c_n,g),\operatorname{Topmost}(c_1,s_1)\}
\cup\{\operatorname{Topmost}(g,s_j):2\le j\le k\}.}
$$
Under the <closed-world assumption>, all other ground <ground atoms> are false. In particular, the initial state contains just one <predicate> fact naming the top of each stack. The <predicate> $\operatorname{OnTop}$ names the immediate support, not every coin farther below.
An explicit positive conjunctive goal is the following <set> of required <ground atoms>:
$$
\boxed{
G_{\mathrm{goal}}=
\{\operatorname{OnTop}(c_i,c_{i+1}):1\le i<n\}
\cup\{\operatorname{OnTop}(c_n,g),\operatorname{Topmost}(c_1,s_2)\}
\cup\{\operatorname{Topmost}(g,s_j):j\ne2\}.}
$$
A state succeeds when it contains $G_{\mathrm{goal}}$. The <static predicate> facts in $S_{\mathrm{size}}$ persist automatically. Starting from $I$, the <planning state invariants> proved below make this goal exactly the desired completed stack on $s_2$ with all other stacks empty. If any new stack is acceptable, the choice of $s_2$ loses no generality because the initially empty stacks are interchangeable.
Back to article page