public ProductionInferenceResult ExecuteForwardChaining(string fact, string goal)
        {
            Goal = goal;

            WorkSpace = new Stack <ProductionRule>();
            ProductionInferenceResult result;

            if (CheckGoal(fact, 0))    // recursion starts here
            {
                result = new ProductionInferenceResult(true, WorkSpace.Reverse().ToList());
            }
            else
            {
                result = new ProductionInferenceResult(false, null);
            }

            return(result);
        }
        public ProductionInferenceResult ExecuteBackwardChaining(string fact, string goal)
        {
            Goal = fact;

            var tempRules = Rules;

            Rules = Rules.Select(r => new ProductionRule(r.Right, r.Left)).ToList();

            WorkSpace = new Stack <ProductionRule>();
            ProductionInferenceResult result;

            if (CheckGoal(goal, 0))    // recursion starts here
            {
                result = new ProductionInferenceResult(true, WorkSpace.Reverse().ToList());
            }
            else
            {
                result = new ProductionInferenceResult(false, null);
            }

            Rules = tempRules;
            return(result);
        }