%
/*
    rel_ex1.pro
    Examen Teorķa Computacional
    Alberto Pacheco, alberto@acm.org, Oct'00

    Consultar "rel_x.pro"
    Ejecutar ?- main.
    Anote Nombre de archivo: rel_ex1

*/

%-- RELACION DE NOMBRES DE RELACIONES
data(r1).
data(r2).
data(e).

%-- RELACIONES
init :- % Genera conjunto p={x#[1,9] | x es par}, q=[1,4]
    new_set(p,1,9),
    new_set(q,1,4).

rule(p,X) :- 0 is X mod 2. % x es par

% R1 = { m mod n = 0 | [m,n]#PxQ } = "m es divisible entre n" (AS,T)

r1(X,Y) :-
    p(X), q(Y), 0 is X mod Y.

% R2 = { n mod m = 0 | [m,n]#PxQ } = "m es divisible entre n" (R,AS)

r2(X,Y) :-
    p(X), q(Y), 0 is Y mod X.

% E = { m=n | [m,n]#PxQ } "Equivalencia" (R,S,AS)

e(X,X) :-
    p(X), q(X).

%