def supports(cogstate,formula):
	result = True
	for world in cogstate:
		if world[meta][FS]:
			if not formulaIsTrue(world, formula):
				result = False
	return result
def formulaIsConsistent(cogstate, formula):
	"""
	INPUT: a pair (cognitive state, formula)
	OUTPUT: a cognitive state
	WHAT IT DOES: Should tell you whether the formula is true in
		at least one world in FS.
	"""
	for world in cogstate:
		if world[meta][US]:
			if formulaIsTrue(world, formula):
				return True
	return False
def propositionFromFormula(cogstate, formula):
	"""
	INPUT: A pair (cognitive state, formula) which are a 
	list and a string, respectively.
	OUTPUT: A list.
	WHAT IT DOES: Given the cognitive state, it looks through
	each world in US and checks whether the formula is true there.
	If so, it adds it to a list. The list at the end will be the
	proposition denoted by the formula.
	"""

	proposition = []
	for world in cogstate:
		if formulaIsTrue(world, formula):
			proposition.append(world[meta][name])
	return proposition
def updateFormula(cogstate, formula):
	"""
	INPUT: a pair (cognitive state, formula) where cognitive states
		are arrays of world objects and formulas are strings.
	OUTPUT: another cognitive state
	WHAT IT DOES: It should go through each world and call a function
		that checks whether the formula is true at each world. If it
		isn't, mark it as not being in FS; do nothing otherwise.
	"""
	newstate = []
	if formulaIsConsistent(cogstate, formula):
		for world in cogstate:
			if not formulaIsTrue(world, formula):
				world[meta][FS] = False
			newstate.append(world)
	else:
		newstate = destroyAllWorlds(cogstate)
	return newstate
def updateLaw(cogstate, law):
	"""
	INPUT: a pair (cognitive state, law) where cognitive states
		are arrays of world objects and the law is a string
	OUTPUT: another cognitive state
	WHAT IT DOES: Should go through each world and call a function
		that checks whether the formula is true at each world,
		and if it is do nothing, else mark it as not being in
		US or FS.
	"""
	newstate = []
	if formulaIsConsistent(cogstate, law):
		for world in cogstate:
			if not formulaIsTrue(world, law):
				world[meta][FS] = False
				world[meta][US] = False
			newstate.append(world)
	else:
		newstate = destroyAllWorlds(cogstate)
	return newstate