Download presentation

Presentation is loading. Please wait.

Published byHillary Doyle Modified over 4 years ago

1
Computer Science 101 The Boolean System

2
George Boole British mathematician (1815-1864) Boolean algebra –Logic –Set theory –Circuits –Conditions in if statements and while loops

3
Boolean Constants and Variables Just two constants –True and False –On and Off –5v and 0v –1 and 0 Boolean variables refer to these values

4
Boolean Operators Just three –AND –OR –NOT AND and OR are binary operators (like + and *) NOT is a unary operator

5
Boolean AND If A and B are Boolean variables (or expressions), then A AND B is True if and only if both A and B are True AND is sometimes written like multiplication in ordinary algebra: A AND B = AB or A. B

6
Truth Table for AND There are a finite number of possible values of A AND B We can specify these in a truth table ABA AND B True False TrueFalse

7
Boolean OR If A and B are Boolean variables (or expressions), then A OR B is True if and only if at least one of A and B is True OR is sometimes written like addition in ordinary algebra: A OR B = A + B

8
Truth Table for OR There are a finite number of possible values of A OR B We can specify these in a truth table ABA OR B True FalseTrue FalseTrue False

9
Boolean NOT If A is Boolean a variable (or expression), then NOT A has the opposite value of A NOT is sometimes written as a ~ (tilde) symbol: NOT A = ~A _ Or with a horizontal bar over the variable: A

10
Truth Table for NOT There are a finite number of possible values of NOT A We can specify these in a truth table ANOT A TrueFalse True

11
Boolean Expressions Constructed like arithmetic expressions NOT has a higher precedence than AND, which has a higher precedence than OR Parentheses can be used to override precedence or for clarity

12
Evaluating Boolean Expressions As in arithmetic, replace variables with values and apply the operators Let A be True and B be False Evaluate: A AND NOT (A OR B)

13
Evaluating Boolean Expressions As in arithmetic, replace variables with values and apply the operators Let A be True and B be False Evaluate: A AND NOT (A OR B) = True AND NOT (True OR False)

14
Evaluating Boolean Expressions As in arithmetic, replace variables with values and apply the operators Let A be True and B be False Evaluate: A AND NOT (A OR B) = True AND NOT (True OR False) = True AND NOT True

15
Evaluating Boolean Expressions As in arithmetic, replace variables with values and apply the operators Let A be True and B be False Evaluate: A AND NOT (A OR B) = True AND NOT (True OR False) = True AND NOT True = True AND False

16
Evaluating Boolean Expressions As in arithmetic, replace variables with values and apply the operators Let A be True and B be False Evaluate: A AND NOT (A OR B) = True AND NOT (True OR False) = True AND NOT True = True AND False = False

17
Constructing Truth Tables A truth table gives all of the possible values of a Boolean expression Construct a truth table for A AND NOT (A OR B) ABA OR BNOT (A OR B)A AND NOT (A OR B) True False TrueFalseTrueFalse True False TrueFalse

18
Constructing Truth Tables If there are N variables, there are 2 N rows in the table Best to use 0 and 1 and count in binary to fill in the inputs Construct a truth table for A AND NOT (B OR C) ABCB OR CNOT (B OR C)A AND NOT (B OR C) 000010 001100 010100 011100 100011 101100 110100 111100

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google