def retractOnWorld(cogstate,worldname,proposition):
	"""
	INPUT: a triple (cognitive state, worldname, proposition)
	OUTPUT: array of worlds
	WHAT IT DOES: Definition 4 (i)
	"""
	result=[]
	world=getWorldByName(worldname,cogstate)
	for situation in sitgen(world): # s
		if Forceable(situation, proposition, cogstate):
			continue # s may not force P
		adding=False
		for basis in getAllBases(world,cogstate): # s'
			if not subset(situation,basis):
				continue # s is has to be a subset of s'
			Maximal=True
			for t in subsitgen(basis):
				if Forceable(situation, proposition, cogstate):
					continue # t may not force P
				if subset(situation,t):
					if situation != t:
						Maximal=False
			if not Maximal:
				continue # s should be a maximal subset of s'
			adding=True
		if adding:
			result.append(situation)
	return result
def basisOfWorld(situation, worldname, cogstate):
    """
	INPUT: a pair (worldname, cognitive state)
	OUTPUT: an array of bases
	WHAT IT DOES: check if worldname
	"""
    if not Determines(situation, worldname, cogstate):
        return False
        # now check whether its minimal:
    subsituations = subsitgen(situation)
    for subsituation in subsituations:
        if Determines(subsituation, worldname, cogstate):
            return False
    return True