AIMA.Core.Logic.FOL.Inference.Demodulation.isValidMatch C# (CSharp) Method

isValidMatch() public method

public isValidMatch ( Term toMatch, List toMatchVariables, Term possibleMatch, Term>.Dictionary substitution ) : bool
toMatch Term
toMatchVariables List
possibleMatch Term
substitution Term>.Dictionary
return bool
        public override bool isValidMatch(Term toMatch,
                List<Variable> toMatchVariables, Term possibleMatch,
                Dictionary<Variable, Term> substitution)
        {
            // Demodulation only allows substitution in the equation only,
            // if the substitution contains variables not in the toMatch
            // side of the equation (i.e. left hand side), then
            // it is not a legal demodulation match.
            // Note: see:
            // http://logic.stanford.edu/classes/cs157/2008/lectures/lecture15.pdf
            // slide 23 for an example.
            bool contained = !substitution.Keys.Except(toMatchVariables).Any();
            if (contained)
            {
                return true;
            }

            return false;
        }
    }