A Mathematical Framework for the Problem of Security for Cognition in Neurotechnology