Dear Maintainer,

The bug I'm having right now had been fixed upstream. Here I join an
example code that shows the bug in the constraint solver. The code
should be run with:
$ gprolog --init-goal '[adfgvx_gprolog]' --query "substitute([X], [A,
B]), A = 0'X, B = 0'D"

It says it doesn't find a solution while the obvious solution is X = 53
(= 0'5).

Best regards,
Celelibi

-- System Information:
Debian Release: 8.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.16.0-4-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages gprolog depends on:
ii  libc6  2.19-18

Versions of packages gprolog recommends:
pn  gprolog-doc  <none>

gprolog suggests no packages.

-- no debconf information
:- set_prolog_flag(double_quotes, codes).


alphabet([
	[0'A, 0'A, 0'A],
	[0'B, 0'A, 0'D],
	[0'C, 0'A, 0'F],
	[0'D, 0'A, 0'G],
	[0'E, 0'A, 0'V],
	[0'F, 0'A, 0'X],
	[0'G, 0'D, 0'A],
	[0'H, 0'D, 0'D],
	[0'I, 0'D, 0'F],
	[0'J, 0'D, 0'G],
	[0'K, 0'D, 0'V],
	[0'L, 0'D, 0'X],
	[0'M, 0'F, 0'A],
	[0'N, 0'F, 0'D],
	[0'O, 0'F, 0'F],
	[0'P, 0'F, 0'G],
	[0'Q, 0'F, 0'V],
	[0'R, 0'F, 0'X],
	[0'S, 0'G, 0'A],
	[0'T, 0'G, 0'D],
	[0'U, 0'G, 0'F],
	[0'V, 0'G, 0'G],
	[0'W, 0'G, 0'V],
	[0'X, 0'G, 0'X],
	[0'Y, 0'V, 0'A],
	[0'Z, 0'V, 0'D],
	[0'0, 0'V, 0'F],
	[0'1, 0'V, 0'G],
	[0'2, 0'V, 0'V],
	[0'3, 0'V, 0'X],
	[0'4, 0'X, 0'A],
	[0'5, 0'X, 0'D],
	[0'6, 0'X, 0'F],
	[0'7, 0'X, 0'G],
	[0'8, 0'X, 0'V],
	[0'9, 0'X, 0'X]
]).



substitute_letter(_, _, _, []).
substitute_letter(P, C1, C2, [[A, X1, X2] | Alphabet]) :-
	(P #= A) #<=> (C1 #= X1 #/\ C2 #= X2),
	substitute_letter(P, C1, C2, Alphabet).


substitute([], []).
substitute([P | PL], [C1, C2 | CL]) :-
	alphabet(Alphabet),
	fd_domain(P, "456"),
	fd_domain([C1, C2], "ADFGVX"),
	substitute_letter(P, C1, C2, Alphabet),
	substitute(PL, CL).

Reply via email to