I have this DCG:
mdy(M,D,Y) --> integer(M),`/`,integer(D),`/`,integer(Y).
At first, I didn’t think it needed to be tested on its own, but I did it anyway. This is as expected:
?- phrase(mdy(M,D,Y),`07/06/2019`,_). M = 7, D = 6, Y = 2019.
When I do this I get an unexpected unification:
?- phrase(mdy(M,D,Y),`07/07/2019`,_). M = D, D = 7, Y = 2019.
So far, I haven’t found anything wrong with it, but it does concern me that it makes a unification simply because two different variables just happen to equal the same value. Why would it do this?