def proposition_describes_statement(self, proposition, s, context):
    prop_s = proposition.statement
    variable_types = {hyp.variable: hyp.vclass for hyp in proposition.f.values()}
    variable_definitions = {hyp.variable: None for hyp in proposition.f.values()}
    variable_trees = {hyp.variable: None for hyp in proposition.f.values()}
    index_into_s = 0
    index_into_prop_s = 0
    while (index_into_prop_s < len(prop_s)):
        if (index_into_s >= len(s)):
            return (False, False)
        prop_value = prop_s[index_into_prop_s]
        if (prop_value in variable_types):
            if (variable_definitions[prop_value] == None):
                (string, tree) = self.parse_statement(([variable_types[prop_value]] + s[index_into_s:]), context)
                if (string == False):
                    return (False, False)
                length = (len(string) - 1)
                index_into_s += length
                index_into_prop_s += 1
                variable_definitions[prop_value] = string[1:]
                variable_trees[prop_value] = tree
                continue
            elif is_initial_string(variable_definitions[prop_value], statement):
                index_into_s += len(variable_definitions[prop_value])
                index_into_prop_s += 1
                continue
            else:
                return (False, False)
        elif (prop_value == s[index_into_s]):
            index_into_s += 1
            index_into_prop_s += 1
            continue
        else:
            return (False, False)
    leaves = [variable_trees[hyp.variable] for hyp in proposition.hyps if (hyp.type == 'f')]
    tree = Tree(value=proposition.label, leaves=leaves)
    out_string = s[:index_into_s]
    return (out_string, tree)
def proposition_describes_statement(self, proposition, s, context):
    prop_s = proposition.statement
    variable_types = {hyp.variable: hyp.vclass for hyp in proposition.f.values()}
    variable_definitions = {hyp.variable: None for hyp in proposition.f.values()}
    variable_trees = {hyp.variable: None for hyp in proposition.f.values()}
    index_into_s = 0
    index_into_prop_s = 0
    while (index_into_prop_s < len(prop_s)):
        if (index_into_s >= len(s)):
            return (False, False)
        prop_value = prop_s[index_into_prop_s]
        if (prop_value in variable_types):
            if (variable_definitions[prop_value] == None):
                (string, tree) = self.parse_statement(([variable_types[prop_value]] + s[index_into_s:]), context)
                if (string == False):
                    return (False, False)
                length = (len(string) - 1)
                index_into_s += length
                index_into_prop_s += 1
                variable_definitions[prop_value] = string[1:]
                variable_trees[prop_value] = tree
                continue
            elif is_initial_string(variable_definitions[prop_value], statement):
                index_into_s += len(variable_definitions[prop_value])
                index_into_prop_s += 1
                continue
            else:
                return (False, False)
        elif (prop_value == s[index_into_s]):
            index_into_s += 1
            index_into_prop_s += 1
            continue
        else:
            return (False, False)
    leaves = [variable_trees[hyp.variable] for hyp in proposition.hyps if (hyp.type == 'f')]
    tree = Tree(value=proposition.label, leaves=leaves)
    out_string = s[:index_into_s]
    return (out_string, tree)