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

apply() public method

public apply ( TermEquality assertion, Clause clExpression ) : Clause
assertion AIMA.Core.Logic.FOL.Parsing.AST.TermEquality
clExpression Clause
return Clause
        public Clause apply(TermEquality assertion, Clause clExpression)
        {
            Clause altClExpression = null;

            foreach (Literal l1 in clExpression.getLiterals())
            {
                AtomicSentence altExpression = apply(assertion, l1
                        .getAtomicSentence());
                if (null != altExpression)
                {
                    // I have an alternative, create a new clause
                    // with the alternative and return
                    List<Literal> newLits = new List<Literal>();
                    foreach (Literal l2 in clExpression.getLiterals())
                    {
                        if (l1.Equals(l2))
                        {
                            newLits.Add(l1.newInstance(altExpression));
                        }
                        else
                        {
                            newLits.Add(l2);
                        }
                    }
                    // Only apply demodulation at most once on
                    // each call.
                    altClExpression = new Clause(newLits);
                    altClExpression.setProofStep(new ProofStepClauseDemodulation(
                            altClExpression, clExpression, assertion));
                    if (clExpression.isImmutable())
                    {
                        altClExpression.setImmutable();
                    }
                    if (!clExpression.isStandardizedApartCheckRequired())
                    {
                        altClExpression.setStandardizedApartCheckNotRequired();
                    }
                    break;
                }
            }

            return altClExpression;
        }

Same methods

Demodulation::apply ( TermEquality assertion, AtomicSentence expression ) : AtomicSentence