What is the difference between the logical operators NOT, AND and OR? [duplicate]

0

I'm studying Boolean algebra and Logical Ports, and I know that these logical operators and logic gates are used in digital systems, programming, and electronics. The 3 main operators of Boolean algebra are the NOT, AND, and OR operators.

What is the difference between the logical operators NOT, AND and OR? And what is the difference between Logical Ports?

    
asked by anonymous 29.06.2016 / 19:04

2 answers

6

From Wikipedia:

Logical operators

  

AND, NAND, OR, XOR and NOT are the main logical operators, the basis for the construction of digital systems and the propositional Logic, and also widely used in programming language. The AND, NAND, OR and XOR operators are binary operators, that is, they need two elements, whereas NOT is unary. In computing, these elements are usually binary variables, whose possible values are 0 or 1. However, the logic used for these variables also serves sentences (sentences) of human language, where if this is true corresponds to value 1, and if for false is 0.

  • AND

    Logical operator in which the operation response is true (1) if both input variables are true.

    x1  x2  x1 AND x2   
    0   0   0   
    0   1   0   
    1   0   0   
    1   1   1   
    
  • NAND

    Logical operator in which the operation response is true (1) if at least one of the variables is false.

    x1  x2  x1 NAND x2  
    0   0   1   
    0   1   1   
    1   0   1   
    1   1   0   
    
  • OR

    Logical operator in which the operation response is true (1) if at least one of the input variables is true.

    x1  x2  x1 OR x2    
    0   0   0   
    0   1   1   
    1   0   1   
    1   1   1   
    
  • XOR

    Logical operator in which the operation response is true (1) when the variables take different values from each other.

    x1  x2  x1 XOR x2   
    0   0   0   
    0   1   1   
    1   0   1   
    1   1   0   
    
  • NOT

    Logical operator representing the negation (inverse) of the current variable. If it is true, it becomes false, and vice versa

    x1  NOT x1  
    0   1   
    1   0   
    

Source: link

Logical port

I think this subject off-topic, because even if it has some context similar to programming, I still do not know if it is totally comprehensive, although algorithm doubts are accepted, but the doubt is not about a specific algorithm , even so just to chant the difference:

  

Logical ports or logic circuits are devices that operate one or more input logic signals to produce one and only one output, depending on the function implemented in the circuit. They are usually used in electronic circuits, because of the situations that the signals of this type of circuit can present: presence of signal, or "1"; and no signal, or "0". The "Truth" and "False" situations are studied in Boole's Logic or Mathematical Logic; origin of the name of these ports. The behavior of the logic gates is known by the truth table that shows the logic states of the inputs and the outputs.

  • AND

    ENTRADASAÍDAABAANDB000010100111
  • OR

    ENTRADASAÍDAABAORB000011101111
  • NOT

    ENTRADASAÍDAANOTA0110
  • NAND

    ENTRADASAÍDAABANANDB001011101110
  • NOR

    ENTRADASAÍDAABANORB001010100110
  • XOR

    ENTRADASAÍDAABAXORB000011101110
  • XNOR

    ENTRADA SAÍDA
    A   B   A XNOR B
    0   0   1
    0   1   0
    1   0   0
    1   1   1
    

    
29.06.2016 / 19:26
2

The difference is in the conditions of true, AND (E) returns true if the two inputs are true, OR (OR) returns true if at least one of the inputs is true (one OR another), NOT simply reverses the result, that is, if the input is true it returns false and vice versa.

When dealing with logic gates, the ports will handle the input bytes, for example (Execute the code to visualize better):

AND
<table>
  <tr>
    <td>ENTRADA 1</td>
    <td>ENTRADA 2</td>
    <td>RESULTADO</td>
  </tr>
  <tr>
    <td>1 (verdadeiro)</td>
    <td>1 (verdadeiro)</td>
    <td>1 (verdadeiro)</td>
  </tr>
   <tr>
    <td>1 (verdadeiro)</td>
    <td>0 (falso)</td>
    <td>0 (falso)</td>
  </tr>
   <tr>
    <td>0 (falso)</td>
    <td>0 (falso)</td>
    <td>0 (falso)</td>
  </tr>
  <tr>
    <td>0 (falso)</td>
    <td>1 (verdadeiro)</td>
    <td>0 (falso)</td>
  </tr>
  </table>
<br/>

OR
<table>
  <tr>
    <td>ENTRADA 1</td>
    <td>ENTRADA 2</td>
    <td>RESULTADO</td>
  </tr>
  <tr>
    <td>1 (verdadeiro)</td>
    <td>1 (verdadeiro)</td>
    <td>1 (verdadeiro)</td>
  </tr>
   <tr>
    <td>1 (verdadeiro)</td>
    <td>0 (falso)</td>
    <td>1 (verdadeiro)</td>
  </tr>
   <tr>
    <td>0 (falso)</td>
    <td>0 (falso)</td>
    <td>0 (falso)</td>
  </tr>
  <tr>
    <td>0 (falso)</td>
    <td>1 (verdadeiro)</td>
    <td>1 (verdadeiro)</td>
  </tr>
  </table>
<br/>
NOT
<table>
  <tr>
    <td>ENTRADA 1</td>
    <td>RESULTADO</td>
  </tr>
  <tr>
    <td>1 (verdadeiro)</td>
    <td>0 (falso)</td>
  </tr>
   <tr>
    <td>0 (falso)</td>
    <td>1 (verdadeiro)</td>
  </tr>
  </table>
  
  

With these ports you can do some others, the most common being NAND (which returns true if both entries are false) and XOR (or exclusive, which returns true if only one of the entries is true, if the two are returns false.)

    
29.06.2016 / 19:17