CNF Converter/DPLL.py
def pl_true(clause, model={}):
	""" Function to find if every clause in a given input is True or False """
	if clause == "TRUE":
		return True
	elif clause == "FALSE":
		return False
	elif clause[0] == NOT:
		value = pl_true(clause[1], model)
		if value is None:
			return None
		else:
			return not value
	elif clause[0] == OR:
		result = False
		for i in range(1,len(clause)):
			value = pl_true(clause[i], model)
			if value is True:
				return True
			if value is None:
				result = None
		return result
	elif clause[0] == AND:
		result = True
		for i in range(1,len(clause)):
			value = pl_true(clause[i], model)
			if value is False:
				return False
			if value is None:
				result = None
		return result
	else:
		return model.get(clause)
 Function to find if every clause in a given input is True or False 
Function to find if every clause in a given input is True or False
Function to find if every clause in a given input is True or False
def pl_true(clause, model={}):
	if clause == "TRUE":
		return True
	elif clause == "FALSE":
		return False
	elif clause[0] == NOT:
		value = pl_true(clause[1], model)
		if value is None:
			return None
		else:
			return not value
	elif clause[0] == OR:
		result = False
		for i in range(1,len(clause)):
			value = pl_true(clause[i], model)
			if value is True:
				return True
			if value is None:
				result = None
		return result
	elif clause[0] == AND:
		result = True
		for i in range(1,len(clause)):
			value = pl_true(clause[i], model)
			if value is False:
				return False
			if value is None:
				result = None
		return result
	else:
		return model.get(clause)
def pl_true ( clause , model = { } ) : if clause == "TRUE" : return True elif clause == "FALSE" : return False elif clause [ 0 ] == NOT : value = pl_true ( clause [ 1 ] , model ) if value is None : return None else : return not value elif clause [ 0 ] == OR : result = False for i in range ( 1 , len ( clause ) ) : value = pl_true ( clause [ i ] , model ) if value is True : return True if value is None : result = None return result elif clause [ 0 ] == AND : result = True for i in range ( 1 , len ( clause ) ) : value = pl_true ( clause [ i ] , model ) if value is False : return False if value is None : result = None return result else : return model . get ( clause )
Function to find if every clause in a given input is True or False
Function to find if every clause in a given input is True or False
""" Function to find if every clause in a given input is True or False """
clause
model