From ff7f1eb4b584b7acd14cde754392ee525e82362c Mon Sep 17 00:00:00 2001
From: Samuel-Lubliner
Date: Sun, 5 Jan 2025 21:32:46 +0000
Subject: [PATCH] revise logic gates
---
.../logic-gates/sec-combined-logic-gates.ptx | 6 +-
source/logic-gates/sec-intro-logic-gates.ptx | 92 +++++++++----------
.../logic-gates/sec-logic-gates-in-action.ptx | 6 +-
3 files changed, 48 insertions(+), 56 deletions(-)
diff --git a/source/logic-gates/sec-combined-logic-gates.ptx b/source/logic-gates/sec-combined-logic-gates.ptx
index c6db8c9..eccf49a 100644
--- a/source/logic-gates/sec-combined-logic-gates.ptx
+++ b/source/logic-gates/sec-combined-logic-gates.ptx
@@ -5,11 +5,7 @@
Logic gates can be combined to create more complex circuits that perform specific tasks. By linking gates together, we can create circuits that process multiple inputs to produce a desired output. For example, combining an AND gate and a NOT gate results in a NAND gate, which inverts the output of the AND gate. More complex circuits, such as half-adders and multiplexers, are built by combining basic gates in strategic ways.
- Let's look at a circuit:
-
-
-
- We will evaluate this circuit by setting True for X, Y, and False for Z below using Sage.
+ Let's look at a circuit. We evaluate this circuit by setting True for X, Y, and False for Z below using Sage.
diff --git a/source/logic-gates/sec-intro-logic-gates.ptx b/source/logic-gates/sec-intro-logic-gates.ptx
index c53442a..9973d24 100644
--- a/source/logic-gates/sec-intro-logic-gates.ptx
+++ b/source/logic-gates/sec-intro-logic-gates.ptx
@@ -1,30 +1,30 @@
-
- Basic Logic Gates
-
- logic gates
- AND
- OR
- NOT
- NAND
- NOR
- XOR
- XNOR
-
+ Logic Gates
+
+ logic gates
+ AND
+ OR
+ NOT
+ NAND
+ NOR
+ XOR
+ XNOR
+
+
- Logic gates are the foundation of digital circuits. They process binary inputs (0s and 1s) to produce specific outputs, defined by truth tables. The basic logic gates are AND, OR, and NOT which correspond to the logical operators reviewed in previous sections. Other commonly used gates as NAND, NOR, XOR, and XNOR are composites of the basic ones. Each gate has its own symbol and truth table representing outputs for all combinations of inputs. These gates combine to form complex systems such as CPUs and memory circuits.
+ Logic gates are the foundation of digital circuits. They process binary inputs to produce specific outputs. The basic logic gates are AND, OR, and NOT. Derived gates include NAND, NOR, XOR, and XNOR. Each gate has its own symbol and behavior defined by a truth table.
-
-
-
-
+
+
+
+ AND Gate
- The AND gate produces a 1 only when both inputs are 1.
+ The AND gate produces a 1 only when both inputs are 1.
The NOT gate inverts the input: 1 becomes 0, and 0 becomes 1.
@@ -126,10 +128,9 @@
print(f"{int(A)} | {int(bool(Not(A)))}")
-
-
-
-
Derived Gates
+
+
+ NAND Gate
NAND: Produces 0 only when both inputs are 1.
NAND Gate
@@ -141,14 +142,10 @@
+
-
-
+
+ NOR Gate
NOR: Produces 1 only when both inputs are 0.
NOR Gate
@@ -160,7 +157,10 @@
+
+
+ XOR Gate
XOR: Produces 1 when inputs differ.
XOR Gate
@@ -172,7 +172,10 @@
+
+
+ XNOR Gate
XNOR: Produces 1 when inputs are the same.
XNOR Gate
@@ -184,8 +187,7 @@
-
-
+
from sympy.logic.boolalg import And, Or, Not, Xor
@@ -222,10 +224,6 @@
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
diff --git a/source/logic-gates/sec-logic-gates-in-action.ptx b/source/logic-gates/sec-logic-gates-in-action.ptx
index de71055..7f37e55 100644
--- a/source/logic-gates/sec-logic-gates-in-action.ptx
+++ b/source/logic-gates/sec-logic-gates-in-action.ptx
@@ -2,7 +2,7 @@
Logic Gates in Action
- Voting systems are fundamental in decision-making processes, from simple classroom polls to national elections. In this section, we’ll use logic gates to build a simple digital voting machine. The machine will count binary votes (Yes = 1, No = 0) and determine the majority outcome. We’ll break the system into smaller functions, each implemented using logic gates, and then combine them to form the complete voting machine.
+ Voting systems are fundamental in decision-making processes like national elections. In this section, we use logic gates to build a simple digital voting machine. The machine will count binary votes and determine the majority outcome. We break the system into smaller functions, each implemented using logic gates, and then combine them to form the complete voting machine.
@@ -61,9 +61,7 @@
Majority Decider
The majority decider uses logic gates to determine whether "Yes" votes are greater than "No" votes. For three votes, the logic can be expressed as:
-
- Majority = (V1 AND V2) OR (V2 AND V3) OR (V1 AND V3)
-
+ Majority = (V1 AND V2) OR (V2 AND V3) OR (V1 AND V3)
This formula ensures that if at least two out of three votes are "Yes," the output will indicate a majority.