<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
  "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd"
  [<!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
   <!ENTITY CLin "<mo class='builtin' lspace='thickmathspace' rspace='thickmathspace'>&epsiv;</mo>">]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Clausal Language (ver. 5.81.16, by P.J. Voda, J. Komara, J. Kluka)</title
>
<script type="text/javascript"><![CDATA[
base = document.baseURI;
i = base.indexOf("#"); //remove fragment
if (i >= 0) base = String(base.substring(0,i));
i = base.indexOf("?"); //remove query
if (i >= 0) base = String(base.substring(0,i));
http = "http://"
if (base.indexOf(http) == 0) {
    i = base.indexOf("/",String(http).length);
} else
    i = base.lastIndexOf("/");
if (i >= 0) base = base.substring(0,i); else base = base.toString();
BLANK_URI = base+"/blank.xml";
UPDATE_URI = base+"/update";
SUBMITWIN_FEATURES = "dependent,alwaysLowered,"+
                     "width=50,height=50,"+
                     "z-lock,resizable=no,status=yes";
ID_ATTR = "id";
RESPONSE_FOOTER_ID = "_update_footer_";
RESPONSE_FOOTER_XOFF_ID = "_update_footer_xoff_";
RESPONSE_FOOTER_YOFF_ID = "_update_footer_yoff_";
RESPONSE_FOOTER_FOCUS_SEL = "_update_footer_focus_sel_";
RESPONSE_FOOTER_FOCUS_NAME = "_update_footer_focus_name_";
RESPONSE_ID = "_update_container_";
loading = 0;
selector = null;
function submitForm(aForm,submitter)
{
    /* I know, I know, unless ++x is atomic, a race condition exists,
     * but this is better than nothing */
    if (++loading > 1) {
      loading--;
      alert("You are requesting an action while your previous request "+
            "is still being processed.\n"+
            "Please wait until it is completed.");
      return false;
    }
    var submitframe = document.getElementById("_updater_");
    window.blur(submitter);
    window.focus(document.defaultView);
    selector = aForm.elements["selector"];
    submitframe.onload =
      function() { doSubmit(aForm,submitter,submitframe); };
    submitframe.src = BLANK_URI;
    return false; //prohibit form submission in the original window
}
function doSubmit(aForm,submitter,submitframe)
{
    submitframe.onload = function () {};
    submitframe.style.display = "block";
    if (submitframe.src == BLANK_URI) {
        var submitdoc = submitframe.contentDocument;
        var impForm = submitdoc.importNode(aForm,true);
        var submitbody = submitdoc.getElementsByTagName("body")[0];
        impForm.onsubmit = null;
        submitbody.appendChild(impForm);
        submitframe.onload =
            function () { getUpdate(submitframe); };
        submitImportedForm(impForm,aForm,submitter);
    } else {
        alert("An error occured while trying to submit a form.\n\n"+
            "Check whether the CL server is still running and try again.");
        loading--;
        submitframe.style.display = "none";
    }
    return;
}
function submitImportedForm(impForm,origForm,submitter)
{
    impForm.action = UPDATE_URI;
    var elems = impForm.elements;
    var origElems = origForm.elements;
    var elemslen = elems.length;
    var submitElem = null;
    var elem = null;
    var origElem = null;
    var atMostOneSubmit = false;
    var someSubmit = null;
    for (var i = 0; i < elemslen; i++) {
        elem = elems[i];
        origElem = origElems[i];
        elem.name = origElem.name;
        elem.value = origElem.value;
        if (elem.type == "checkbox" || elem.type == "radio")
            elem.checked = origElem.checked;
        if (elem.type == "select") {
            var opts = elem.options;
            var origOpts = origElem.options;
            var optslen = opts.length;
            for (var j = 0; j < optslen; j++)
                opts[j].selected = origOpts[j].selected;
        }
        if (origElem.isSameNode(submitter))
            submitElem = elem;
        if (elem.type == "submit") {
            if (someSubmit == null)
              someSubmit = elem;
            else
              atMostOneSubmit = false;
        }
    }
    if (elems["xoff"] && elems["yoff"]) {
        elems["xoff"].value = window.pageXOffset+1;
        elems["yoff"].value = window.pageYOffset+1;
    }
    if (submitElem != null && submitElem.type == "submit")
        submitElem.click();
    else if (atMostOneSubmit && someSubmit != null)
        someSubmit.click();
    else
        impForm.submit();
}
function getUpdate(submitframe)
{
    submitframe.onload = function () {};
    var respdoc = submitframe.contentDocument;
    var footer = respdoc.getElementById(RESPONSE_FOOTER_ID);
    if (footer) {
        var resp = respdoc.getElementById(RESPONSE_ID);
        if (resp == null)
            return;
        var elems = resp.childNodes;
        var elemslen = elems.length;
        var elem, oldelem, parent, reArr, id, inselem;
        var focusSel, focusName;
        while (elems.length > 0) {
            elem = elems[0];
            resp.removeChild(elem);
            if (elem.hasAttributes() && elem.hasAttribute(ID_ATTR)) {
                id = elem.getAttribute(ID_ATTR);
                if (elem.hasAttribute("class") &&
                    elem.getAttribute("class") == "element_deleted") {
                    elem = document.getElementById(id);
                    elem.parentNode.removeChild(elem);
                } else if (elem.hasAttribute("class") &&
                    elem.getAttribute("class") == "element_inserted") {
                    splitRe = /^(.*)\.(.*)$/;
                    reArr = splitRe.exec(id);
                    parent = document.getElementById(reArr[1]);
                    oldelem = document.getElementById(reArr[2]);
                    inselem = nextElementSibling(elem.firstChild);
                    inselem = document.importNode(inselem,true);
                    insertAfter(parent,oldelem,inselem);
                } else {
                    oldelem = document.getElementById(id);
                    if (oldelem != null) {
                        elem = document.importNode(elem,true);
                        oldelem.parentNode.replaceChild(elem,oldelem);
                    }
                }
            } else {
                footer.appendChild(elem);
            }
        }
        elem = respdoc.getElementById(RESPONSE_FOOTER_XOFF_ID);
        var xoff = elem ? parseInt(elem.value,10) : 0;
        elem = respdoc.getElementById(RESPONSE_FOOTER_YOFF_ID);
        var yoff = elem ? parseInt(elem.value,10) : 0;
        if (xoff && yoff) {
            xoff--; yoff--;
        } else {
            xoff = window.pageXOffset;
            yoff = window.pageYOffset;
        };
        window.scrollTo(xoff,yoff);
        loading--;
        elem = respdoc.getElementById(RESPONSE_FOOTER_FOCUS_SEL);
        focusSel = elem ? elem.value : null;
        elem = respdoc.getElementById(RESPONSE_FOOTER_FOCUS_NAME);
        focusName = elem ? elem.value : null;
        submitframe.style.display = "none";
        var fobj,fform = document.getElementById(focusSel);
        if (!fform || fform.tagName != "form")
            fform = document.getElementById(focusSel+"__");
        if (fform && fform.tagName == "form" && fform.elements) {
            var fidx = parseInt(focusName,10);
            if (isNaN(fidx)) {
                fobj = fform.elements[focusName];
                if (fobj && !fobj.type && fobj.length) fobj = fobj.item(0);
            } else
                fobj = fform.elements[fidx];
            if (!fobj) fobj = findFocElem(fform);
        }
        if (!fobj) fobj = document.defaultView;
        try {fobj.focus();} catch(ex) {}; /* success */
    } else {
        alert("An error occured while trying to receive an update of "+
              "your view from the CL server.\n\n"+
              "Check whether the server is still running. If it is, "+
              "copy the most recently edited data to the clipboard, "+
              "and press Ctrl-R to update your view.");
        loading--;
        submitframe.style.display = "none";
    }
    return;
}
function insertAfter(parent,child,newchild)
{
    if (child == null) {
        child = nextElementSibling(parent.firstChild);
        parent.insertBefore(newchild,child);
    } else {
        child = nextElementSibling(child.nextSibling);
        parent.insertBefore(newchild,child);
    }
}
function nextElementSibling(node)
{
    while (node != null && node.nodeType != Node.ELEMENT_NODE)
        node = node.nextSibling;
    return node;
}
function firstNNull(elems,op)
{
    var i,res,elemslen = elems.length;
    for (i = 0; i < elemslen; i++)
        if ((res = op(elems[i])) != null)
            return res;
    return null;
}
function findFocElem(elem)
{
    if (elem.tagName == "form")
        return firstNNull(elem.elements,
                          function(e){return e.type == "hidden"?null:e;});
    return firstNNull(elem.childNodes,
                      function(e){return findFocElem(e);});
}
function taKey(ta,event)
{
    if (event.keyCode == 13 && (event.ctrlKey | event.shiftKey)) {
        var els = ta.form.elements;
        for (var i = 0, len = els.length; i < len; i++)
            if (els[i].type == "submit")
                return submitForm(ta.form,els[i]);
        return submitForm(ta.form,ta.form);
    }
}
function taKeyUp(ta,event)
{
    if (event.keyCode == event.DOM_VK_LEFT ||
        event.keyCode == event.DOM_VK_RIGHT ||
        event.keyCode == event.DOM_VK_UP ||
        event.keyCode == event.DOM_VK_DOWN)
        return;
    var c = countNls(ta.value)+1;
    if (c > 20) c = 20;
    if (ta.rows < c) ta.rows = c;
    if (ta.rows > c+1) ta.rows = c+1;
}
function countNls(str)
{
    var i,c,l; l = str.length;
    for(i = c = 0; i < l; ++i)
        if (str[i] == "\n") ++c;
    return c;
}
//]]></script>
<link rel="stylesheet" type="text/css" href="default.css" title="Default"/>
<link rel="alternate stylesheet" type="text/css" href="embers.css" title="Embers"
/>
</head>
<body><iframe id="_updater_" name="_edit_updater_" scrolling="no"/>
<div id="_main_editor_">
<form action="#" method="POST" class="quit_box"><input type="hidden" name="action"
 value="quit"/><input type="hidden" name="selector" value="id------"/><button
 type="submit" name="name" value="File" accesskey="f" class="quit" onclick="return submitForm(this.form,this);"
><span class="acskey">F</span>ile</button><button type="submit" name="name" value="Save"
 accesskey="s" class="quit" onclick="return submitForm(this.form,this);"><span
 class="acskey">S</span>ave</button><button type="submit" name="name" value="Setup"
 accesskey="u" class="quit" onclick="return submitForm(this.form,this);">Set<span
 class="acskey">u</span>p</button><button type="submit" name="name" value="Recompile"
 accesskey="r" class="quit" onclick="return submitForm(this.form,this);"><span
 class="acskey">R</span>ecompile</button><button type="submit" name="name" value="Reexec. Query"
 accesskey="q" class="quit" onclick="return submitForm(this.form,this);">Reexec. 
<span class="acskey">Q</span>uery</button><button type="submit" name="name" value="Save &amp; Exit"
 accesskey="x" class="quit" onclick="return submitForm(this.form,this);">Save &amp; E<span
 class="acskey">x</span>it</button><input type="hidden" name="xoff" value="0"
/><input type="hidden" name="yoff" value="0"/>
</form>
<div class="framed1">
<div class="framename">Clausal Language (ver. 5.81.16, by P.J. Voda, J. Komara, J. Kluka)
</div>
<div id="idD-----">
<div id="idE-----">
<div id="idF-----"/>
</div>
<div id="idG-----">
<div id="idH-----"/>
</div>
<div id="idI-----">
<div id="idJ-----"/>
</div>
</div>
<table id="idL-----" class="fill">
<tr>
<td class="fill"><span class="header">Module
<math xmlns="&mathml;">
<msub class="comp_id_hdr"><mi class="comp_id_hdr">Ex</mi><mn class="id_sub">10</mn
>
</msub>
</math>
</span>
</td>
<td class="editbuttontd">
<form action="#idL-----" method="POST" id="idL-----__" onsubmit="return submitForm(this,this);"
><a name="idL-----"/><input type="hidden" name="selector" value="idL-----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
<div id="idM-----">
<div id="idN-----"><a name="idP-----"/>
<form action="#idP-----" method="POST" id="idP-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idP-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<div id="idQ-----" class="fill"><a name="idQ-----"/><span class="header">Included module
<math xmlns="&mathml;">
<mi class="comp_id_hdr">Standard</mi>
</math>
</span>
</div>
</div>
<div id="idR-----"><a name="idT-----"/>
<form action="#idT-----" method="POST" id="idT-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idT-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idU-----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>10. CVIČENIE Z PREDMETU ÚVOD DO DEKLARATÍVNEHO PROGRAMOVANIA </b>
</p>
<p>http://ii.fmph.uniba.sk/cl/courses/udp/ex/ex10.cl 
</p>
</td>
<td class="editbuttontd">
<form action="#idU-----" method="POST" id="idU-----__" onsubmit="return submitForm(this,this);"
><a name="idU-----"/><input type="hidden" name="selector" value="idU-----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idV-----"><a name="idX-----"/>
<form action="#idX-----" method="POST" id="idX-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idX-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idY-----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><i>Dátum: </i>streda 25. 4. 2006 
</p>
<p><i>Odporúčaná verzia CL: </i>5.81.16 
</p>
<p><i>WWW stránka predmetu: </i>http://ii.fmph.uniba.sk/cl/courses/udp?lang=sk
 
</p>
<p><i>Kontakt na cvičiaceho: </i>mailto:kluka@fmph.uniba.sk 
</p>
</td>
<td class="editbuttontd">
<form action="#idY-----" method="POST" id="idY-----__" onsubmit="return submitForm(this,this);"
><a name="idY-----"/><input type="hidden" name="selector" value="idY-----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idZ-----"><a name="idb-----"/>
<form action="#idb-----" method="POST" id="idb-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idb-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idc-----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p>Preskočte nasledujúce komponenty až po nadpis &quot;CVIČENIA&quot;. 
</p>
</td>
<td class="editbuttontd">
<form action="#idc-----" method="POST" id="idc-----__" onsubmit="return submitForm(this,this);"
><a name="idc-----"/><input type="hidden" name="selector" value="idc-----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idd-----"><a name="idf-----"/>
<form action="#idf-----" method="POST" id="idf-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idf-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<div id="idg-----" class="fill"><a name="idg-----"/><span class="header">Application display&nbsp;<em
>Ldots</em>&nbsp;/&nbsp;0: 
<math xmlns="&mathml;">
<mo>&hellip;</mo>
</math>
</span>
</div>
</div>
<div id="idh-----"><a name="idj-----"/>
<form action="#idj-----" method="POST" id="idj-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idj-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<div id="idk-----" class="fill"><a name="idk-----"/><span class="header">Application display&nbsp;<em
>Var_sub</em>&nbsp;/&nbsp;2: 
<math xmlns="&mathml;">
<msub>
<msub class="ad_constr_arg"><mi>#</mi><mn>1</mn>
</msub>
<msub class="ad_constr_arg"><mi>#</mi><mn>2</mn>
</msub>
</msub>
</math>
</span>
</div>
</div>
<div id="idl-----"><a name="idn-----"/>
<form action="#idn-----" method="POST" id="idn-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idn-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<div id="ido-----" class="fill"><a name="ido-----"/><span class="header">Application display&nbsp;<em
>Perm</em>&nbsp;/&nbsp;2: 
<math xmlns="&mathml;">
<msub class="ad_constr_arg"><mi>#</mi><mn>1</mn>
</msub><mo>&sim;</mo>
<msub class="ad_constr_arg"><mi>#</mi><mn>2</mn>
</msub>
</math>
</span>
</div>
</div>
<div id="idp-----"><a name="idr-----"/>
<form action="#idr-----" method="POST" id="idr-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idr-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<div id="ids-----" class="fill"><a name="ids-----"/><span class="header">Application display&nbsp;<em
>Sub</em>&nbsp;/&nbsp;2: 
<math xmlns="&mathml;">
<msub>
<mrow><mo>(</mo>
<msub class="ad_constr_arg"><mi>#</mi><mn>1</mn>
</msub><mo>)</mo>
</mrow>
<msub class="ad_constr_arg"><mi>#</mi><mn>2</mn>
</msub>
</msub>
</math>
</span>
</div>
</div>
<div id="idt-----"><a name="idv-----"/>
<form action="#idv-----" method="POST" id="idv-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idv-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<div id="idw-----" class="fill"><a name="idw-----"/><span class="header">Application display&nbsp;<em
>Cdots</em>&nbsp;/&nbsp;0: 
<math xmlns="&mathml;">
<mo>&ctdot;</mo>
</math>
</span>
</div>
</div>
<div id="idx-----"><a name="idz-----"/>
<form action="#idz-----" method="POST" id="idz-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idz-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<div id="id0-----" class="fill"><a name="id0-----"/><span class="header">Application display&nbsp;<em
>Map_f</em>&nbsp;/&nbsp;2: 
<math xmlns="&mathml;">
<msub><mi mathvariant="italic">Map</mi><mi mathvariant="italic">F</mi>
</msub>
<mrow><mo>(</mo>
<msub class="ad_constr_arg"><mi>#</mi><mn>1</mn>
</msub><mo>,</mo>
<msub class="ad_constr_arg"><mi>#</mi><mn>2</mn>
</msub><mo>)</mo>
</mrow>
</math>
</span>
</div>
</div>
<div id="id1-----"><a name="id3-----"/>
<form action="#id3-----" method="POST" id="id3-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="id3-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="id4-----" class="fill">
<tr>
<td class="fill"><span class="header">Function&nbsp;<acronym title="This function is a constructor"
 class="fun_constr">
<math xmlns="&mathml;">
<mi class="inh_col_id">Fill_in</mi>
</math>
</acronym>&nbsp;/&nbsp;0 displayed by&nbsp;<em>Cdots</em> as&nbsp;
<math xmlns="&mathml;">
<mo>&ctdot;</mo>
</math>
</span><br/>
<math xmlns="&mathml;" mode="display" class="clause">
<mo>&ctdot;</mo><mo>=</mo><mn class="builtin">20060425</mn>
</math>
</td>
<td class="editbuttontd">
<form action="#id4-----" method="POST" id="id4-----__" onsubmit="return submitForm(this,this);"
><a name="id4-----"/><input type="hidden" name="selector" value="id4-----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="id5-----"><a name="id7-----"/>
<form action="#id7-----" method="POST" id="id7-----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="id7-----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="id8-----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>C V I Č E N I A </b>
</p>
</td>
<td class="editbuttontd">
<form action="#id8-----" method="POST" id="id8-----__" onsubmit="return submitForm(this,this);"
><a name="id8-----"/><input type="hidden" name="selector" value="id8-----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="id9-----"><a name="id-A----"/>
<form action="#id-A----" method="POST" id="id-A----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="id-A----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idAA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Combinatorial Functions over Lists </b>
</p>
</td>
<td class="editbuttontd">
<form action="#idAA----" method="POST" id="idAA----__" onsubmit="return submitForm(this,this);"
><a name="idAA----"/><input type="hidden" name="selector" value="idAA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idBA----"><a name="idDA----"/>
<form action="#idDA----" method="POST" id="idDA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idDA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idEA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><i>Functionals </i>are higher-order functions, i.e., functions whose arguments
 or results are functions. In some declarative programming languages (known 
as functional languages), functionals are the main tool of modularization. For
 example, one can define a functional for sorting lists 
<math xmlns="&mathml;">
<mi class="ident">Sort</mi>
<mrow><mo>(</mo><mi fontstyle="italic">cmp</mi><mo>,</mo><mi>x</mi><mo>)</mo
>
</mrow>
</math>
where the <i>first argument is a function </i>used to compare the elements of
 the list 
<math xmlns="&mathml;">
<mi>x</mi>
</math>
. This kind of functionals can also be defined in some imperative languages,
 for example Pascal or C. 
</p>
<p class="indented">In CL, we can only define first-order functions (all arguments
 are numbers). However, we can use the components <i>theory </i>and <i>interpretation
 of a theory </i>to achieve similar modularization as with functionals. Theories
 and interpretations resemble <i>classes with virtual methods </i>or <i>interfaces
 </i>from object-oriented programming. 
</p>
</td>
<td class="editbuttontd">
<form action="#idEA----" method="POST" id="idEA----__" onsubmit="return submitForm(this,this);"
><a name="idEA----"/><input type="hidden" name="selector" value="idEA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idFA----"><a name="idHA----"/>
<form action="#idHA----" method="POST" id="idHA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idHA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idIA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Assignment 1. </b>Define a <i>mapping </i>functional 
<math xmlns="&mathml;">
<msub><mi mathvariant="italic">Map</mi><mi mathvariant="italic">F</mi>
</msub>
<mrow><mo>(</mo><mi>p</mi><mo>,</mo><mi>x</mi><mo>)</mo>
</mrow>
</math>
that applies any binary function 
<math xmlns="&mathml;">
<mi class="ident">F</mi>
<mrow><mo>(</mo><mi>p</mi><mo>,</mo><mi>a</mi><mo>)</mo>
</mrow>
</math>
on each element 
<math xmlns="&mathml;">
<mi>a</mi>
</math>
of the list 
<math xmlns="&mathml;">
<mi>x</mi>
</math>
. The argument 
<math xmlns="&mathml;">
<mi>p</mi>
</math>
is a parameter of the function 
<math xmlns="&mathml;">
<mi class="ident">F</mi>
</math>
. Formally, this is specified as 
</p>
<math xmlns="&mathml;" mode="display">
<mi>b</mi>&CLin;
<msub><mi mathvariant="italic">Map</mi><mi mathvariant="italic">F</mi>
</msub>
<mrow><mo>(</mo><mi>p</mi><mo>,</mo><mi>x</mi><mo>)</mo>
</mrow><mo>&harr;</mo>
<mrow><mo>&exist;</mo>
<mstyle class="bvar"><mi>a</mi>
</mstyle>
<mrow><mo>(</mo>
<mstyle class="bvar"><mi>a</mi>
</mstyle>&CLin;<mi>x</mi><mo>&and;</mo><mi>b</mi><mo>=</mo><mi class="ident"
>F</mi>
<mrow><mo class="cp2">(</mo><mi>p</mi><mo>,</mo>
<mstyle class="bvar"><mi>a</mi>
</mstyle><mo class="cp2">)</mo>
</mrow><mo>)</mo>
</mrow>
</mrow>
</math>
<p>or semiformally as 
</p>
<math xmlns="&mathml;" mode="display">
<msub><mi mathvariant="italic">Map</mi><mi mathvariant="italic">F</mi>
</msub>
<mrow><mo>(</mo><mi>p</mi><mo>,</mo>
<msub><mi>a</mi><mn>1</mn>
</msub><mo class="builtin">,</mo>
<mrow><mo>&hellip;</mo><mo class="builtin">,</mo>
<msub><mi>a</mi><mi>n</mi>
</msub><mo class="builtin">,</mo><mn class="builtin">0</mn>
</mrow><mo>)</mo>
</mrow><mo>=</mo><mi class="ident">F</mi>
<mrow><mo>(</mo><mi>p</mi><mo>,</mo>
<msub><mi>a</mi><mn>1</mn>
</msub><mo>)</mo>
</mrow><mo class="builtin">,</mo>
<mrow><mo>&hellip;</mo><mo class="builtin">,</mo><mi class="ident">F</mi>
<mrow><mo>(</mo><mi>p</mi><mo>,</mo>
<msub><mi>a</mi><mi>n</mi>
</msub><mo>)</mo>
</mrow><mo class="builtin">,</mo><mn class="builtin">0</mn>
</mrow>
</math>
<p>To define the functional, insert below a new <i>theory </i>component and 
name it 
<math xmlns="&mathml;">
<mi class="ident">Mapping</mi>
</math>
. Into the theory, insert a new binary function 
<math xmlns="&mathml;">
<mi class="ident">F</mi>
</math>
with an <i>empty definition </i>(such functions are called <i>free </i>). Below
 
<math xmlns="&mathml;">
<mi class="ident">F</mi>
</math>
insert a new binary function 
<math xmlns="&mathml;">
<mi class="ident">Map</mi>
</math>
and define it to satisfy the above specification. 
</p>
</td>
<td class="editbuttontd">
<form action="#idIA----" method="POST" id="idIA----__" onsubmit="return submitForm(this,this);"
><a name="idIA----"/><input type="hidden" name="selector" value="idIA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idJA----"><a name="idLA----"/>
<form action="#idLA----" method="POST" id="idLA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idLA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idMA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Remark. </b>In CL, a <i>string </i>are lists of characters (see the definition
 of the formats 
<math xmlns="&mathml;">
<mi class="ident">Ch</mi>
</math>
and 
<math xmlns="&mathml;">
<mi class="ident">Str</mi>
</math>
in the module 
<math xmlns="&mathml;">
<mi class="ident">Standard</mi>
</math>
). Characters are enclosed in double quotes ( 
<math xmlns="&mathml;">
<ms lquote="&quot;" rquote="&quot;" class="builtin">a</ms>
</math>
), strings in single quotes ( 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">abc efg 123</ms>
</math>
). You can use the formats 
<math xmlns="&mathml;">
<mi class="ident">Ch</mi>
</math>
to display a number as a character, and the format 
<math xmlns="&mathml;">
<mi class="ident">Str</mi>
</math>
to display a list of numbers as a string, e.g.: 
</p><pre>    90 = c:Ch &amp; 72,101,108,108,111,33,0 = y:Str</pre>
<p>In the exercises below we use the following convention for the names of variables:
 
</p>
<ul>
<li>
<p>
<math xmlns="&mathml;">
<mi>a</mi>
</math>
, 
<math xmlns="&mathml;">
<mi>b</mi>
</math>
-- elements (numbers, characters); 
</p>
</li>
<li>
<p>
<math xmlns="&mathml;">
<mi>x</mi>
</math>
, 
<math xmlns="&mathml;">
<mi>y</mi>
</math>
, 
<math xmlns="&mathml;">
<mi>z</mi>
</math>
-- lists of elements, strings; 
</p>
</li>
<li>
<p>
<math xmlns="&mathml;">
<mi>s</mi>
</math>
, 
<math xmlns="&mathml;">
<mi>t</mi>
</math>
-- lists of <i>lists </i>, lists of strings. 
</p>
</li>
</ul>
</td>
<td class="editbuttontd">
<form action="#idMA----" method="POST" id="idMA----__" onsubmit="return submitForm(this,this);"
><a name="idMA----"/><input type="hidden" name="selector" value="idMA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idNA----"><a name="idPA----"/>
<form action="#idPA----" method="POST" id="idPA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idPA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idQA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Assignment 2. </b>Use the functional 
<math xmlns="&mathml;">
<mi class="ident">Map</mi>
</math>
to define a function 
<math xmlns="&mathml;">
<mi class="ident">Map_pair</mi>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>t</mi><mo>)</mo>
</mrow>
</math>
satisfying: 
</p>
<math xmlns="&mathml;" mode="display">
<mi>x</mi>&CLin;<mi class="ident">Map_pair</mi>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>t</mi><mo>)</mo>
</mrow><mo>&harr;</mo>
<mrow><mo>&exist;</mo>
<mstyle class="bvar"><mi>y</mi>
</mstyle>
<mrow><mo>(</mo>
<mstyle class="bvar"><mi>y</mi>
</mstyle>&CLin;<mi>t</mi><mo>&and;</mo><mi>x</mi><mo>=</mo><mi>a</mi><mo class="builtin"
>,</mo>
<mstyle class="bvar"><mi>y</mi>
</mstyle><mo>)</mo>
</mrow>
</mrow>
</math>
<p>semiformally 
</p>
<math xmlns="&mathml;" mode="display">
<mi class="ident">Map_pair</mi>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo>
<msub><mi>x</mi><mn>1</mn>
</msub><mo class="builtin">,</mo>
<mrow><mo>&hellip;</mo><mo class="builtin">,</mo>
<msub><mi>x</mi><mi>n</mi>
</msub><mo class="builtin">,</mo><mn class="builtin">0</mn>
</mrow><mo>)</mo>
</mrow><mo>=</mo><mi class="ident">F</mi>
<mrow><mo>(</mo><mi>p</mi><mo class="builtin">,</mo>
<msub><mi>x</mi><mn>1</mn>
</msub><mo>)</mo>
</mrow><mo class="builtin">,</mo>
<mrow><mo>&hellip;</mo><mo class="builtin">,</mo><mi class="ident">F</mi>
<mrow><mo>(</mo><mi>p</mi><mo class="builtin">,</mo>
<msub><mi>x</mi><mi>n</mi>
</msub><mo>)</mo>
</mrow><mo class="builtin">,</mo><mn class="builtin">0</mn>
</mrow>
</math>
<p>To use the functional, insert below a new <i>intepretation </i>of the theory
 
<math xmlns="&mathml;">
<mi class="ident">Mapping</mi>
</math>
, <b>uncheck </b>the Local checkbox, and use <i>_pair </i>as the component identifier
 suffix. After clicking OK, CL inserts a copy of the theory 
<math xmlns="&mathml;">
<mi class="ident">Mapping</mi>
</math>
with the function 
<math xmlns="&mathml;">
<mi class="ident">F</mi>
</math>
renamed to 
<math xmlns="&mathml;">
<mi class="ident">F_pair</mi>
</math>
and the function 
<math xmlns="&mathml;">
<mi class="ident">Map</mi>
</math>
renamed to 
<math xmlns="&mathml;">
<mi class="ident">Map_pair</mi>
</math>
. Your task is then to define the function 
<math xmlns="&mathml;">
<mi class="ident">F_pair</mi>
</math>
in such a way that 
<math xmlns="&mathml;">
<mi class="ident">Map_pair</mi>
</math>
behaves as specified. 
</p>
</td>
<td class="editbuttontd">
<form action="#idQA----" method="POST" id="idQA----__" onsubmit="return submitForm(this,this);"
><a name="idQA----"/><input type="hidden" name="selector" value="idQA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idRA----"><a name="idTA----"/>
<form action="#idTA----" method="POST" id="idTA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idTA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idUA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Remark. </b>In combinatorial exercises (including exercise 2), we often
 define functions taking or yielding <i>lists of lists </i>; It is therefore
 of advantage to display such objects by the format 
<math xmlns="&mathml;">
<mi class="ident">Ls</mi>
</math>
showing a result as a <i>list of strings </i>, since strings are lists of characters.
 
</p>
</td>
<td class="editbuttontd">
<form action="#idUA----" method="POST" id="idUA----__" onsubmit="return submitForm(this,this);"
><a name="idUA----"/><input type="hidden" name="selector" value="idUA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idVA----"><a name="idXA----"/>
<form action="#idXA----" method="POST" id="idXA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idXA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idYA----" class="fill">
<tr>
<td class="fill"><span class="header">Predicate&nbsp;<acronym title="This predicate is a format"
 class="pred_format">
<math xmlns="&mathml;">
<mi class="inh_col_id">Ls</mi>
</math>
</acronym></span><br/>
<math xmlns="&mathml;" mode="display" class="clause">
<mi class="ident">Ls</mi>
<mrow><mo>(</mo><mn class="builtin">0</mn><mo>)</mo>
</mrow>
</math>
<math xmlns="&mathml;" mode="display" class="clause">
<mi class="ident">Ls</mi>
<mrow><mo>(</mo>
<mstyle class="bvar"><mi>x</mi>
</mstyle><mo class="builtin">,</mo>
<mstyle class="bvar"><mi>t</mi>
</mstyle><mo>)</mo>
</mrow><mo>&larr;</mo>
<mrow><mi class="ident">Str</mi>
<mrow><mo>(</mo><mi>x</mi><mo>)</mo>
</mrow>
</mrow><mo>&and;</mo>
<mrow><mi class="ident">Ls</mi>
<mrow><mo>(</mo><mi>t</mi><mo>)</mo>
</mrow>
</mrow>
</math>
</td>
<td class="editbuttontd">
<form action="#idYA----" method="POST" id="idYA----__" onsubmit="return submitForm(this,this);"
><a name="idYA----"/><input type="hidden" name="selector" value="idYA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idZA----"><a name="idbA----"/>
<form action="#idbA----" method="POST" id="idbA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idbA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idcA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p>Try out the queries: 
</p><pre>    (97,98,99,0),(100,101,0),0 = t:Ls</pre>
<p>and 
</p><pre>    Map_pair(&quot;!&quot;,&apos;abcde&apos;,&apos;123&apos;,&apos;?&apos;,0) = t:Ls</pre>
<p>(&quot;c&quot;haracters; &apos;strings&apos;) 
</p>
</td>
<td class="editbuttontd">
<form action="#idcA----" method="POST" id="idcA----__" onsubmit="return submitForm(this,this);"
><a name="idcA----"/><input type="hidden" name="selector" value="idcA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="iddA----"><a name="idfA----"/>
<form action="#idfA----" method="POST" id="idfA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idfA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idgA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Assignment 3. </b>Define a function 
<math xmlns="&mathml;">
<mi class="ident">Interleave</mi>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>x</mi><mo>)</mo>
</mrow>
</math>
satisfying: 
</p>
<math xmlns="&mathml;" mode="display">
<mi>y</mi>&CLin;<mi class="ident">Interleave</mi>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>x</mi><mo>)</mo>
</mrow><mo>&harr;</mo>
<mrow><mo>&exist;</mo>
<mstyle class="bvar">
<msub><mi>x</mi><mn>1</mn>
</msub>
</mstyle>
<mrow><mo>&exist;</mo>
<mstyle class="bvar">
<msub><mi>x</mi><mn>2</mn>
</msub>
</mstyle>
<mrow><mo>(</mo><mi>x</mi><mo>=</mo>
<mstyle class="bvar">
<msub><mi>x</mi><mn>1</mn>
</msub>
</mstyle><mo class="builtin">&oplus;</mo>
<mstyle class="bvar">
<msub><mi>x</mi><mn>2</mn>
</msub>
</mstyle><mo>&and;</mo><mi>y</mi><mo>=</mo>
<mstyle class="bvar">
<msub><mi>x</mi><mn>1</mn>
</msub>
</mstyle><mo class="builtin">&oplus;</mo>
<mrow><mo class="cp2">(</mo><mi>a</mi><mo class="builtin">,</mo>
<mstyle class="bvar">
<msub><mi>x</mi><mn>2</mn>
</msub>
</mstyle><mo class="cp2">)</mo>
</mrow><mo>)</mo>
</mrow>
</mrow>
</mrow>
</math>
<p>Use the function 
<math xmlns="&mathml;">
<mi class="ident">Map_pair</mi>
</math>
from the preceding exercise. A possible test query is 
</p><pre>    Interleave(&quot;$&quot;,&apos;abcde&apos;) = t:Ls</pre>
<p>which should produce 
<math xmlns="&mathml;">
<mi>t</mi><mo>=</mo><ms lquote="&apos;" rquote="&apos;" class="builtin">$abcde</ms
><mo class="builtin">,</mo><ms lquote="&apos;" rquote="&apos;" class="builtin"
>a$bcde</ms><mo class="builtin">,</mo><ms lquote="&apos;" rquote="&apos;" class="builtin"
>ab$cde</ms><mo class="builtin">,</mo><ms lquote="&apos;" rquote="&apos;" class="builtin"
>abc$de</ms><mo class="builtin">,</mo><ms lquote="&apos;" rquote="&apos;" class="builtin"
>abcd$e</ms><mo class="builtin">,</mo><ms lquote="&apos;" rquote="&apos;" class="builtin"
>abcde$</ms><mo class="builtin">,</mo><mn class="builtin">0</mn>
</math>
. 
</p>
</td>
<td class="editbuttontd">
<form action="#idgA----" method="POST" id="idgA----__" onsubmit="return submitForm(this,this);"
><a name="idgA----"/><input type="hidden" name="selector" value="idgA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idhA----"><a name="idjA----"/>
<form action="#idjA----" method="POST" id="idjA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idjA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idkA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Assignment 4. </b>Let 
<math xmlns="&mathml;">
<mi class="ident">Subsequence</mi>
<mrow><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>)</mo>
</mrow>
</math>
be a predicate satisfying 
</p>
<math xmlns="&mathml;" mode="display">
<mi class="ident">Subsequence</mi>
<mrow><mo>(</mo><mi>x</mi><mo>,</mo><mn class="builtin">0</mn><mo>)</mo>
</mrow><mo>&harr;</mo><mi>x</mi><mo>=</mo><mn class="builtin">0</mn>
</math>
<math xmlns="&mathml;" mode="display">
<mi class="ident">Subsequence</mi>
<mrow><mo>(</mo><mi>x</mi><mo>,</mo><mi>a</mi><mo class="builtin">,</mo><mi>y</mi
><mo>)</mo>
</mrow><mo>&harr;</mo>
<mrow><mo>&exist;</mo>
<mstyle class="bvar"><mi>z</mi>
</mstyle>
<mrow><mo>(</mo><mi class="ident">Subsequence</mi>
<mrow><mo class="cp2">(</mo>
<mstyle class="bvar"><mi>z</mi>
</mstyle><mo>,</mo><mi>y</mi><mo class="cp2">)</mo>
</mrow><mo>&and;</mo><mi>x</mi><mo>=</mo><mi>a</mi><mo class="builtin">,</mo
>
<mstyle class="bvar"><mi>z</mi>
</mstyle><mo>)</mo>
</mrow>
</mrow><mo>&or;</mo><mi class="ident">Subsequence</mi>
<mrow><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>)</mo>
</mrow>
</math>
<p>Give a clausal definition of the predicate 
<math xmlns="&mathml;">
<mi class="ident">Subsequence</mi>
<mrow><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>)</mo>
</mrow>
</math>
. 
</p>
</td>
<td class="editbuttontd">
<form action="#idkA----" method="POST" id="idkA----__" onsubmit="return submitForm(this,this);"
><a name="idkA----"/><input type="hidden" name="selector" value="idkA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idlA----"><a name="idnA----"/>
<form action="#idnA----" method="POST" id="idnA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idnA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idoA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Assignment 5. </b>Define a function 
<math xmlns="&mathml;">
<mi class="ident">Subseqlist</mi>
<mrow><mo>(</mo><mi>y</mi><mo>)</mo>
</mrow>
</math>
satisfying: 
</p>
<math xmlns="&mathml;" mode="display">
<mi>x</mi>&CLin;<mi class="ident">Subseqlist</mi>
<mrow><mo>(</mo><mi>y</mi><mo>)</mo>
</mrow><mo>&harr;</mo><mi class="ident">Subsequence</mi>
<mrow><mo>(</mo><mi>x</mi><mo>,</mo><mi>y</mi><mo>)</mo>
</mrow>
</math>
<p>Use the function 
<math xmlns="&mathml;">
<mi class="ident">Map_pair</mi>
</math>
from Assignment 1. Try out the format 
<math xmlns="&mathml;">
<mi class="ident">Ls</mi>
</math>
for the query 
</p><pre>    Subseqlist(&apos;Jago&apos;) = t:Ls</pre>
<p>which should yield a list 
<math xmlns="&mathml;">
<mi>t</mi>
</math>
containing in any order the strings 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">Jago</ms>
</math>
; 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">ago</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">Jgo</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">Jao</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">Jag</ms>
</math>
; 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">go</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">Jo</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">Ja</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">Jg</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">ag</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">ao</ms>
</math>
; 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">J</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">a</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">g</ms>
</math>
, 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin">o</ms>
</math>
; 
<math xmlns="&mathml;">
<ms lquote="&apos;" rquote="&apos;" class="builtin"></ms>
</math>
. 
</p>
</td>
<td class="editbuttontd">
<form action="#idoA----" method="POST" id="idoA----__" onsubmit="return submitForm(this,this);"
><a name="idoA----"/><input type="hidden" name="selector" value="idoA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idpA----"><a name="idrA----"/>
<form action="#idrA----" method="POST" id="idrA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idrA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idsA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Assignment 6. </b>Let 
<math xmlns="&mathml;">
<mi class="ident">Union</mi>
<mrow><mo>(</mo><mi>x</mi><mo>)</mo>
</mrow>
</math>
be the function satisfying 
</p>
<math xmlns="&mathml;" mode="display">
<mi class="ident">Union</mi>
<mrow><mo>(</mo><mn class="builtin">0</mn><mo>)</mo>
</mrow><mo>=</mo><mn class="builtin">0</mn>
</math>
<math xmlns="&mathml;" mode="display">
<mi class="ident">Union</mi>
<mrow><mo>(</mo>
<msub><mi>x</mi><mn>1</mn>
</msub><mo class="builtin">,</mo>
<mrow><mo>&hellip;</mo><mo class="builtin">,</mo>
<msub><mi>x</mi><mi>n</mi>
</msub><mo class="builtin">,</mo><mn class="builtin">0</mn>
</mrow><mo>)</mo>
</mrow><mo>=</mo>
<mrow>
<msub><mi>x</mi><mn>1</mn>
</msub><mo class="builtin">&oplus;</mo><mo>&ctdot;</mo>
</mrow><mo class="builtin">&oplus;</mo>
<msub><mi>x</mi><mi>n</mi>
</msub>
</math>
<p>Give a clausal definition of this function. 
</p>
</td>
<td class="editbuttontd">
<form action="#idsA----" method="POST" id="idsA----__" onsubmit="return submitForm(this,this);"
><a name="idsA----"/><input type="hidden" name="selector" value="idsA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idtA----"><a name="idvA----"/>
<form action="#idvA----" method="POST" id="idvA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idvA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="idwA----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Assignment 7. </b>Use the functional 
<math xmlns="&mathml;">
<mi class="ident">Map</mi>
</math>
to define a function 
<math xmlns="&mathml;">
<mi class="ident">Map_interleave</mi>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>t</mi><mo>)</mo>
</mrow>
</math>
satisfying: 
</p>
<math xmlns="&mathml;" mode="display">
<mi>s</mi>&CLin;<mi class="ident">Map_interleave</mi>
<mrow><mo>(</mo><mi>a</mi><mo>,</mo><mi>t</mi><mo>)</mo>
</mrow><mo>&harr;</mo>
<mrow><mo>&exist;</mo>
<mstyle class="bvar"><mi>x</mi>
</mstyle>
<mrow><mo>(</mo>
<mstyle class="bvar"><mi>x</mi>
</mstyle>&CLin;<mi>t</mi><mo>&and;</mo><mi>s</mi><mo>=</mo><mi class="ident"
>Interleave</mi>
<mrow><mo class="cp2">(</mo><mi>a</mi><mo>,</mo>
<mstyle class="bvar"><mi>x</mi>
</mstyle><mo class="cp2">)</mo>
</mrow><mo>)</mo>
</mrow>
</mrow>
</math>
</td>
<td class="editbuttontd">
<form action="#idwA----" method="POST" id="idwA----__" onsubmit="return submitForm(this,this);"
><a name="idwA----"/><input type="hidden" name="selector" value="idwA----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="idxA----"><a name="idzA----"/>
<form action="#idzA----" method="POST" id="idzA----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="idzA----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Ins/Del" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
<td><input type="submit" name="char" value="Expand" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
<table id="id0A----" class="fill">
<tr>
<td class="fill">
<div class="header">Remark
<math xmlns="&mathml;">
<mi class="comp_id_hdr"></mi>
</math>
</div>
<p><b>Assignment 8. </b>Define a function 
<math xmlns="&mathml;">
<mi class="ident">Perms</mi>
<mrow><mo>(</mo><mi>x</mi><mo>)</mo>
</mrow>
</math>
yielding the list of all permutations of the list 
<math xmlns="&mathml;">
<mi>x</mi>
</math>
. The function satisfies: 
</p>
<math xmlns="&mathml;" mode="display">
<mi>y</mi>&CLin;<mi class="ident">Perms</mi>
<mrow><mo>(</mo><mi>x</mi><mo>)</mo>
</mrow><mo>&harr;</mo><mi>x</mi><mo>&sim;</mo><mi>y</mi>
</math>
<p>See the lecture ( <i>http://ii.fmph.uniba.sk/cl/oldcourses/lpi1/lect/sli10.pdf
 </i>) for the definition of the permutation predicate 
<math xmlns="&mathml;">
<mi>x</mi><mo>&sim;</mo><mi>y</mi>
</math>
. 
</p>
<p class="indented">Use the functions 
<math xmlns="&mathml;">
<mi class="ident">Map_interleave</mi>
</math>
and 
<math xmlns="&mathml;">
<mi class="ident">Union</mi>
</math>
from the two preceding exercises. 
</p>
</td>
<td class="editbuttontd">
<form action="#id0A----" method="POST" id="id0A----__" onsubmit="return submitForm(this,this);"
><a name="id0A----"/><input type="hidden" name="selector" value="id0A----"/><input
 type="submit" name="action" value="Edit" class="editbutton" onclick="return submitForm(this.form,this);"
/><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
</td>
</tr>
</table>
</div>
<div id="id1A----"><a name="id2A----"/>
<form action="#id2A----" method="POST" id="id2A----" onsubmit="return submitForm(this,this);"
><input type="hidden" name="action" value="button"/><input type="hidden" name="selector"
 value="id2A----"/>
<table class="fill">
<tr>
<td><pre><span class="fg3"></span></pre>
</td>
<td class="fill">
<hr/>
</td>
<td><input type="submit" name="char" value="Insert" class="button" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table>
</form>
</div>
</div>
<table class="fill">
<tr>
<td class="vert_sep_name">Query:
</td>
<td class="fill">
<hr/>
</td>
</tr>
</table>
<form action="#id4A----" method="POST" id="id4A----" onsubmit="return submitForm(this,this);"
><a name="id4A----"/><input type="hidden" name="selector" value="id4A----"/>
<table class="fill">
<tr>
<td class="fill"><textarea name="data" cols="78" rows="3">0 = x

</textarea>
</td>
<td class="editbuttontd"><input type="submit" name="action" value="OK" class="editbutton"
 onclick="return submitForm(this.form,this);"/><br/><input type="submit" name="action"
 value="Cancel" class="editbutton" onclick="return submitForm(this.form,this);"
/>
</td>
</tr>
</table><input type="hidden" name="xoff" value="0"/><input type="hidden" name="yoff"
 value="0"/>
</form>
<table class="fill">
<tr>
<td class="vert_sep_name">Results:
</td>
<td class="fill">
<hr/>
</td>
</tr>
</table>
<div id="id5A----" class="fill"><a name="id5A----"/>
<div>Heap used:&nbsp;241224 free:&nbsp;133975792
</div>
<div>Time used:&nbsp;0:0:0:6
</div>
</div>
</div>
</div>
</body></html>