'Generates the previous lexicographically ordered subset.
Examples
>>> from sympy.combinatorics.subsets import Subset
>>> a = Subset([], [\'a\', \'b\', \'c\', \'d\'])
>>> a.prev_lexicographic().subset
[\'d\']
>>> a = Subset([\'c\',\'d\'], [\'a\', \'b\', \'c\', \'d\'])
>>> a.prev_lexicographic().subset
[\'c\']
See Also
next_lexicographic'

def prev_lexicographic(self):

    i = (self.superset_size - 1)
    indices = Subset.subset_indices(self.subset, self.superset)
    while ((i not in indices) and (i >= 0)):
        i = (i - 1)
    if (((i - 1) in indices) or (i == 0)):
        indices.remove(i)
    else:
        if (i >= 0):
            indices.remove(i)
            indices.append((i - 1))
        indices.append((self.superset_size - 1))
    ret_set = []
    super_set = self.superset
    for i in indices:
        ret_set.append(super_set[i])
    return Subset(ret_set, super_set)
