logic explained