CNF Converter/DPLL.py
def extract_symbols(clauses):
	"""Function to extract only the symbols from each clause in a given input and
	   return a list of symbols for each input"""
	symbols=[]
	symbols_without_not=[]
	symbols_with_not=[]
	for i in range(len(clauses)):
		if is_positive_symbol(clauses[i]) and clauses[i] not in symbols:	# add symbol to list if symbol is positive and not already in list
			symbols.extend(clauses[i])
			symbols_without_not.extend(clauses[i])
		elif is_negative_symbol(clauses[i]) and clauses[i][1] not in symbols_with_not:	
			if clauses[i][1] not in symbols:				# add symbol to list if symbol is negative and not already in list
				symbols.extend(clauses[i][1]) 
			symbols_with_not.append(clauses[i][1])
		elif isinstance(clauses[i],list):		# if clause is a list, iterate through list and add the positive or negative symbols to list
			for j in range(1,len(clauses[i])):
				if is_positive_symbol(clauses[i][j]) and clauses[i][j] not in symbols:
					symbols.extend(clauses[i][j])
					symbols_without_not.extend(clauses[i][j])
				elif is_negative_symbol(clauses[i][j]) and clauses[i][j][1] not in symbols_with_not and clauses[i][j][1] not in symbols:
					if is_symbol(clauses[i][j][1]):
						symbols.extend(clauses[i][j][1])
						symbols_with_not.append(clauses[i][j][1])
					elif isinstance(clauses[i][j][1],list):
						symbols.extend(clauses[i][j][1])
						symbols_with_not.append(clauses[i][j][1])
					
	symbols_list=[]
	symbols_list.append(symbols_without_not)
	symbols_list.append(symbols_with_not)
	return symbols,symbols_list
Function to extract only the symbols from each clause in a given input and
	   return a list of symbols for each input
Function to extract only the symbols from each clause in a given input and
return a list of symbols for each input
Function to extract only the symbols from each clause in a given input and return a list of symbols for each input
def extract_symbols(clauses):
	symbols=[]
	symbols_without_not=[]
	symbols_with_not=[]
	for i in range(len(clauses)):
		if is_positive_symbol(clauses[i]) and clauses[i] not in symbols:	
			symbols.extend(clauses[i])
			symbols_without_not.extend(clauses[i])
		elif is_negative_symbol(clauses[i]) and clauses[i][1] not in symbols_with_not:	
			if clauses[i][1] not in symbols:				
				symbols.extend(clauses[i][1]) 
			symbols_with_not.append(clauses[i][1])
		elif isinstance(clauses[i],list):		
			for j in range(1,len(clauses[i])):
				if is_positive_symbol(clauses[i][j]) and clauses[i][j] not in symbols:
					symbols.extend(clauses[i][j])
					symbols_without_not.extend(clauses[i][j])
				elif is_negative_symbol(clauses[i][j]) and clauses[i][j][1] not in symbols_with_not and clauses[i][j][1] not in symbols:
					if is_symbol(clauses[i][j][1]):
						symbols.extend(clauses[i][j][1])
						symbols_with_not.append(clauses[i][j][1])
					elif isinstance(clauses[i][j][1],list):
						symbols.extend(clauses[i][j][1])
						symbols_with_not.append(clauses[i][j][1])
	symbols_list=[]
	symbols_list.append(symbols_without_not)
	symbols_list.append(symbols_with_not)
	return symbols,symbols_list
def extract_symbols ( clauses ) : symbols = [ ] symbols_without_not = [ ] symbols_with_not = [ ] for i in range ( len ( clauses ) ) : if is_positive_symbol ( clauses [ i ] ) and clauses [ i ] not in symbols : symbols . extend ( clauses [ i ] ) symbols_without_not . extend ( clauses [ i ] ) elif is_negative_symbol ( clauses [ i ] ) and clauses [ i ] [ 1 ] not in symbols_with_not : if clauses [ i ] [ 1 ] not in symbols : symbols . extend ( clauses [ i ] [ 1 ] ) symbols_with_not . append ( clauses [ i ] [ 1 ] ) elif isinstance ( clauses [ i ] , list ) : for j in range ( 1 , len ( clauses [ i ] ) ) : if is_positive_symbol ( clauses [ i ] [ j ] ) and clauses [ i ] [ j ] not in symbols : symbols . extend ( clauses [ i ] [ j ] ) symbols_without_not . extend ( clauses [ i ] [ j ] ) elif is_negative_symbol ( clauses [ i ] [ j ] ) and clauses [ i ] [ j ] [ 1 ] not in symbols_with_not and clauses [ i ] [ j ] [ 1 ] not in symbols : if is_symbol ( clauses [ i ] [ j ] [ 1 ] ) : symbols . extend ( clauses [ i ] [ j ] [ 1 ] ) symbols_with_not . append ( clauses [ i ] [ j ] [ 1 ] ) elif isinstance ( clauses [ i ] [ j ] [ 1 ] , list ) : symbols . extend ( clauses [ i ] [ j ] [ 1 ] ) symbols_with_not . append ( clauses [ i ] [ j ] [ 1 ] ) symbols_list = [ ] symbols_list . append ( symbols_without_not ) symbols_list . append ( symbols_with_not ) return symbols , symbols_list
Function to extract only the symbols from each clause in a given input and
return a list of symbols for each input
Function to extract only the symbols from each clause in a given input and return a list of symbols for each input
"""Function to extract only the symbols from each clause in a given input and
	   return a list of symbols for each input""" # add symbol to list if symbol is positive and not already in list
 # add symbol to list if symbol is negative and not already in list
 # if clause is a list, iterate through list and add the positive or negative symbols to list

clauses