# Logic Gates

In this post I am to discuss the ins and outs of logic gates, but before I start, let me recommend to all of you a pair of links about fracking, which is a technique that, far from being based on renewable energy (you know? you can find references to gas utilization as far back as millenniums in some old-well-known-books of which I will not recommend any (or either I recommend you all), letting all of you to plunge into remote ancient times to find etymology and references for that),it is much more yet another way to drill the Earth’s foundations…

http://www.onegreenplanet.org/environment/countries-except-united-states-that-have-banned-fracking/

http://www.chron.com/business/article/List-of-places-than-ban-fracking-keeps-growing-6057266.php

In brief, this technique injects water into subsoil to create ‘controlled’ explosions which generate heat, and pushes the fraction of gases in the area through a drilling which leads to a chamber where the product of the explosions will be used in order to obtain the desired result, gas, in this case (none of alternate, renewable energies, as far as I know…) and also other undesired products such as earthquakes, for instance…

And once I have told you this, let’s plunge into logic gates, but first…

Well… leaving all this nonsense apart…

Logic gates are a type of electronic devices which can simulate analogical ones. They are more economical, because they can be manufactured in series and can also be miniaturized for their implementation in lots of apparatuses such as mobile phones, tablets, or other types of microchip | IC (stands for Integrated Circuit) fed technologies.

Putting apart their factual physical constitution, I will explain here the basics of their maths, and the first thing you must know to understand them is their symbols.

In the image above you have the logic gates and their truth tables. For each one of them there are two inputs and one output. Inputs values are represented on the columns whose headers are A, and B.

In logic you only have two possible values (I do not include here the trivalued logics, which in computer science provide run time errors when a ‘null’ return value comes with a non-controlled (initial value) not-1 or not-0, rendering any other value enclosed in the topology for the data type possible values, for the sake of clarity), so

either yes, high, 1,

or no, low, 0.

The third column in each truth table for the logic gates, gives the result, which depends of the logic gate considered.

I’ll explain one by one. So let’s start with AND gate.

The AND gate is on the right top corner of the above image, it looks like a capital D and has two lines on its left, which are the inputs, and one line on its right, which is the output.

On the right of its symbol there is a truth table. As we are considering two inputs, and only two values are possible, this renders a four row set of situations:

A = 0 , B = 0 in an AND gate gives a zero as output.

A = 1 , B = 0 0

A = 0, B = 1 0

A = 1, B = 1 1

This results are so, because the AND gate is mathematically equivalent to multiplying the values of the inputs, so whenever there is a zero, the result turns into a zero. So it only lets the function (algorithm) pass, when the two inputs are in high state (1,1).

The OR logic gate is right below the AND gate in the image above, looks a bit like a tragedy and comedy mask laying flat horizontally, without eyes nor mouth, and has also two lines on the left, and one line on the right, as is the case for the rest of gates (but the NOT gate) represented in the image.

The truth table has a different output, this is because for OR gates, the mathematical equivalent is an addition, so it renders a high whenever there is a high on either input, or mathematically simplified, whenever the addition for input values is not zero it results in a no-zero value (that’s a high). So here you have 0, 1, 1, 2 (decimal, 1 for logic analysis in truth tables), as results of the addition of A, and B, input values.

You can also think of this as intersection and union Venn sets diagrams (they are so clear that they ended wiped out of the mathematics world for the sake of obscurity… two or three decades ago…).

##### ‘This example involves two sets, A and B, represented here as coloured circles. The orange circle, set A, represents all living creatures that are two-legged. The blue circle, set B, represents the living creatures that can fly. Each separate type of creature can be imagined as a point somewhere in the diagram. Living creatures that both can fly *and* have two legs—for example (nonsense… swans, and) parrots—are then in both sets, so they correspond to points in the area where the blue and orange circles overlap. That area contains all such and only such living creatures.

##### Humans and penguins are bipedal, and so are then in the orange circle

##### [I was to provide a link for a TV advertisement… just for the sake of providing yet another (nonsense) example of bipedal creatures which are supossed to be logically included in the orange circle below to clarify explanations in logic sets theories…, but unfortunately I didn’t find that, so I provide this another link to a TV program of the eighties, where the interviewer was this woman, the same woman who had made that ad in the nineties],

##### but since they cannot fly they appear in the left part of the orange circle, where it does not overlap with the blue circle. Mosquitoes have six legs, and fly, so the point for mosquitoes is in the part of the blue circle that does not overlap with the orange one. Creatures that are not two-legged and cannot fly (for example, whales and spiders) would all be represented by points outside both circles.

##### The combined area of sets A and B is called the *union* of A and B, denoted by A ∪ B. The union in this case contains all living creatures that are either two-legged or that can fly (or both).

##### The area in both A and B, where the two sets overlap, is called the *intersection* of A and B, denoted by A ∩ B. For example, the intersection of the two sets is not empty, because there *are* points that represent creatures that are in *both* the orange and blue circles.’ (slightly edited extract from) Venn’s diagrams full article in en.wikipedia

#### ‘Venn himself did not use the term “Venn diagram” and referred to his invention as “Eulerian Circles”. For example, in the opening sentence of his 1880 article Venn writes, “Schemes of diagrammatic representation have been so familiarly introduced into logical treatises during the last century or so, that many readers, even those who have made no professional study of logic, may be supposed to be acquainted with the general nature and object of such devices. Of these schemes one only, viz. that commonly called ‘Eulerian circles,’ has met with any general acceptance…” The first to use the term “Venn diagram” was Clarence Irving Lewis in 1918, in his book “A Survey of Symbolic Logic”.

#### Venn diagrams are very similar to Euler diagrams, which were invented by Leonhard Euler in the 18th century.’ en.wikipedia

AND gate is an intersection, and OR gate is a union.

And here comes NAND and NOR…

But first, there is the NOT gate. The NOT gate simply turns the input (output) into the other state, so you have a ‘one’, turned into ‘zero’, and a ‘zero’ turned into a ‘one’. Its symbol is on the top left corner of the logic gates image above. It is represented with an input and an output, looks like a triangle with a little bubble on the pointing angle.

And I’ll publish this post as it is now, and I’ll add the rest of the info in forthcoming updates later.

(Some hours afterwards…) [Well… you know?, it is not a narrative style… it is to make sense for newcomers… 🙂 ].

NAND is an AND gate with a NOT gate at the output, so you only need to take the AND gate third column (the one for the results) and swap ‘zeroes’ and ‘ones’.

The NOR gate follows the same mechanism, put a NOT at the output, and swap ‘zeroes’ and ‘ones’.

And the same goes for the EXNOR (exclusive NOR), take the EXOR (that is exactly the same as the XOR gate, but with a more clear naming protocol), and put a NOT, and there you are the swapping of the output values.

These gates I commented today are also represented in the logic gates image above, with their corresponding truth tables.

And I’ll write the implications of all these integrated circuiteries (at least the most relevant) in the next post, that I’ll write right away.