The ability of the human brain to carry out logical reasoning can be interpreted, in general, as a by-product of adaptive capacities of complex neural networks. Thus, we seek to base abstract logical operations in the general properties of neural networks designed as learning modules. We show that logical operations executable by McCulloch-Pitts binary networks can also be programmed in analog neural networks built with associative memory modules that process inputs as logical gates. These modules can interact among themselves to generate dynamical systems that extend the repertoire of logical operations. We demonstrate how the operations of the exclusive-OR or the implication appear as outputs of these interacting modules. In particular, we provide a model of the exclusive-OR that succeeds in evaluating an odd number of options (the exclusive-OR of classical logic fails in his case), thus paving the way for a more reasonable biological model of this important logical operator. We propose that a brain trained to compute can associate a complex logical operation to an orderly structured but temporary contingent episode by establishing a codified association among memory modules. This explanation offers an interpretation of complex logical processes (eventually learned) as associations of contingent events in memorized episodes. We suggest, as an example, a cognitive model that describes these "logical episodes".