2

I’m trying to import Aleph with SWI-Prolog. When I run my program I get the error below. What do I have to do to import library(aleph)? By the way, I have already downloaded aleph.pl for my program. Here is my test program, I know there must be something wrong with the library aleph.

:- use_module(library(aleph)).
:- aleph.

I got the error:

ERROR: c:/users/mac/desktop/swi-prolog/aleph draft/1.pl:1:
    source_sink `library(aleph)' does not exist
Warning: c:/users/mac/desktop/swi-prolog/aleph draft/1.pl:1:
        Goal (directive) failed: user:use_module(library(aleph))
ERROR: c:/users/mac/desktop/swi-prolog/aleph draft/1.pl:2:
        catch/3: Undefined procedure: aleph/0
Warning: c:/users/mac/desktop/swi-prolog/aleph draft/1.pl:2:
        Goal (directive) failed: user:aleph
Welcome to SWI-Prolog (threaded, 32 bits, version 7.6.4)
Erik Kaplun
  • 37,128
  • 15
  • 99
  • 111
LU.CAO
  • 41
  • 5

2 Answers2

3

You should use the installer:

?- pack_install(aleph).

% Contacting server at http://www.swi-prolog.org/pack/query ... ok
Install aleph@5 from GIT at https://github.com/friguzzi/aleph.git Y/n? 
% Cloning into '/home/carlo/lib/swipl/pack/aleph'...
% Contacting server at http://www.swi-prolog.org/pack/query ... ok
% "aleph.git" was downloaded 6 times
Package:                aleph
Title:                  Aleph Inductive Logic Prorgramming system
Installed version:      5
Author:                 Fabrizio Riguzzi <fabrizio.riguzzi@unife.it>
Activate pack "aleph" Y/n? 
true.

?- use_module(library(aleph)).
true.
CapelliC
  • 59,646
  • 5
  • 47
  • 90
  • When I started the command:?- pack_install(aleph). I got the error as follow, what did I wrong? % Contacting server at http://www.swi-prolog.org/pack/query ... ok Install aleph@5 from GIT at https://github.com/friguzzi/aleph.git Y/n? ERROR: source_sink `path(git)' does not exist – LU.CAO Jun 18 '18 at 15:25
  • You can download the zip manually from github.com (if you haven't done yet, isn't clear what you downloaded previously) and give the path of downloaded file to pack_install, I think. See the [docs](http://www.swi-prolog.org/pldoc/man?section=prologpack). Or [install git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git), but seems a bit overkill for just giving a package a try – CapelliC Jun 18 '18 at 17:16
  • I have already done these steps and installed aleph successfully, but I still got the error as follow. Did I download the wrong version I guess. `1 ?- use_module(library(aleph)). % library(arithmetic) compiled into arithmetic 0.00 sec, 115 clauses % library(broadcast) compiled into broadcast 0.00 sec, 13 clauses % library(time) compiled into time 0.02 sec, 1,332 clauses ERROR: d:/swi-prologportable/app/swi-prolog/pack/aleph/prolog/aleph.pl:4878:1: Syntax error: Operator expected % library(aleph) compiled into aleph 0.14 sec, 3,394 clauses true.` – LU.CAO Jun 23 '18 at 15:14
  • At line 4878 there is `$trace`. You can try to comment it out. The block of code starting at line 4848 seems unused, if we trust the comment immediately above. Of course, the fact that my SWI-Prolog (latest version, compiled from source) doesn't give error, let me wonder about the whole correctness. Aleph seems to be a complex application... – CapelliC Jun 23 '18 at 15:28
  • I commented it out and it works, but it seems that block of code is unused like you mentioned. because when I tried to run my simple examples there no induction in its output. Is it possible that there was an error in my code? I have shown one of examples in answer. – LU.CAO Jun 23 '18 at 15:43
  • In your console, try `?- current_op(X,Y,$).`. What you get ? – CapelliC Jun 23 '18 at 15:45
  • These are what I got:1 ?- current_op(X,Y,$). X = 1, Y = fx. – LU.CAO Jun 23 '18 at 15:54
  • The same here. Should not throw an error when *parsing* then... not sure what's going on – CapelliC Jun 23 '18 at 15:55
  • I put my code that I tried and output theory in another answer of this question here. Because the number of comments is limited. Could please help me see if it's my code wrong or the aleph system isn't working at all. I couldn't get the theory and there was no induction at all. – LU.CAO Jun 23 '18 at 15:58
1

Here is the example I tried, and I didn't get the inductive theory.

% Aleph initialization
    :- aleph.

% Mode declarations
% mode(RecallNumber,PredicateMode).
% - output
:- modeh(*,grandparent(+person,+person)).
:- modeb(*,father(-person,-person)).

:-begin_bg.
person(john).
person(johnJunior).
person(johnJuniorJunior).
person(jack).
person(jackJunior).
person(jackJuniorJunior).
father(johnJunior, john).
father(johnJuniorJunior, johnJunior).
father(jackJunior, jack).
father(jackJuniorJunior, jackJunior).

:-determination(grandparent/2,father/2).

:-end_bg.

:-begin_in_pos.
grandparent(john, johnJuniorJunior).
grandparent(jack, jackJuniorJunior).
:-end_in_pos.

:-begin_in_neg.
grandparent(jack, john).
:-end_in_neg.

:-aleph_read_all.

Here is my output:

[theory]

[Rule 1] [Pos cover = 1 Neg cover = 0]
grandparent(john,johnJuniorJunior).

[Rule 2] [Pos cover = 1 Neg cover = 0]
grandparent(jack,jackJuniorJunior).

[time taken] [0.015625]
[total clauses constructed] [2]
true.

I guess aleph systeme didn't work.

LU.CAO
  • 41
  • 5
  • better first to get included examples working, from simpler to complex... sorry I have little time now to follow this problem, I'm pretty sure Fabrizio Riguzzi would be interested in any serious bug report, or still better, pull requests on github – CapelliC Jun 23 '18 at 16:03