Skip to main content
In Dale's Proof Search Foundations for Logic Programming talk, he gives a great minimalist example of an interactive system: toggling a switch. The encoding in Forum, a logic programming language based on full linear logic, goes like this:

flip on off.
flip off on.

toggle G
    o- sw V * flip V U * (sw U -o G)

or in logic,

\[
\exists u,v.[sw\ v\otimes flip\ v\ u \otimes (sw\ u \multimap G)]
\multimap
toggle\ G
\]

(Yes, I mainly did that to test the $$\LaTeX$$ rendering script I'm using.)

The talk I linked to gives a derivation (which I won't painstakingly copy here) illustrating the execution of the program: the goal sequent $$\Gamma; \Delta, sw\ on \longrightarrow toggle\ G$$ evolves through proof search into $$\Gamma; \Delta, sw\ off \longrightarrow G$$.

But this is something of a counterintuitive, higher-order encoding. The "action" by a hypothetical user of toggling the switch must be indexed by $$G$$, the goal that continues the program. Here, the action (together with the continuation) is a logical proposition that becomes the goal clause of proof search.

If instead we did this Twelf-style, we might make "toggle" a term constructor -- a rule for proof search -- rather than a proposition (type) constructor, leading to the following encoding:

flip1 : flip on off.
flip2 : flip off on.
toggle : sw v * flip v u -o sw u.

We now need to invent a distinguished atomic goal ("end") to use this as an action on contexts:

\[
\frac
{
\Gamma; sw\ on \longrightarrow sw\ on
\qquad
\Gamma; \cdot \longrightarrow flip\ on\ off
}
\]
\[
\frac
{
\Gamma; sw\ on \longrightarrow (sw\ on)\otimes(flip\ on\ off)
\qquad
\frac{\vdots}{
\Gamma; \Delta, sw\ off \longrightarrow end}
}
\]
\[
\frac
{
\Gamma; \Delta, sw\ on, (sw\ on)\otimes (flip\ on\ off)\multimap sw\ off
\longrightarrow end
}
{}
\]
\[
\frac
{
\Gamma; \Delta, sw\ on, \forall(v,u).((sw\ v)\otimes (flip\ v\ u)\multimap sw\ u)
\longrightarrow end
}
{
\Gamma; \Delta, sw\ on \longrightarrow end
}
copy
\]

(Sorry for the horrendous formatting; perhaps typesetting derivations with \frac is not really worth it...)

Here $\Gamma$ represents the signature where we've written our rules, and the interactive choice is performed not by selecting a goal, but by selecting a rule (a term from the signature, via "copy") to prove a goal.

There's not necessarily an advantage to looking at things this way, but it is the way of looking at things that is more in line with my slogans.

Comments

  1. (I'm just playing "that makes me think of" because I suspect this is already familiar to you, but...)

    This is also the view that's in like with multiset rewriting, the nice least-common-denominator of a lot of proof search strategies that can be described in CLF (monadic intuitionistic linear logic), LO/Forum (classical linear logic), and LLF (mostly-vanilla dual intuitionstic linear logic).

    The last one leads to the most annoying encoding, but it's at least very uniform one; I think I'd prefer it to Dale's formulation. As in Dale's formulation, we make things higher-order in the sense of left-nested arrows, but not higher-order in the sense of "toggle" taking a proposition G as an argument.

    flip1 : flip on off.
    flip2 : flip off on.
    toggle : (sw U -o end)
      -o (sw V -o flip V U -o end)

    You should be able to convince yourself that this gives rise to a very different intermediate derivation than the one you gave, but one with the exact same "top sequent" and "bottom sequent" that you gave.

    ReplyDelete

Post a Comment

Popular posts from this blog

Using Twine for Games Research (Part II)

This preliminary discussion introduced my thoughts on using Twine as a tool for creating prototypes for games research. I'll start with documenting my first case study: a hack-and-slash RPG-like setting where the player character has a record of attributes ("stats") that evolve through actions that turn certain resources (money, health, items) into others. I've selected this hack-and-slash example because it falls outside the canonical "branching story" domain thought to be Twine's primary use case, but it is not too much trickier to implement. It relies crucially on the management of state in ways that simple branching stories would not, but it does so in a fairly straightforward way.

If all goes well, this post may also serve as a tutorial on the "basics" of Twine (links + variables + expressions). In particular, I'll be using Twine 2/Harlowe, and I haven't seen many tutorials for this new version published yet.

To me, the main "…

Why I don't like the term "AI"

Content note: I replicate some ableist language in this post for the sake of calling it out as ableist.

In games research, some people take pains to distinguish artificial intelligence from computational intelligence (Wikipedia summary), with the primary issue being that AI cares more about replicating human behavior, while CI is "human-behavior-inspired" approaches to solving concrete problems. I don't strongly identify with one of these sub-areas more than the other; the extent to which I hold an opinion is mainly that I find the distinction a bit silly, given that the practical effects seem mainly to be that there are two conferences (CIG and AIIDE) that attract the same people, and a journal (TCIAIG - Transactions on Computational Intelligence and Artificial Intelligence in Games) that seems to resolve the problem by replacing instances of "AI" with "CI/AI."

I have a vague, un-citeable memory of hearing another argument from people who dislike the…

Using Twine for Games Research (Part III)

Where we last left off, I described Twine's basic capabilities and illustrated how to use them in Twine 2 by way of a tiny hack-and-slash RPG mechanic. You can play the result, and you should also be able to download that HTML file and use Twine 2's "import file" mechanism to load the editable source code/passage layout.

Notice that, in terms of game design, it's not much more sophisticated than a slot machine: the only interesting decision we've incorporated is for the player to determine when to stop pushing her luck with repeated adventures and go home with the current spoils.

What makes this type of RPG strategy more interesting to me is the sorts of decisions that can have longer-term effects, the ones where you spend an accumulation of resources on one of several things that might have a substantial payoff down the road. In a more character-based setting, this could be something like increasing skill levels or adding personality traits.

Often, the game-…