Some examples:
?- subsumes_term(f(_,_),f(1,2)). % f(_,_) is definitely more generic than f(1,2) true. ?- subsumes_term(f(2,_),f(1,2)). % do not even unify false. ?- subsumes_term(f(A,A),f(1,2)). % do not even unify false. ?- subsumes_term(f(1,B),f(A,2)). % would unify, but Generic is not "more generic" (nor is Specific "more generic") false. ?- subsumes_term(f(A,A),f(A,2)). % unify but Generic is too constrained to give Specific by binding A false. ?- subsumes_term(f(C,C),f(A,2)). % same as above false. ?- subsumes_term(f(A,A),f(A,A)). % same on both sides true. ?- subsumes_term(f(A,B),f(A,A)). % would unify and Generic is more generic true. ?- subsumes_term(f(A,B),f(a,g(b))). % somewhat more complex true. ?- subsumes_term(f(A,g(B)),f(a,g(b))). true. ?- subsumes_term(f(A,g(b)),f(a,g(B))). false. ?- subsumes_term(f(A,B),f(a,g(B))). % unification would yield a cyclic structure false. ?- subsumes_term(f(A,C),f(a,g(B))). true. ?- subsumes_term(f(A,g(C)),f(a,g(B))). true. ?- subsumes_term(f(A,g(B)),f(a,g(B))). true. ?- subsumes_term(f(B,g(B)),f(a,g(B))). false. ?- subsumes_term(f(B,g(B)),f(a,g(a))). true.