Next: term_vars, Previous: term_subst, Up: Top [Contents]
%--------------------------------------------------% % vim: ts=4 sw=4 et ft=mercury %--------------------------------------------------% % Copyright (C) 1993-2000,2003-2009,2011-2012 The University of Melbourne. % Copyright (C) 2014-2022 The Mercury team. % This file is distributed under the terms specified in COPYING.LIB. %--------------------------------------------------% % % File: term_unify.m. % Main author: fjh. % Stability: medium. % % This file provides predicates to unify terms. % %--------------------------------------------------% %--------------------------------------------------% :- module term_unify. :- interface. :- import_module list. :- import_module term. %--------------------------------------------------% % % Predicates to unify terms. % % unify_terms(TermA, TermB, !Subst): % % Unify (with occur check) two terms with respect to the current % substitution, and update that substitution as necessary. % :- pred unify_terms(term(T)::in, term(T)::in, substitution(T)::in, substitution(T)::out) is semidet. % unify_term_lists(TermsA, TermsB, !Subst): % % Unify (with occur check) two lists of terms with respect to the current % substitution, and update that substitution as necessary. % Fail if the lists are not of equal length. % :- pred unify_term_lists(list(term(T))::in, list(term(T))::in, substitution(T)::in, substitution(T)::out) is semidet. % unify_terms_dont_bind(TermA, TermB, DontBindVars, !Subst): % % Do the same job as unify_term(TermA, TermB, !Subst), but fail % if any of the variables in DontBindVars would become bound % by the unification. % :- pred unify_terms_dont_bind(term(T)::in, term(T)::in, list(var(T))::in, substitution(T)::in, substitution(T)::out) is semidet. % unify_term_lists_dont_bind(TermsA, TermsB, DontBindVars, !Subst): % % Do the same job as unify_term_lists(TermsA, TermsB, !Subst), but fail % if any of the variables in DontBindVars would become bound % by the unification. % :- pred unify_term_lists_dont_bind(list(term(T))::in, list(term(T))::in, list(var(T))::in, substitution(T)::in, substitution(T)::out) is semidet. %--------------------------------------------------% % % Predicates to test subsumption. % % first_term_list_subsumes_second(TermsA, TermsB, Subst): % % Succeeds iff the list TermsA subsumes (is more general than) TermsB, % producing a substitution which, when applied to TermsA, will give TermsB. % :- pred first_term_list_subsumes_second(list(term(T))::in, list(term(T))::in, substitution(T)::out) is semidet. %--------------------------------------------------% %--------------------------------------------------%