CNF Converter/CNFConverter.py
def eliminate_implication(input):
	""" Function to eliminate implications and to replace them with their not and or equivalents """
	if is_symbol(input):	# check if its a symbol then return as it is
		return input
	if input[0] in [AND, OR, NOT, IFF]:		# append the clauses to the output if the connective is not an implication
		return recursive_call(input,2)
	if input[0] == IMPLIES:		# input - ["implies","A","B"] then convert it to ["or", ["not","A"],"B"] 
		input[0] = OR
		input[1] = eliminate_implication([NOT,input[1]])
		input[2] = eliminate_implication(input[2])
		return input
 Function to eliminate implications and to replace them with their not and or equivalents 
Function to eliminate implications and to replace them with their not and or equivalents
Function to eliminate implications and to replace them with their not and or equivalents
def eliminate_implication(input):
	if is_symbol(input):	
		return input
	if input[0] in [AND, OR, NOT, IFF]:		
		return recursive_call(input,2)
	if input[0] == IMPLIES:		
		input[0] = OR
		input[1] = eliminate_implication([NOT,input[1]])
		input[2] = eliminate_implication(input[2])
		return input
def eliminate_implication ( input ) : if is_symbol ( input ) : return input if input [ 0 ] in [ AND , OR , NOT , IFF ] : return recursive_call ( input , 2 ) if input [ 0 ] == IMPLIES : input [ 0 ] = OR input [ 1 ] = eliminate_implication ( [ NOT , input [ 1 ] ] ) input [ 2 ] = eliminate_implication ( input [ 2 ] ) return input
Function to eliminate implications and to replace them with their not and or equivalents
Function to eliminate implications and to replace them with their not and or equivalents
""" Function to eliminate implications and to replace them with their not and or equivalents """ # check if its a symbol then return as it is
 # append the clauses to the output if the connective is not an implication
 # input - ["implies","A","B"] then convert it to ["or", ["not","A"],"B"] 

input