First of all, operators are not relations, and they are not predicates. Operators are a syntax function, they are there to help us save on a set of parentheses:
:- op(250,xfy,
and then
4 ?- X = 2
X = 2
Now you can define a predicate that will handle complex terms as you like. This, of course, is not much different from
5 ?- X=[2,3|5], write_canonical(X).
'.'(2,'.'(3,5))
X = [2, 3|5].
. , , .
7 ?- Y=2
Y = 2
:
:- op(250,xfx,
:- op(350,xfx,@).
10 ?- X=2@3
@(2,
X = 2@3
11 ?- X=2@3
ERROR: Syntax error: Operator priority clash
ERROR: X=2@3#
ERROR: ** here **
ERROR: 5#7, write_canonical(X) .