title: Define parts of a predicate across several modules
body: <p>I'm trying to write a predicate <code>move/3</code> which handles several kinds of terms, each kind of which is defined in a separate file.  I'm trying to use modules for this, because the files contain other predicates which should be namespaced appropriately.</p>
  
  <p>So, I've created a module <code>cat.prolog</code> with contents:</p>
  
  <pre><code>:- module(cat, [move/3]).
  :- multifile(move/3).
  
  move(cat(C), P, cat(C2)) :-
     ...
  </code></pre>
  
  <p>Similarly for <code>dog.prolog</code>.</p>
  
  <p>And <code>main.prolog</code> with:</p>
  
  <pre><code>:- use_module(['cat.prolog'], [move/3]).
  :- use_module(['dog.prolog'], [move/3]).
  
  (various predicates that use move/3 and expecting the clauses from all imported modules to be applicable.)
  </code></pre>
  
  <p>Trying to run this in SWI-Prolog:</p>
  
  <pre><code>?- ['main.prolog'].
  %  cat.prolog compiled into cat 0.00 sec, 4,800 bytes
  ERROR: Cannot import dog:move/3 into module user: already imported from cat
  Warning: /home/edmund/main.prolog:2:
          Goal (directive) failed: user:use_module([dog.prolog],[move/3])
  % main.prolog compiled 0.00 sec, 10,176 bytes
  true.
  </code></pre>
  
  <p>At this point I can use <code>dog:move/3</code> and <code>cat:move/3</code> but not <code>move/3</code>.  It works for the <code>cat</code> case but not the <code>dog</code> case.</p>
  
  <p>I get the feeling there's a really obvious way to do this.  I've tried combining modules and imports and multifile directives in many ways and still not found it yet...</p>