Esempio n. 1
0
def res(n):
    """Primitive recursive specification:
        res(0)   = (.)
        res(n+1) = res res head(n) o..o(.) eo
    """
    if n == 0:
        return Resolution.fromString("(.)")
    else:
        return Resolution(Resolution(head(n-1), Resolution.fromString("o"*(n+1)+"(.)")), Resolution.fromString("eo"))
Esempio n. 2
0
def head(n):
    """Primitive recursive specification:
        head(0)   = res ee oeoe(.)
        head(n+1) = res head(n) o..oe(.)
    """
    if n == 0:
        return Resolution.fromString("[ee|oeoe(.)]")
    else:
        return Resolution(head(n-1), Path.fromString("o"*(n+1) + "e(.)"))