In a backward_chaining function, it should call an apply function There are two rules that suppose to be able to apply with the given query but I am not getting it correct, nor do I understand how can they be applied.with the query: ['tiger', 'eats', 'tiger', True] First one: {'text': 'The tiger is rough.', 'antecedents': [], 'consequent': ['tiger', 'is', 'rough', True]} goals [['tiger', 'eats', 'tiger', True]] var ['AaA', 'bBb', 'ccC'] This is further suppose to support/relate to: {'antecedents': [['ccC', 'is', 'rough', True]], 'consequent': ['ccC', 'eats', 'tiger', True], 'text': 'If something is rough then it eats the tiger.'} Another one: {'antecedents': [], 'consequent': ['tiger', 'visits', 'bald eagle', True], 'text': 'The tiger visits the bald eagle.'} Supports: {'antecedents': [['bBb', 'visits', 'bald eagle', True]], 'consequent': ['bBb', 'eats', 'tiger', True], 'text': 'If something visits the bald eagle then it eats the ' 'tiger.'}, @param rule: A rule that is being tested to see if it can be applied This function should not modify rule; consider deepcopy . @param goals: A list of propositions against which the rule's consequent will be tested This function should not modify goals; consider deepcopy. @param variables: list of strings that should be treated as variables Rule application succeeds if the rule's consequent can be unified with any one of the goals. @return applications: a list, possibly empty, of the rule applications that are possible against the present set of goals. Each rule application is a copy of the rule, but with both the antecedents and the consequent modified using the variable substitutions that were necessary to unify it to one of the goals. Note that this might require multiple sequential substitutions, e.g., converting (' x ', 'eats', 'squirrel', False) based on subs =={ ' x ': 'a', 'a': 'bobcat' } yields ('bobcat', 'eats', 'squirrel', False). The length of the applications list is 0<=len( applications) s= len(goals). If every one of the goals can be unified with the rule consequent, then len(applications)==len(goals); if none of them can, then len(applications)=0. @return goalsets: a list of lists of new goals, where len(newgoals)==len(applications). goalsets [i] is a copy of goals (a list) in which the goal that unified with applications[i] ['consequent'] has been removed, and replaced by the members of applications [i] ['antecedents']..