Cooperativity in a Chemomechanical Polymer: A Chemically Induced Macroscopic Logic Gate