1:- module(test,[]).    2:- use_module(pac('odict-attr')).    3:- use_module(pac('anti-subst')).    4:- use_module(misc('ptq-fragment')).    5:- use_module(misc('env-dict')).    6:- use_module(misc(bdd)).    7:- include(pac(op)).    8:- use_pac.    9
   10% ?- module(test).
   11% ?- prop(X.a <->Y.b), X.a = true, write(Y.b).
   12
   13%@ put_attr(X, cil, btree(t(a, true, _310, _312))),
   14%@ put_attr(_310, cil, con(lower(a), [])),
   15%@ put_attr(_312, cil, con(upper(a), [])),
   16%@ put_attr(Y, cil, btree(t(b, true, _368, _370))),
   17%@ put_attr(_368, cil, con(lower(b), [])),
   18%@ put_attr(_370, cil, con(upper(b), [])).
   19
   20
   21% ?- prop(X.a <->Y.b), sat, write(Y.b).
   22%@ true
   23%@ put_attr(X, cil, btree(t(a, true, _350, _352))),
   24%@ put_attr(_350, cil, con(lower(a), [])),
   25%@ put_attr(_352, cil, con(upper(a), [])),
   26%@ put_attr(Y, cil, btree(t(b, true, _408, _410))),
   27%@ put_attr(_408, cil, con(lower(b), [])),
   28%@ put_attr(_410, cil, con(upper(b), [])) ;
   29%@ false
   30%@ put_attr(X, cil, btree(t(a, false, _850, _852))),
   31%@ put_attr(_850, cil, con(lower(a), [])),
   32%@ put_attr(_852, cil, con(upper(a), [])),
   33%@ put_attr(Y, cil, btree(t(b, false, _926, _928))),
   34%@ put_attr(_926, cil, con(lower(b), [])),
   35%@ put_attr(_928, cil, con(upper(b), [])) .
   36
   37
   38
   39% ?- env_dict(tmp, Y).
   40%@ Y = '/Users/cantor/local/lib/pacpl7.worktrees/pack-pac/prolog/tmp'.
   41
   42% ?- [N,M,P,Q] ins 1..10, X #= 2^N*5^M, Y #= 2^P*5^Q, X*Y-1 #= Y+X.
   43% ?- [N,M,P,Q] ins 1..100, X #= 2^N*5^M, Y #= 2^P*5^Q, X*Y-1 #= Y+X.
   44% ?- [N,M,P,Q] ins 1..1000, X #= 2^N*5^M, Y #= 2^P*5^Q, X*Y-1 #= Y+X.
   45% ?- [N,M,P,Q] ins 1..10000, X #= 2^N*5^M, Y #= 2^P*5^Q, X*Y-1 #= Y+X.
   46
   47
   48% ?- all_triangls(T).
   49%@ T = [t(a, b, c), t(a, c, d)].
   50
   51graph([a-[b,c,d], b-[a,c], c-[a, b, d], d-[a,c]]).
   52
   53% T = [t(a,b,c), t(a,c,d)].
   54
   55triangle(t(A,B,C)):- graph(G),  member(A-S, G), member(B-T, G), member(C-U, G),
   56					 A@<B, B@<C,
   57					 memberchk(B, S),
   58					 memberchk(C, T),
   59					 memberchk(A, U).
   60
   61all_triangls(Ts):- setof(T, triangle(T), Ts).
   62
   63
   64% ?- module(test).
   65%@ Warning: test is not a current module (created)
   66%@ true.
   67% ?- upac(X).
   68
   69% p(U, _V) :-
   70%         U = [A|_],
   71%         put_attr(A, cil, x).
   72
   73% ?- test:p(U, V), cil:(U = V).
   74%@ U = V, V = [_1420|_1422],
   75%@ put_attr(_1420, cil, x).
   76
   77
   78%@ U = V, V = [_1454|_1456],
   79%@ put_attr(_1454, cil, x).
   80
   81
   82% U = V, V = [_7522|_7524],
   83% put_attr(_7522, m, x).
   84
   85
   86% % ?- help(attr_unify_hook).
   87% %@ true.
   88
   89% ?- upac.
   90% ?- foldl(pred([X,Y,[X|Y]]), [a,b,c], [], R).
   91
   92
   93
   94% ?- mpac:expand_clause(point(), Y).
   95
   96h([X, p({b:B, a:A}), b], [X, B, A]).
   97% ?- listing(h/2).
   98% ?- h([a, p({a:a, b:B}), B], R).
   99% ?- [X, p({b:B, a:A}), b] = [a, p({a:a, b:B}), B].
  100
  101
  102% Sample predicates p/3, q/1, r/3.
  103p(X, A, X.A).
  104%
  105q({h:pred([hello])}).
  106
  107% ?- X = f@b.
  108% ?- mpac:expand_exp(f@(g@a)@b, =, V, m, G, P, []).
  109% ?- nopac(mpac:expand_exp(f@(g@a)@b, =, V, [], G, P, [])).
  110
  111%  r(D, K, V) is true  if V = D.K
  112%	where D is defined by q/1.
  113
  114r(D, K, V):- q(D), call(D.K, V).
  115
  116% ?- module(test).
  117% ?- upac.
  118
  119arithmetic1(is(1+2+({a:3}.a)+4)).
  120
  121% ?- arithmetic1(X).
  122arithmetic2(X, is(1+(2+X.a)+4)).
  123
  124% ?- X = A.b.
  125% ?- X = {a:1, b:1}.
  126% ?- pac(X).
  127
  128% ?- arithmetic2({a:3}, V).
  129% ?- A = {a:1}.a.
  130% ?- A = {a:{b:1}}.a.b.
  131% ?- A = {a:{b:{c:1}}}.a.b.
  132% ?- A = {a:{b:{c:1}}}.a.b.c.
  133% ?- r(X, h, V).
  134% ?- p(D, K, V),  D={a:2}, K = a.
  135% ?- X = a({b:B}),  Y = a({b:2}), X= Y.
  136% ?- Y = {a:1}.
  137% ?- Y= X.b.
  138% ?- X= {a:2}, Y= X.a.
  139% ?- X={a:1}, X={b:2}.
  140% ?- X=Y, X.a=1, Y.a=V.
  141% ?- X.a=1, Y.a=V, X=Y.
  142% ?- X.a = X.b, X={b:1}.
  143% ?- X={a:2}, Y={b:1}, X=Y.
  144% ?- X=f({a:2}), Y=f({b:1}), X=Y, f(A)= X, B = A.b.
  145% ?- X=f({a:2}), Y=f({b:1}), X=Y.
  146% ?- X = {a:1}.
  147% ?- call(pred([a]), X).
  148
  149		/**********************
  150		*     ptq fragment    *
  151		**********************/
  152
  153% ?- module(ptqfrag).
  154% ?- run_samples.
  155
  156
  157% :- use_module(library(clpfd)).
  158% :- use_module(library(clpfd)).
  159% ?- module(test).
  160
  161% ?- X*Y #= 100, label([X,Y]).
  162%@ X = -100,
  163%@ Y = -1 .
  164% ?- X*Y #= 10, label([X,Y]).
  165% ?- X*Y #= 0.
  166
  167% ?- A*X*Y+B*X+C*Y #= D, A+B+C+D #= 0, label([A,B,C,D,X,Y]).
  168
  169% ?- A*X*Y+B*X+C*Y #= D, A #= 1, B#=1, C#=1, D#=1, label([X,Y]).
  170
  171% ?- X*Y+X+Y #= 0, label([X,Y]).
  172% ?- X*Y #= 0, label([X,Y]).