subtype(int,real).

subtype(X,X).


subtype(arrow(X,Y),arrow(Z,T)) :- subtype(Z,X), subtype(Y,T).



/*
Le seguenti due alternative non producono risultati spuri,
che sono invece prodotti dal primo programma a causa del meccanismo
del backtracking (spiegare in dettaglio)

subtype(int,real).

 subtype(X,X).

 subtype(arrow(X,Y),arrow(Z,T)) :- subtype(Z,X), ! ,subtype(Y,T).

------------------------------


subtype(X,X).

subtype(int,real).


subtype(arrow(X,Y),arrow(Z,T)) :- subtype(Z,X), subtype(Y,T).

*/

