<?xml version="1.0"?>
<turing-machine version="0.1">

<!-- This Turing machine (TM) implements ROT13, which is
     a simple substitution cipher. ROT13 is symmetric. Thus, 
     if the cipher text that is generated by the TM is fed into the 
     TM again, then the original plaintext will be produced.

     If this Turing machine processes the following input tape:
         kfyg vf ghevat pbzcyrgr$
     then it will produce the following final tape:
         xslt is turing complete$ 

     This Turing Machine Markup Language (TMML) document complies
     with the DTD for TMML, which is available at 
     http://www.unidex.com/turing/tmml.dtd.

     This Turing machine can be executed by an XSLT stylesheet that is
     available at http://www.unidex.com/turing/utm.xsl. This stylesheet
     is a Universal Turing Machine.

     The following Instant Saxon command will execute the Turing machine
     described by this TMML document using the utm.xsl stylesheet:

        saxon rot13_tm.xml utm.xsl tape="plaintext$"

     This TMML document is available at 
     http://www.unidex.com/turing/rot13_tm.xml.

     Developed by Bob Lyons of Unidex, Inc.

     Please email any comments about this TMML document to 
     boblyons@unidex.com.
-->

<!-- COPYRIGHT NOTICE and LICENSE.

     Copyright (c) 2001 Unidex, Inc. All rights reserved.

     Unidex, Inc. grants you permission to copy, modify, distribute,
     and/or use the TMML document provided that you agree to the
     following conditions:

     1. You must include this COPYRIGHT NOTICE and LICENSE
        in all copies or substantial portions of the TMML document.

     2. The TMML document is licensed to the user on an "AS IS" basis.
        Unidex Inc. makes no warranties, either express or implied,
        with respect to the TMML document including but not limited to any
        warranty of merchantability or fitness for any particular
        purpose. Unidex Inc. does not warrant that the operation
        of the TMML document will be uninterrupted or error-free,
        or that defects in the TMML document will be corrected.
        You the user are solely responsible for determining the 
        appropriateness of the TMML document for your use and accept
        full responsibility for all risks associated with its use. 
        Unidex Inc. is not and will not be liable for any
        direct, indirect, special, incidental or other damages 
        of any kind (including loss of profits or interruption of business)
        however caused even if Unidex Inc. has been advised of the 
        possibility of such damages.
-->

    <!-- The symbols for the Turing machine. We define a symbol 
         for each lower case letter in the English alphabet. 
         We also define a symbol for an end of 
         text marker (i.e., "$"). The Turing machine will 
         stop when it reads the "$" symbol on the tape.
         We use the default value for the blank symbol (i.e.,
         the space character).
    -->
    <symbols>abcdefghijklmnopqrstuvwxyz$</symbols>

    <!-- The states for the Turing machine.
         There should be one start state and one or more halt states.
    -->
    <states>
        <state start="yes">replace-symbol</state>
        <state halt="yes">stop</state>
    </states>

    <!-- The transition function for the Turing machine.
         This transition function implements ROT13, which is
         a simple substitution cipher in which "a" is replaced by "n",
         "b" is replaced by "o", "c" is replaced by "p", "d" is replaced 
         by "q", and so on.
    -->
    <transition-function>
        <mapping>
            <from current-state="replace-symbol" current-symbol="a"/>
            <to next-state="replace-symbol" next-symbol="n" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="b"/>
            <to next-state="replace-symbol" next-symbol="o" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="c"/>
            <to next-state="replace-symbol" next-symbol="p" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="d"/>
            <to next-state="replace-symbol" next-symbol="q" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="e"/>
            <to next-state="replace-symbol" next-symbol="r" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="f"/>
            <to next-state="replace-symbol" next-symbol="s" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="g"/>
            <to next-state="replace-symbol" next-symbol="t" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="h"/>
            <to next-state="replace-symbol" next-symbol="u" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="i"/>
            <to next-state="replace-symbol" next-symbol="v" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="j"/>
            <to next-state="replace-symbol" next-symbol="w" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="k"/>
            <to next-state="replace-symbol" next-symbol="x" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="l"/>
            <to next-state="replace-symbol" next-symbol="y" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="m"/>
            <to next-state="replace-symbol" next-symbol="z" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="n"/>
            <to next-state="replace-symbol" next-symbol="a" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="o"/>
            <to next-state="replace-symbol" next-symbol="b" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="p"/>
            <to next-state="replace-symbol" next-symbol="c" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="q"/>
            <to next-state="replace-symbol" next-symbol="d" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="r"/>
            <to next-state="replace-symbol" next-symbol="e" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="s"/>
            <to next-state="replace-symbol" next-symbol="f" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="t"/>
            <to next-state="replace-symbol" next-symbol="g" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="u"/>
            <to next-state="replace-symbol" next-symbol="h" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="v"/>
            <to next-state="replace-symbol" next-symbol="i" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="w"/>
            <to next-state="replace-symbol" next-symbol="j" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="x"/>
            <to next-state="replace-symbol" next-symbol="k" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="y"/>
            <to next-state="replace-symbol" next-symbol="l" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="z"/>
            <to next-state="replace-symbol" next-symbol="m" movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol=" "/>
            <to next-state="replace-symbol" next-symbol=" " movement="right"/>
        </mapping>
        <mapping>
            <from current-state="replace-symbol" current-symbol="$"/>
            <to next-state="stop" next-symbol="$" movement="right"/>
        </mapping>
    </transition-function>
</turing-machine>