1. A method implemented in a computer system comprising a processor, comprising: determining, by the processor, that a Boolean function satisfies one or more predefined conditions for being a threshold function, the one or more predefined conditions comprising a condition that both a positive cofactor and a negative cofactor of the Boolean function are threshold functions; determining, by the processor, that weights for the positive cofactor are equal to weights for the negative cofactor, the weights for the positive cofactor being weights that together with a threshold value for the positive cofactor define a threshold function that corresponds to the positive cofactor and the weights for the negative cofactor being weights that together with a threshold value for the negative cofactor define a threshold function that corresponds to the negative cofactor; identifying, by the processor, the Boolean function as a threshold function in response to determining that the Boolean function satisfies the one or more predefined conditions for being a threshold function and determining that the weights for the positive cofactor are equal to the weights for the negative cofactor; and determining, by the processor, weights and a threshold value that characterize a threshold logic gate that implements the threshold function corresponding to the Boolean function based on the weights and the threshold values for the positive cofactor and the negative cofactor.