Exemple #1
0
        private static TermFunction SubstituteFunction(TermFunction function, Substitution theta)
        {
            if (!function.HasVariables)
                return function;

            var body = new List<Term>();
            for (int i = 0; i < function.Arity; i++)
                body.Add(SubstituteTerm(function.GetTerm(i), theta));

            return new TermFunction(function.FunctionName, body.ToArray());
        }
Exemple #2
0
        private TermFunction RenameFunction(TermFunction function, Dictionary<TermVariable, TermVariable> renamings)
        {
            if (!function.HasVariables)
                return function;

            var body = new List<Term>();
            for (int i = 0; i < function.Arity; i++)
                body.Add(RenameTerm(function.GetTerm(i), renamings));

            return new TermFunction(function.FunctionName, body.ToArray());
        }
        private bool Matches(TermFunction function)
        {
            if (function.FunctionName != Name || function.Arity != _arity)
                return false;

            for (int i = 0; i < function.Arity; i++)
            {
                var term = function.GetTerm(i) as TermFunction;
                if (_functions.ContainsKey(i) && term == null)
                    return false;

                if (term != null)
                    if (!_functions.ContainsKey(i) || !_functions[i].Matches(term))
                        return false;
            }
            return true;
        }