A ternary neural code resolves error and sharpening signals