How to start work with the latest PFC pack?

Hello, I installed recently the PFC pack using

?- pack_install('https://github.com/TeamSPoon/pfc.git').

and then tried what seems to be the straightforward next step (reported in all posts on the pack I could find within the next few hours):

?- use_module(library(pfc)).

As I got:

ERROR: source_sink `library(pfc)' does not exist

I came across one post discussing setting proper library path, but once I was sure the path is actually ok, I realized that there is no pfc.pl file in my <...>/pack/pfc/prolog/ installation directory at all.

Reading further every letter of the post I learned the post was related to a PFC pack like v1.4.111 or so. Looking then into the GitHub repo I became aware of two ā€œmainā€ branches (ā€˜masterā€™ and ā€˜multiple_versionsā€™):

  • in ā€˜multiple_versionsā€™ branch there exists pfc.pl file in the .../pack/pfc/prolog/ directory, so with this version ?- use_module(library(pfc)). is supposed to work ā€œout of the boxā€.
  • in ā€˜masterā€™ branch (from which I guess PFC pack was installed by default) there is no pfc.pl file in the .../pack/pfc/prolog/ dir (but exist some others, the ā€œclosestā€ seems pfc_old.pl).

So here are (finally) my questions:

  1. Assuming I installed ā€˜masterā€™ version, which module I have to load as the very first step?
  2. What is the current status of the pack, does it work correctly in order I can follow the example given in the manual?
  3. Or, should I install the HEAD of ā€˜multiple_versionā€™ branch instead?

I run SWI-Prolog v8.2.3 at Win10 platform.

Thanks in advance for any help,

Goran

This one?

"pfc" pack for SWI-Prolog https://www.swi-prolog.org/pack/list?p=pfc

Can you provide a link to the post?


I think @logicmoo can answer these questions.

@EricGT :
Regarding link to install PFC pack: yes, this is the one.
Regarding the post discussing proper library path: will post it soon, just to find it againā€¦

The only time I really worked with pack pfc was documented in this topic.

Pfc pack (forward chaining) ā€“ canā€™t get to work

As it notes, not very clearly, some of the operators pfc uses, => are the same as SWI-Prolog now uses for single sided unification.

Eventually the author of the code, Douglas, stepped in.

Not much more I can offer. :woozy_face:

1 Like

@EricGT :
I used post

https://stackoverflow.com/questions/65381721/swi-prolog-cant-find-pce-library

that discusses similar problem of loading pce pack. As the error message is of the same type, I used this post to see if maybe I have to set the proper path to pfc library. But now I think that was never my problem, the installation of pfc pack added all the necessary paths, so what I got originally was (in the meantime I was experimenting with some other installations, so I must restore this original state now):

?- file_search_path(library,X).

X = app_config(lib) ;
X = swi(library) ;
X = swi(library/clp) ;
X = 'c:/users/goran/appdata/local/swi-prolog/pack/dictoo/prolog' ;
X = 'c:/users/goran/appdata/local/swi-prolog/pack/gvar_syntax/prolog' ;
X = 'c:/users/goran/appdata/local/swi-prolog/pack/logicmoo_utils/prolog' ;
X = 'c:/users/goran/appdata/local/swi-prolog/pack/pfc/prolog' ;
X = 'c:/users/goran/appdata/local/swi-prolog/pack/predicate_streams/prolog' ;
X = pce('prolog/lib').

Thanks EricGT for your support. I was hoping for a quick answer, but this was above my expectations! :+1:

Sorry about these bugsā€¦ when i get home this evening I will try to resolve them

@logicmoo : No problem. I am very glad and impressed the community reacts that promptly! Take your timeā€¦

If the screen is blurry use the Gear Icon and select 1080p

?- pack_install(pfc)

% Load the support for PFC
?- ensure_loaded(library(pfc_lib)).

% By default persons in database are male/1
?- add_PFC((person(P), ~female(P) ==> male(P))).

% Add Joe is person
?- add_PFC(person(joe)).

% Show the clause database
?- listing([male,female,person]).

% Why is Joe is a male
?- mpred_why(male(joe)).

% Remove Joe is a person.
?- add_PFC( \+ person(joe)).

% Why is Joe is a male
?- mpred_why(male(joe)).

% Show the clause database
?- listing([male,female,person]).



2 Likes

@logicmoo :

Thank you very much for the clear and complete workflow description!

On my side it looks as follows:

  1. The installation on my side went exactly the same way as shown in your video.
  2. Upon issuing
?- ensure_loaded(library(pfc_lib)).

I get

Warning: c:/users/goran/appdata/local/swi-prolog/pack/logicmoo_utils/prolog/xlisting/xlisting_console.pl:1470:
Warning:    Redefined static procedure prolog_listing:list_clause/5
Warning:    Previously defined at c:/program files/swipl/library/listing.pl:392
ERROR: c:/users/goran/appdata/local/swi-prolog/pack/pfc/prolog/dialect/pfc_ext/mpred_core.pl:203:
ERROR:    source_sink `library(logicmoo_test)' does not exist
Warning: c:/users/goran/appdata/local/swi-prolog/pack/pfc/prolog/dialect/pfc_ext/mpred_core.pl:203:
Warning:    Goal (directive) failed:
...
...

Looking into line 203 of mpred_core.pl I see

:- use_module(library(logicmoo_test)).

but I cannot find logicmoo_test.pl in my installation.

Can you check that? Thanks!

BR, Goran

@logicmoo:

Oh, sorry! It just crossed my mind few minutes ago while preparing morning coffee (itā€™s morning here, I live in CET Time Zone):

When I was referring in the previous post to the installation step, I was telling about the original installation (v2.0.3) BEFORE I opened this thread.

But I see now in the repository that you also updated the installation, so it is not just matter of loading the library. My bad, sorry!

I will reinstall the pack and let you know.

BR, Goran

@logicmoo, @EricGT:

Thatā€™s it! It works as a charm, exactly as you @logicmoo show in your video (I didnā€™t notice at first the packā€™s new version number 3.0.3 :flushed:).

Great support, thanks!

BR, Goran

1 Like