Prolog has some complex syntax rules around operators to avoid ambiguities. In some cases you have to insert spaces or parentheses to make clear what you want.
This works (and is the form I prefer):
?- X = -(-a).
X = - -a.
?- proposition(-(-a)).
true.
This works as well:
?- X = - -a.
X = - -a.
?- proposition(- -a).
true.
If you find this inconvenient, one thing you could do would be to define --
, ---
, etc. as operators analogously to -
:
?- op(200, fy, --).
true.
?- op(200, fy, ---).
true.
?- X = --a, Y = ---a.
X = --a,
Y = ---a.
?- --a = -(-a).
false.
Then every time you accept user input, you could first run a "preprocessor" that translates a term like --a
into -(-a)
. Personally I think this would not be worth it, but it might be a fun exercise.