Logic is not only a tool of thinking but it reflects the actual motion in nature and society. There are two kinds of logic - mechanical logic and dialectical logic. The first one relates to the external motion of large bodies and the second one relates to both internal and external, i.e. actual motion.
Non-revolutionary "Marxists" no matter what they say about themselves use only formal mechanical mode of logic whenever they are tasked with expressing revolutionary positions. Mechanical logic uses Newtonian laws of mechanics. The three basic laws describing the motion of material bodies under the action of forces applied to them:
First law: if no forces act on a material point (or if the forces applied to it are in equilibrium), then relative to an inertial reference system the material point is in a state of rest or uniform rectilinear motion.
Second law: If a force FF acts on a material point, then relative to an inertial reference system the point undergoes an acceleration such that its product with the mass mm of the point is equal to FF: ma=F.
Third law: Two material points act on each other with forces that are equal in absolute value but opposite in direction along the line joining the two points.
Newton's laws of mechanics are based on the notion that object A is always A and not B. However, even scientists who use Newton’s laws have to admit that they cease to be valid for motions of objects of very small dimension (elementary particles). Since large bodies are made of elementary elements everything is in motion and not only because of an external force but because of internal motion caused by internal contradictions. For this reason A in the real word is in the process of becoming B.
To give an example: the Stalinist Soviet Union collapsed because of the external pressure of the armed race and because of the bureaucratic relations of production blocked any further development of the forces of production already in the 1970s.
It is possible in simple cases, when two very similar states fight each other to reach a correct revolutionary position by using formal logic. For example, WWI when the correct revolutionary position was a revolutionary defeat for all the imperialists and, hence, in each imperialist state the main enemy of the working class was the national capitalist class.
However, there are many wars where formal logic is not sufficient and without dialectical logic it is easy to fall into a wrong position. For example the Iran-Iraq war in the 1980s. Since both states are semi-colonies, using formal logic leads to the position of revolutionary defeat for both. However Between 1979 and June 1981, Iran had a sharp internal struggle. In January 1980 Abolhassan Banisadr became the president of Iran and he clashed with the theocratic Islamic Republic Party. The guerrilla group People's Mujahedin of Iran (MEK) also opposed the IRP.
On 28 June 1981, a bombing of the office of the IRP killed around 70 high-ranking officials, cabinet members and members of parliament, including Mohammad Beheshti, the secretary-general of the party and head of the Islamic Republic's judicial system. The government responded with thousands of arrests and hundreds of executions. The uprising and armed struggle against the Khomeinists was crushed and the Ayatollas further consolidated their power. Thus, until then it was necessary to defend Iran but after the Ayatollas consolidated their power, it was time for revolutionary defeatism on both sides. 
Another example is the military clash between Fatah and Hamas in Gaza in 2006. Formal logic leads to the conclusion of opposing both reactionary sides. Some centrists even thought that since Hamas is Islamist and Fatah is secular it was necessary to support Fatah. In sharp contrast, using dialectical modes of thinking led to the position of revolutionary defense of Hamas. It was based on the fact that Israel was behind Fatah’s attack on Hamas after losing the 2005 elections. Those centrists like Alan Woods’ IMT who refused to defend Hamas because it is an Islamist organization reflected the Islamophobia of the imperialists.
Using the logic of dialectics, resulting from careful observation of motion and interaction of different forces of nature and society, began already in ancient Greece. Socrates already referred to the laws of dialectics:
"After being told that dialectic is a systematic way of discerning the essence of things, Glaucon asks for a fuller description of its nature, forms, and method" (Republic 532d-e). Heraclitus 500 years BC said "No man ever steps in the same river twice, for it's not the same river and he's not the same man."
As any Marxist knows, the laws of dialectics were already worked out in detail by Hegel. However, they appear in a mystified, idealist form in whose writings. Marx and Engels who were Hegel’s students gave dialectics its materialist basis.
Trotsky in the ABC of materialist dialectics wrote: "We call our dialectic materialist, since its roots are neither in heaven nor in the depths of our "free will", but in objective reality, in nature. Consciousness grew out of the unconscious, psychology out of physiology, the organic world out of the inorganic, the solar system out of the nebulae. Marx, who in distinction from Darwin was a conscious dialectician, discovered a basis for the scientific classification of human societies in the development of their productive forces and the structure of the relations of ownership which constitute the anatomy of society.”
Engels defines dialectics as "the science of the general laws of motion and development of nature, human society and thought." In Anti-Dühring and The Dialectics of Nature, Engels explained the laws of dialectics, beginning with the three most fundamental ones:
1) The law of the transformation of quantity into quality and vice versa;
2) The law of the interpenetration of opposites, and
3) The law of the negation of the negation.
These three laws are not the only laws of dialectics, but only the most important ones. Lenin in summary of Dialectics recognized 16 laws of Dialectics. In this article we will explain the three fundamental laws of dialectics.
Quantity and Quality
This law manifested in nature. For example, water boiling in 100c can no longer be called water, but steam, and under 0c it would not be called water but ice. The motion includes at certain point of the developing contradictions sudden and explosive periods in which, accumulated changes (quantitative change) undergoes a rapid acceleration, in which quantity is transformed into quality.
This law manifests itself in society when we observe the way capitalist society replaced feudal society and slave society was transformed into a feudal society. It explains how the growing contradiction of Tsarist Russia exploded in the Russian revolution.
Trotsky in the ABC of materialist dialectics wrote:
“Every individual is a dialectician to some extent or other, in most cases, unconsciously. A housewife knows that a certain amount of salt flavors soup agreeably, but that added salt makes the soup unpalatable.”
To use the dialectical method it is necessary to understand phase transitions when one phenomenon is changing to another. Using the example of water, the phase of transition is the period of the changes from solid to liquid or from liquid to gas. At a certain point, the growing contradictions of a phenomenon cause a qualitative leap.
This explains how inorganic matter changed into organic matter and how open revolutionary uprisings explode at certain points of long periods of struggle against exploitation and oppression. This critical point in the process of the revolution in Russia was reached already in September 1917, as Lenin understood, and if Lenin was not alive, the Russian revolution would have failed and been crushed.
While according to formal logic the whole is equal to the sum of its parts, in reality the whole is greater than the sums of its parts. An army is not simply the sum total of individual soldiers. It is a massive force that transforms the individual soldier physically and psychologically. The same is true for a revolutionary party that transforms the individual members into a great force that at a certain point in the revolutionary process can lead the transformation of society.
The Unity of Opposites
People who use dialectical logic proceed from the standpoint that everything develops by means of a struggle of opposites; that the whole is made from contradicting parts; that capitalism develops in virtue of the contradiction between the social character of production and the private means of appropriation. The engine of social evolution is the struggle between the working class and the oppressed against the capitalist ruling class.
The negation of negation
If the law of the unity and struggle of opposites discloses the source of development, and the law of the transition of quantitative changes into qualitative changes reveals the mechanism of development, the law of the negation of the negation expresses the direction, form, and result of development.
The effect of the law of the negation of the negation is fully revealed only in an integral, relatively complete process of development through a chain of interconnected transitions, when it is possible to specify a more or less finished result of the process.
At each particular stage, the law of the negation of the negation is usually revealed only as a tendency. Every phenomenon is negated and the new phenomena that replace it will be negated and the former phenomenon will replace it, but on higher level. This law is the basis of our understanding that classless primitive communism was replaced by class society some 13,000 years ago, but modern communism will replace class society but on a higher level than primitive communism.