Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.prolog > #14872

Boris the Loris saw it all comming [Weak Prolog Community] (Was: Fast, but not correct implementation)

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.prolog
Subject Boris the Loris saw it all comming [Weak Prolog Community] (Was: Fast, but not correct implementation)
Date 2025-09-30 21:53 +0200
Message-ID <10bhcfk$ar3k$1@solani.org> (permalink)
References <10bam8b$6mq5$1@solani.org> <10bdmf8$8gn7$1@solani.org> <10bhbkt$aqj2$1@solani.org>

Show all headers | View raw


Hi,

Yeah, Boris the Loris saw it all comming,
when he mentioned that the Prolog Community
is probably overwhelmed by Fuzzy Testing.

And I must confess, I succumbed to the guilty
pleasure of Fuzzy Testing. To find a pair S, T
I used this fuzzy testing device:

needle(S, T) :-
    between(1,1000,_),
    sample((pick(T), acyclic_term(T))),
    sample((pick(S), acyclic_term(S))),
    \+ ((unify_with_occurs_check(T, S) -> A = 1; A = 0),
        (unify_with_occurs_check2(T, S) -> B = 1; B = 0),
        A == B).

With this sample generator. It has slight
modification in pick/1, it starts with [T,_,_]
instead of [T], so that non-linear acyclic terms

are created, which is required that unification
leads to cricles. Only unify acyclic linear terms
with each other that have disjoint variables,

doesn't give cyclic terms. So this modification
is needed so that we find something at all:

sample(G) :-
    term_variables(G, L),
    repeat, maplist(pick, L),
    G, !.

pick(T) :-
    pick([T,_,_], T).

pick(L, T) :-
    random(V), N is truncate(V*3),
    (N = 0 -> T = 1;
     N = 1 -> T = s(P,Q), pick([P|L], P), pick([Q|L], Q);
     length(L, M),
     random(W), I is truncate(W*M),
     nth0(I, L, S), S = T).

Bye

Mild Shock schrieb:
> Hi,
> 
> Tricky problem, how validate unify_with_occurs_check/2 ?
> If the two arguments S and T are acyclic terms, the
> unify_with_occurs_check/2 can be simulated as follows:
> 
> /* simulation */
> unify_with_occurs_check2(X, Y) :-
>     X = Y, acyclic_term(X).
> 
> It also shows that theoretically the problem can be
> solved in quasi linear time, since (=)/2 is quasi linear
> and acyclic_term/1 is linear.
> 
> Now I find that unify_with_occurs_check2/2 and
> unify_with_occurs_check/2 do not agree in Trealla
> Prolog. For this test case for example:
> 
> /* Trealla Prolog 2.83.11 */
> /* built-in */
> ?- S = s(s(A,s(B,A)),1), T = s(s(C,C),1),
>     unify_with_occurs_check(S,T).
>     S = s(s(s(B,A),s(B,A)),1), A = s(B,A),
>     T = s(s(s(B,A),s(B,A)),1), C = s(B,A).
> 
> /* simulation */
> ?- S = s(s(A,s(B,A)),1), T = s(s(C,C),1),
>     unify_with_occurs_check2(S,T).
>     false.
> 
> One can also check with Scryer Prolog it has
> also a different result for the pair S and T:
> 
> /* Scryer Prolog 0.10.0 */
> /* built-in */
> ?- S = s(s(A,s(B,A)),1), T = s(s(C,C),1),
>     unify_with_occurs_check(S,T).
>     false.
> 
> Bye

Back to comp.lang.prolog | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Who will win the new Prolog race? SWI or Scryer? Mild Shock <janburse@fastmail.fm> - 2025-09-28 08:57 +0200
  The only problem is, Rust is shiiiit (Was: Who will win the new Prolog race? SWI or Scryer?) Mild Shock <janburse@fastmail.fm> - 2025-09-28 09:01 +0200
    Recent hybrid: Python beats Rust (Was: The only problem is, Rust is shiiiit) Mild Shock <janburse@fastmail.fm> - 2025-09-28 09:13 +0200
  Trealla drastically beats Scryer [Jaffar's Algorithm] (Re: Who will win the new Prolog race? SWI or Scryer? Mild Shock <janburse@fastmail.fm> - 2025-09-29 12:19 +0200
    Boris the Loris and the American Fuzzy Lop (Was: Trealla drastically beats Scryer [Jaffar's Algorithm]) Mild Shock <janburse@fastmail.fm> - 2025-09-29 12:54 +0200
      Was Boris living under a rock, how many Fuzzy Testing tools? (Was: Boris the Loris and the American Fuzzy Lop) Mild Shock <janburse@fastmail.fm> - 2025-09-29 12:59 +0200
        Not a Nazi-Retard, maybe a payed Troll on Putins payroll (Was: Was Boris living under a rock, how many Fuzzy Testing tools?) Mild Shock <janburse@fastmail.fm> - 2025-09-29 13:07 +0200
      Boris / EricGT: Why dont you tap into TAP? (Was: Boris the Loris and the American Fuzzy Lop) Mild Shock <janburse@fastmail.fm> - 2025-11-18 23:00 +0100
        Closing the abstract interpretation GAP (Re: Boris / EricGT: Why dont you tap into TAP?) Mild Shock <janburse@fastmail.fm> - 2025-11-18 23:12 +0100
    Fast, but not correct implementation (Was: Trealla drastically beats Scryer [Jaffar's Algorithm]) Mild Shock <janburse@fastmail.fm> - 2025-09-30 21:39 +0200
      Boris the Loris saw it all comming [Weak Prolog Community] (Was: Fast, but not correct implementation) Mild Shock <janburse@fastmail.fm> - 2025-09-30 21:53 +0200
  War between Scryer Prolog and Ciao Prolog [9:0 Triska vs Hermenegildo] (Was: Who will win the new Prolog race? SWI or Scryer?) Mild Shock <janburse@fastmail.fm> - 2025-11-19 12:49 +0100
    Useless as the Thirty Years War / Generalized Facts (Was: War between Scryer Prolog and Ciao Prolog) Mild Shock <janburse@fastmail.fm> - 2025-11-19 13:11 +0100
  The Guerilla tactics of SWI are amazing: Shell India? (Was: Who will win the new Prolog race? SWI or Scryer?) Mild Shock <janburse@fastmail.fm> - 2025-11-24 15:22 +0100
    The SWI7 exotism (dicts, etc..) has no value? (Was: The Guerilla tactics of SWI are amazing: Shell India?) Mild Shock <janburse@fastmail.fm> - 2025-11-24 15:41 +0100
      My new TinyCLP is much faster [100% Prolog] (Was: The SWI7 exotism (dicts, etc..) has no value?) Mild Shock <janburse@fastmail.fm> - 2025-11-24 21:27 +0100
  Railgun CLP versus Scryer Prolog [Euler #30 Variant] (Was: Who will win the new Prolog race?) Mild Shock <janburse@fastmail.fm> - 2026-01-30 02:10 +0100

csiph-web