1

The following program noMetagolR is given in:

http://www.doc.ic.ac.uk/~shm/Papers/metagol_gram.pdf page 33.

parse(S,G1,G2) :- parse(s(0),S,[],G1,G2).

parse(Q,X,X,G1,G2) :- abduce(acceptor(Q),G1,G2).
parse(Q,[C|X],Y,G1,G2) :- Skolem(P), abduce(delta1(Q,C,P),G1,G3), parse(P,X,Y,G3,G2).

abduce(X,G,G) :- member(X,G).
abduce(X,G,[X|G]) :- not(member(X,G)).

Skolem(s(0)). Skolem(s(1)). ...

An example query is :

parse([],[],G1), parse([0],G1,G2), parse([0,0],G2,G3), parse([1,1],G3,G4), parse([0,0,0],G4,G5), parse([0,1,1],G5,G6), parse([1,0,1],G6,G),not(parse([1],G,G)), not(parse([0,1],G,G)).

The answer substitutions should return a learnt grammar for parity.

The program is said to run in Yap. I normally use SWI-prolog. Either way, what do I do to make them understand Skolem/1 ? Presumbly this means that Skolem is a variable? I thought maybe using =.. but this does not work.

Also how many Skolem/1 facts are needed?

false
  • 10,264
  • 13
  • 101
  • 209
user27815
  • 4,767
  • 14
  • 28
  • A goal `Skolem(X)` may mean two different things: Either it means `'Skolem'(X)`, or it means `call(Skolem,X)`. So this may increase confusion, if you continue to use that syntax. Rather write `skolem(X)` instead. – false Aug 15 '15 at 09:47
  • 1
    When I have seen it before, I always interpreted it as 'call(Skolem,X).' But I have not seen facts of `Skolem/1` before so I didn't understand what they were doing. – user27815 Aug 15 '15 at 09:53

1 Answers1

0

in SWI-Prolog, you can place in your source the directive

:- set_prolog_flag(allow_variable_name_as_functor,true).

see current_prolog_flag/2

example on REPL:

1 ?- set_prolog_flag(allow_variable_name_as_functor,true).
true.

2 ?- assert(X(1)).
true.

3 ?- X(Y).
Y = 1.
CapelliC
  • 59,646
  • 5
  • 47
  • 90
  • Any one know how to do this in yap? – user27815 Aug 13 '15 at 07:32
  • to be true, I would with a simple edit/replace all Skolem with skolem, instead of set_prolog_flag(...). Just, skolem should be not already used... – CapelliC Aug 13 '15 at 11:53
  • Do you know why they might have used Skolem rather than skolem then? What is the point of this way of doing it? – user27815 Aug 13 '15 at 14:46
  • It's not easy to answer. Since Skolemization it's at the core of the tech, I think they preferred to enforce the document layout and consistency, rather than worring about such a low level syntactic detail. Indeed, the document looks very interesting, but it seems to require proficiency in Prolog and ASP as well... – CapelliC Aug 13 '15 at 15:37
  • Well they have one implementation in prolog and one in asp, so I am just looking at the prolog one to begin with :) – user27815 Aug 13 '15 at 19:15