Computer Science

Boolean Expressions

Boolean expressions are logical expressions that evaluate to either true or false. They are commonly used in programming and computer science to make decisions and control the flow of a program. Boolean expressions often involve the use of logical operators such as AND, OR, and NOT to compare values and conditions.

Written by Perlego with AI-assistance

8 Key excerpts on "Boolean Expressions"

Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.
  • Electronic Logic Circuits
    • J. Gibson(Author)
    • 2013(Publication Date)
    • Routledge
      (Publisher)

    ...Boolean algebra is similar but it is based on the arithmetic of logic values. In Boolean arithmetic numeric quantities may only have either of the two logic values true and false; these have already been given alternative names of 1 and 0. Instead of the four conventional arithmetical operations of add, subtract, multiply and divide the three Boolean operations of AND, OR and NOT are used. These operations have already been defined and are summarized in Table 2.10. Equivalence or identity symbols are used to indicate that terms on each side of a relationship arc identical. For example 1 + 0 = 1 indicates that 1 + 0 may be replaced by 1 as the result is identical; however it is also the case that 1 may be replaced by 1 + 0 (1 may also be replaced in many other ways). Each of the relationships in Table 2.10 may be shown to be correct by applying the definition of a particular Boolean operation. Table 2.10 Boolean arithmetic operations The relations in Table 2.10 indicate that the order of evaluating terms in a Boolean operation is not important, as indicated 0 + 1 ≡ 1 + 0 and 0.1 ≡ 1.0. Relationships involving a single Boolean operation may be extended to any number of terms; either directly from the definition of the Boolean operations, or by using identities in Table 2.10. For example using 1 ≡ 1 + 0 to replace the left hand 1 of 1 + 1 ≡ 1 by its equivalent 1 + 0 produces 1 + 0 + 1 ≡ 1. Extension to other cases is trivial and may be used to demonstrate that the order of terms in a Boolean operation has no effect; results such as the following are easily obtained These may also be derived by logical argument based on the fundamental definitions of the operators AND and OR. In more complex Boolean Expressions, that is those that involve more than one of the operators AND, OR and NOT, it is necessary to consider the order of evaluation...

  • Digital Design
    eBook - ePub

    Digital Design

    Basic Concepts and Principles

    • Mohammad A. Karim, Xinghao Chen(Authors)
    • 2017(Publication Date)
    • CRC Press
      (Publisher)

    ...2 Boolean Algebra 2.1 Introduction Design of digital circuits is typically approached from an understanding of mathematical formalism pertinent to binary systems. This particular formalism is commonly known as Boolean algebra. Claude Shannon proposed this particular algebra, by extending the works of algebra of logic that was initially devised by George Boole, for analyzing and designing discrete binary systems. Boolean algebra is a mathematical system that defines three primary logical operations: AND, OR, and NOT, on sets of binary logical variables. Boole had used his algebraic manipulations for describing the logical relationships of natural language. This reference to natural language is very relevant here since we are also interested in translating a word statement of the function of the desired digital system to a mathematical description. Boolean algebra serves as the basis for moving from a verbal description of the logical function to an unambiguous mathematical description. This unambiguous representation allows us to design logic circuits using a given library of logic components. Boolean algebra is finite but richer in scope than the ordinary algebra and, accordingly, it leads to simpler optimization schemes. Complex logical functions can be simplified using Boolean algebraic rules. Correspondingly, the design process leads to logic circuits that are both simplified and inexpensive. The properties of Boolean algebra need to be understood first before we could learn to design digital systems efficiently. This chapter will acquaint you with Boolean algebra and provide necessary tools for handling complex logical functions. 2.2 Logic Operations The logic functions introduced here are the allowed operations in Boolean algebra, which is explored later in Section 2.4. An understanding of these logic operations is vital since they are used in translating a word statement of a logical problem to a digital logic network...

  • Bowtie Methodology
    eBook - ePub

    Bowtie Methodology

    A Guide for Practitioners

    • Sasho Andonov(Author)
    • 2017(Publication Date)
    • CRC Press
      (Publisher)

    ...4 Boolean Algebra 4.1    Introduction Logic has been established as the science of thought, reasoning, and thinking, since the age of Ancient Greece. Aristotle was one of the first to dedicate his work to the logical thinking. In the middle of the nineteenth century, the British mathematician George Boole published a book with long name, but known today only as “The Laws of Thought.” He was the first mathematician who tried to establish a systematic way in dealing with principles of logic and correct reasoning. That is the reason why the mathematical area of dealing with the quantification of logic operations is named (in his honor) Boolean algebra. The Boolean algebra is actually a deductive mathematical system known as the algebra of logic and reasoning, and it had a dramatic influence to the computer development in the twentieth century. Even today, all processors use the Boolean algebra to conduct logic operations and calculate mathematical expressions. Having in mind that Boole quantified the sentences (expressions) by their value (are they “true” or “false”), he used the binary numerical system to calculate their combinations. Later, this was accepted by computer engineers because the “true” could be expressed as 1 (current is flowing or voltage is present) and “false” could be expressed as 0 (current is not flowing or voltage is not present). The contribution of Boole is also important for the connection of probability with logic. It was a normal development of logic, using the probability of previous events to calculate the probability of future events. So, the Boolean algebra deals with logic and probability, and it uses the binary numerical system. Actually, using 0 and 1 is not so simple. As I have mentioned earlier, the situation “1” (current is flowing) and “0” (current is not flowing) can be counted as switches. Switch in position ON means 1 (current is flowing) and switch in position OFF means 0 (current is not flowing)...

  • Hack Audio
    eBook - ePub

    Hack Audio

    An Introduction to Computer Programming and Digital Signal Processing in MATLAB

    • Eric Tarr(Author)
    • 2018(Publication Date)
    • Routledge
      (Publisher)

    ...Chapter 5 Logicals and Control Structures in Programming Conditional Statements, Loops, and Functions 5.1 Introduction: Controlling the Flow of Execution When a computer program is run, the commands are executed in a particular order. As discussed in Chapter 4, the order is usually top to bottom, left to right for the commands in a script. This does not always need to be the case, as a programmer can instruct the computer to follow a different order. Many programming languages, including MATLAB, include designated keywords to change the order of executed commands. These parts of a programming language are called control structures. Additional documentation related to this chapter can be found on the MathWorks website under Control Flow. For the various control structures, the MATLAB programming language makes use of a special data type called a logical. In this chapter, background information is introduced about logicals first, and then it is put to use with control structures. 5.2 Logical Data Type Logicals are a different data type than numbers (Section 2.5.1) and text (Section 2.5.2). They are a data type that can only have a value of either TRUE or FALSE. Because there are only two possible values, MATLAB designates logicals as a specific data type. Values of logicals can be 1, 0, true, or false. Other names used in computer programming for a logical are a boolean or a bool. These names are a reference to the mathematician George Boole, who developed the algebraic system of logic used in computer programming. 5.2.1 Logical Operations Besides executing mathematical operations, MATLAB (and other programming languages) can execute logical operations. A logical operation can be used to determine if an expression is TRUE or FALSE. By convention, when MATLAB executes a logical expression, the result is the value 1 when TRUE and the value 0 when FALSE. There are several logical operations available in MATLAB. Operator symbols and descriptions are shown in Table 5.1...

  • Introduction to Digital Electronics

    ...1 Fundamentals 1.1 INTRODUCTION This chapter introduces the essential information required for the rest of the book. This includes a description of Boolean algebra, the mathematical language of digital electronics, and the logic gates used to implement Boolean functions. Also covered are the ‘tools’ of digital electronics such as truth tables, timing diagrams and circuit diagrams. Finally, certain concepts such as duality, positive and negative assertion level logic and universal gates, that will be used in later chapters, are introduced. 1.2 BASIC PRINCIPLES 1.2.1 Boolean algebra - an introduction The algebra of a number system basically describes how to perform arithmetic using the operators of the system acting upon the system’s variables which can take any of the allowed values within that system. Boolean algebra describes the arithmetic of a two-state system and is therefore the mathematical language of digital electronics. The variables in Boolean algebra are represented as symbols (e.g. A, B, C, X, Y etc.) which indicate the state (e.g. voltage in a circuit). In this book this state will be either 0 or 1. 1 Boolean algebra has only three operators: NOT, AND and OR. The symbols representing these operations, their usage and how they are used verbally are all shown in Table 1.1. Note that whereas the AND 2 and OR operators operate on two or more variables the NOT operator works on a single variable. Table 1.1 Boolean variables and operators Example 1.1 A circuit contains two variables (i.e. signals), X and Y, which must be OR’d together. How would this operation be shown using Boolean algebra, and how would you describe it verbally? Solution The operation would be spoken as X or Y and written as X + Y. Example 1.2 The output Y of a logic circuit with two inputs, A and B, is given by the Boolean arithmetic expression,...

  • Digital Logic Techniques
    • John Stonham(Author)
    • 2017(Publication Date)
    • CRC Press
      (Publisher)

    ...It is, however, of great practical importance as it provides a quick and simple method of determining equality between complex logic systems. Boolean algebra provides a mathematical foundation for binary information processing. It can be used to describe complex operations, prove identities and simplify logic systems. In practice, however, Boolean algebra is of limited value to the engineer. The success of a minimization or a proof of an identity depends largely on the person’s expertise, and success cannot be guaranteed. If we take two logic systems where one is considerably more complex than the other, it is important to know whether they perform the same process. If they do, then the engineer would always choose the simpler system. Boolean algebra can be used to establish identities; however, if two systems cannot be proved equivalent by algebra, the result is inconclusive. Either the systems are not equivalent or the engineer’s algebra is inadequate. A better, more reliable method of demonstrating equivalence between two systems is to generate their respective truth tables. If two or more systems have identical truth tables, then they perform the same function. Worked Example 2.9 If F 1 = A (A + B ¯) + BC (A ¯ + B) + B ¯ (A ⊕ C) and F 2 = A + C determine whether F 1 = F 2 by means of truth tables. Solution F 1 is a function of A, B and C. F 2 can be considered a function of A, B and C with its output independent of B. Truth tables are Remember A⊕C is the EX.OR function and equal to A. C ¯ + A ¯. C. If the output cannot be calculated directly from the Boolean equations and the input values, evaluate any necessary intermediate terms first. By comparing the output columns, we can see that F 1 and F 2 always have the same value for each and every output. Hence F 1 = F 2. Exercise 2.2 Use Boolean algebra to determine whether or not the following functions are...

  • Digital Logic Design
    • Brian Holdsworth, Clive Woods(Authors)
    • 2002(Publication Date)
    • Newnes
      (Publisher)

    ...Initially, the algebra was used in the design of relay networks. More recently switching circuits were implemented using discrete components but rapid technological advances have seen the introduction of MSI, LSI and VLSI devices and because of the sophisticated and versatile nature of these components there have been significant changes in the design techniques used by engineers. In spite of these changes it is still essential for engineers to have a good working knowledge of traditional switching theory. 2.2 Boolean algebra Any mathematical system has a minimal set of basic definitions which are assumed to be true and from which all information about the system may be determined. In the case of Boolean Algebra the three basic definitions are: NOT. The NOT of a variable is 1 if, and only if, the variable itself is 0 and vice versa. NOT A is written as Ā. Thus if A = 0, then Ā = 1 and if A = 1 then Ā = 0. Since A has only two possible values it follows that Ā = A. To refer to both A and Ā which define the opposite values of the same variable, the term literal is used, where a literal is defined as a variable with or without a complement bar. AND. The AND of two variables is 1 if, and only if, both the variables are 1. AND is written as A AND B or as A·B or alternatively as AB. Thus AB = 1 only when A = B = 1. OR. The OR of two variables is 1 if either (or both) of the variables is 1. OR is written as A OR B or as A + B. Thus A + B = 1 if A = 1 or B = 1 or A = B = 1. In addition to the above basic operations, one other function, the Exclusive-OR, is required for arithmetic-related operations. XOR. The Exclusive-OR of two variables is 1 if either of them but not both is 1...

  • The Art of Assembly Language Programming Using PIC® Technology
    • Theresa Schousek(Author)
    • 2019(Publication Date)
    • Newnes
      (Publisher)

    ...It is through Boolean algebra that we physically construct hardware gates that take in inputs and generate outputs. All of these may also be constructed out of software using the logical operators. Logical Operators Logical Operators are assembly language commands that act on two input values and give one output value. Let’s take a look at a generic black box with the input values of A and B and the output value of F. To understand how the Logical Operators work, we engage the use of truth tables. Truth tables show, in tabular form, the inputs on the left side columns, A and B, and the output, F, on the right side column of the table (Fig. 9.1). Fig. 9.1 Boolean black box. There are three basic functions: AND, OR (IOR), XOR. We will take a look at the AND function, for ANDWF and ANDLW; the inclusive OR function, for IORWF and IORLW; and the XOR exclusive OR function for XORWF and XORLW (see Fig. 9.2). Fig. 9.2 Logical operators: ANDWF, IORWF, XORWF, ANDLW, IORLW, XORLW. AND/NAND gates The AND gate is represented by a D shaped object. The AND gate requires that both A and B must be true (1) before the output F can be true (1). All other input combinations result in a false (0) output F (Fig. 9.3). Fig. 9.3 AND gate and truth table. The NAND, or not AND, gate, is represented by an AND gate with a bubble on the output indicating the NOT of the output. All input combinations result in a true (1) except for the one state where both A and B are true; this state is a false (0) (see Fig. 9.4). The NAND is a very special function in that multiples of it can be used to create any of the other gates. We will look at this special relationship at the end of this chapter. Fig. 9.4 NAND gate and truth table. The AND Microchip assembly language logical operators are ANDWF and ANDLW (see Fig. 9.5). The logical operators are bit wise functions. The first operator, ANDWF, ands the working register, W, and the value contained in f...