Problem 4; 2-Jun-2000

XML: Foundations, Techniques, Applications; Summer 2000

Harold Boley; DFKI, Univ. Kaiserslautern


The (first-order) function double -- defined as double(x) := x*2 or double(X) :& *(X,2). -- can be marked up in MathML and RFML as follows:
<declare type="fn">                  <ft>
  <ci> double </ci>                    <pattop>
  <lambda>                               <con> double </con>
    <bvar><ci> x </ci></bvar>            <var> x </var>
    <apply>                            </pattop>
      <times/>                         <callop>
      <ci> x </ci>                       <con> * </con>
      <cn> 2 </cn>                       <var> x </var>
    </apply>                             <con> 2 </con>
  </lambda>                            </callop>
</declare>                           </ft>
Another (first-order) function is marked up as 'foo' in MathML and RFML thus:
<declare type="fn">                  <ft>
  <ci> foo </ci>                       <pattop>
  <lambda>                               <con> foo </con>
    <bvar><ci> y </ci></bvar>            <var> y </var>
    <apply>                            </pattop>
      <times/>                         <callop>
      <ci> y </ci>                       <con> * </con>
      <ci> y </ci>                       <var> y </var>
    </apply>                             <var> y </var>
  </lambda>                            </callop>
</declare>                           </ft>

a) Give a one-line definition of the function corresponding to the foo markups.

b) Mark up the (first-order) function cube -- defined as cube(x) := x*x*x or cube(X) :& *(X,X,X). -- in MathML and RFML. Hint: The RFML markup may be produced automatically from the Prolog-like syntax via "style xml" of the Relfun system.