CNF Converter/DPLL.py
def find_unit_clause(clauses, model):
	""" Function to find a unit clause and its value if it is present only as a symbol and not in a list"""
	print clauses
	for i in range(len(clauses)):
		count = 0
		literals,literal_list = extract_symbols(clauses[i])
		for j in range(len(literal_list[0])):
			if literal_list[0][j] not in model:
				count += 1
				P, value = literal_list[0][j], "'true'"
		for j in range(len(literal_list[1])):
			if literal_list[1][j] not in model:
				count += 1
				P, value = literal_list[1][j], "'false'"
		if count == 1:
			return P, value
	return None, None
 Function to find a unit clause and its value if it is present only as a symbol and not in a list
Function to find a unit clause and its value if it is present only as a symbol and not in a list
Function to find a unit clause and its value if it is present only as a symbol and not in a list
def find_unit_clause(clauses, model):
	print clauses
	for i in range(len(clauses)):
		count = 0
		literals,literal_list = extract_symbols(clauses[i])
		for j in range(len(literal_list[0])):
			if literal_list[0][j] not in model:
				count += 1
				P, value = literal_list[0][j], "'true'"
		for j in range(len(literal_list[1])):
			if literal_list[1][j] not in model:
				count += 1
				P, value = literal_list[1][j], "'false'"
		if count == 1:
			return P, value
	return None, None
def find_unit_clause ( clauses , model ) : print clauses for i in range ( len ( clauses ) ) : count = 0 literals , literal_list = extract_symbols ( clauses [ i ] ) for j in range ( len ( literal_list [ 0 ] ) ) : if literal_list [ 0 ] [ j ] not in model : count += 1 P , value = literal_list [ 0 ] [ j ] , "'true'" for j in range ( len ( literal_list [ 1 ] ) ) : if literal_list [ 1 ] [ j ] not in model : count += 1 P , value = literal_list [ 1 ] [ j ] , "'false'" if count == 1 : return P , value return None , None
Function to find a unit clause and its value if it is present only as a symbol and not in a list
Function to find a unit clause and its value if it is present only as a symbol and not in a list
""" Function to find a unit clause and its value if it is present only as a symbol and not in a list"""
clauses
model