### Translator to FOPC

th(A, X, T) :- atom(A), T =.. [A,X].

th(intersection(C,D), X, (T1,T2)) :-

th(C, X, T1),

th(D, X, T2).

th(all(R,C), X, (T1 :- T2)) :-

th(C, Y, T1), T2 =.. [R,X,Y].

tb(A, X, T) :- atom(A), T =.. [A,X].

tb(intersection(C,D), X, (T1,T2)) :-

tb(C, X, T1),

tb(D, X, T2).

tb(union(C,D), X, (T1 ; T2)) :-

tb(C, X, T1),

tb(D, X, T2).

tb(some(R,C), X, (T1,T2)) :-

tb(C, Y, T2), T1 =.. [R,X,Y].

t(subclass(C,D), (T1 :- T2)) :-

th(D, Y, T1),

tb(C, Y, T2).

t(equivalent(C,D), (T1,T2)) :-

t(subclass(C,D), T1),

t(subclass(D,C), T2).

t(range(R,D), (T1 :- T2)) :-

th(D, Y, T1),

T2 =.. [R,_,Y].

t(domain(R,D), (T1 :- T2)) :-

th(D, X, T1),

T2 =.. [R,X,_].

t(X : A, T) :-

th(A, X, T).

t((X1,X2):R, T) :-

atom(R),

T =.. [R,X1,X2].