Threshold logic and its applications