How to start work with the latest PFC pack?

Hello, I installed recently the PFC pack using

?- pack_install('').

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 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 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 file in the .../pack/pfc/prolog/ dir (but exist some others, the “closest” seems

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,


This one?

"pfc" pack for SWI-Prolog

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

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]).


@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/
Warning:    Redefined static procedure prolog_listing:list_clause/5
Warning:    Previously defined at c:/program files/swipl/library/
ERROR: c:/users/goran/appdata/local/swi-prolog/pack/pfc/prolog/dialect/pfc_ext/
ERROR:    source_sink `library(logicmoo_test)' does not exist
Warning: c:/users/goran/appdata/local/swi-prolog/pack/pfc/prolog/dialect/pfc_ext/
Warning:    Goal (directive) failed:

Looking into line 203 of I see

:- use_module(library(logicmoo_test)).

but I cannot find in my installation.

Can you check that? Thanks!

BR, Goran


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