Logical gates defined as simple functions