Did you know ... Search Documentation:
Pack pac -- prolog/other/note-on-pac.txt

[2015/04/03]

Hi,

I have updated the package PAC to version 0.6.4, adding the files below among many other ones:

document/pac-syntax.txt --- a note on syntax in details document/sameple-queries.pl --- many sample queries in PAC pac/prolog/sample-module.pl --- sample definition of a kind pac/prolog/web.pl --- interface with browser/javascript pac/prolog/emacs-handler.pl --- interface with emacs-lisp pac/prolog/fol.pl --- a linear ancetstor resuolution prover written in kinds. pac/other-lang/http-request.js --- inteface codes of javascript side pac/other-lang/prolog-process.el --- inteface codes of emacs-lisp side

The favorite points of progresses are the following:

  • PAC is slightly extended to have mutual recursions with globals in the form of a system of equaitons.
  • Functional expressions are explained on `term completion', which is, in fact, not the application in the sense of functional programming. Roughly speaking, the term completion is a binary operation @ on prolog terms, which works like this:
    f(a) @ b		=> f(a, b)
    
    f(a) @ (g @ b) @ c	=> f(a, g(b), c)
    
    append @ [a,b] @ [c,d]  => append([a,b], [c,d]]).
    
    f @ a1 @ a2 @ ... @ an  => f(a1, a2..., an)

    Due to the operation @, the PAC syntax and semantics now are clear, and close to that of standard Lisps. To explain them, let the symbol [[ e ]] means the semantics of a expression e:

    LISP

    [[ (f e1 e2 ... en) ]] = [[f]]( [[e1]], [[e2]], ..., [[en]] )

    PAC

    [[ f @ e1 @ e2 @ ... @ en ]] = [[f]]( [[e1]], [[e2]], ..., [[en]] )

    so that

    (f e1 e2 ... en)    ~   f @ e1 @ ... @ en

    According to the correspondence, the term_expansion/2 in PAC is defined so that the following equivalence holds.

    [[f]](x1, x2, ..., xn) = V

    <==>

    call(f(x1, x2, ..., xn), V) is true

    The current version 0.6.4 seems clean, stable and usable as far as daily uses of mine. Although documentation on PAC is still poor (maybe forever), I hope some interested and patient readers would go into the PAC package. Also I would like to help them use and extend PAC freely for their purposes.

    Regards

    Kuniaki

    [2014/09/30] v0.5.5 initial version. [2014/10/02] v0.5.6 all sources are modules. [2015/03/31] v0.6.4 Syntax in BNF added.

    The PAC library defines term_expansion/2, which implements following featues on SWI-Prolog develop version (> V7.1).

  1. anonymous predicates as meta-arguments,
  2. a limited functional expressions including applications, and
  3. regular expressions in DCG phrases. pac/Readme this file pac/pack.pl
    pac/document: pac-syntax.txt Syntax in BNF sample-queries.pl sample pac queries. pac/prolog: pac.pl* main pac: expand-etc.pl expand etcetra (for, repeat, sed, ...) expand-pac.pl expand (compile) pac expressions expand-word.pl expand words in phrase (e.g. regex) interval-boole.pl boolean operations on intervals for regex. math.pl demo on conditional equations misc.pl miscellaneous op.pl operaters declaration. sample-module.pl a sample module using KIND. slim.pl making generated goals slim start-cgi.pl for PAC - CGI start-eh.pl for emacs buffer handlers
    pac/other-lang: http-request.js javascript to communicate with PAC prolog-process.el emacs-lisp to communicate with PAC

    A sample usage:

    ?- [library(pac)]. ?- module(pac). pac: ?- maplist(pred([X,Y,X-Y]), [a,b,c],[1,2,3], R).

    User's manual of the package is in preparation.

    I will appreciate for any comment or feedback.

    Regards,

    Kuniaki Mukai mukai at sfc.keio.ac.jp / kuniaki.mukai at gmail.com

    [2015/03/29]

    Application as Term Completion

    [2015/03/25] http://www.univcoop.jp/keio/info/procedure.html 〒223-0061 神奈川県横浜市港北区日吉4-1-1 TEL 045-563-8489 / FAX 045-562-6433 組合員証 個人番号091113

    記帳確認 [2015/03/22]

    Hi Jan,

    I have made a silent update on the package PAC to version 0.6.3.

    Now finally PAC has reached to clean and coherent syntax and alos semantics, which is a main reason of the update.

    I have included many SWI-Prolog/PAC files using pac macros into the package. For instance, a file pac/fol.pl may be a non trivial sample codes using conditional equations, which is one of main features of PAC. The fol.pl is, in theory, a complete implementation of a first-order prover based on linear ancestor resolution.

    Documetation of PAC is still poor, but I have added a memo of some length on PAC syntax and some sample queries.

    document/pac-syntex.txt
    document/sameple-queries.pl

    By the way, about SWI-Prolog version 7, I have found a merit of the compound zero arity term while writing codes for send/receive streams in emacs-lisp process, actually I have written a short and clean transaltion between S-Expression and Prolog v7 term.

    Kuniaki

    p.s. sample session of PAC ( on Mac OSX 10).

    ?- use_module(library(pac)).

    ?- module(pac).

    pac: ?- val(set(pow([1,2,3])), X). X = [[3], [3, 1], [3, 2, 1], [3, 2], [2], [2, 1], [1], []] .

    pac: ?- val(([X,Y] \ (append(Y,X))) @[1,2,3]@[a,b,c], R). R = [a, b, c, 1, 2, 3].

    pac: ?- val(fun([X, Y] -> append(X, Y))@[1,2,3]@[a,b,c], R). R = [1, 2, 3, a, b, c].

    pac: ?- call(pred([hello]), X). X = hello.

    pac: ?- call(pred([A], [F, Y]:- Y =..[F, A]), f, R), A = a. A = a, R = f(a).

    pac: ?- show_am("[^A-Z]+|[0-9]*"). true.

    pac: ?- show_am("[A-Z]+|[0-9]*"). true.