Top Banner
This work is licensed under a Creative Commons Attribution-NonCommercial- ShareAlike 4.0 International License. See License & Attribution for details. Bits and Boolean Algebra CC 110
14

Bits and Boolean Algebra - core.cs.ksu.edu

Apr 03, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Bits and Boolean Algebra - core.cs.ksu.edu

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. See License & Attribution for details.

Bits and Boolean Algebra

CC 110

Page 2: Bits and Boolean Algebra - core.cs.ksu.edu

Aristotelian Logic

2Image Source

Page 3: Bits and Boolean Algebra - core.cs.ksu.edu

Aristotelian Logic

• Premise:

– All humans are mortal

– Socrates is a human

• Conclusion:

– Therefore, Socrates is mortal

3Image Source

Page 4: Bits and Boolean Algebra - core.cs.ksu.edu

Boolean Logic

• The Laws of Thought

• Premise:

– 𝐴ٿ𝐵

– B 𝐶ٿ

• Conclusion:

– A ٿ𝐶

4Image Source

Page 5: Bits and Boolean Algebra - core.cs.ksu.edu

Boolean Values

• Boolean

– TRUE, FALSE

• Binary

– 1, 0

• Electrical

– ON, OFF

• These are traditional representations, but they can be reversed for various reasons, check the manual!

5

Page 6: Bits and Boolean Algebra - core.cs.ksu.edu

Boolean Operators

6

and&& ٿ

A ∧ B

A ∧ B ∧ C

A ∨ B

A ∨ B ∨ C

A ⊕ B

¬ A ¬ B

¬ B

A ⊕ B ⊕ CExclusive Or (XOR)⊕

or|| ∨

not! ¬

Image Source

Page 7: Bits and Boolean Algebra - core.cs.ksu.edu

De Morgan’s Theorem

• Distribute the negative (¬) then swap ands (∧) and or’s (∨)

• Negation (inverse) of a logic statement

¬ ( A ∧ B ) = ( ¬ A ) ∨ ( ¬ B)

¬ ( A ∨ B ) = ( ¬ A ) ∧ ( ¬ B)

7Image Source

Page 8: Bits and Boolean Algebra - core.cs.ksu.edu

Boolean Algebra

• ∨ works like addition ( + )

• ¬ works like negation ( − )

• ∧ works like multiplication ( × )

• Associative: (A ∧ B) ∧ C = A ∧ (B ∧ C)

• Commutative: (A ∧ B) = (B ∧ A)

• Distributive: A ∧ (B ∨ C) = (A ∧ B) ∨ (A ∧ C)

8

Page 9: Bits and Boolean Algebra - core.cs.ksu.edu

Logic via Electrical Switches?

9

Charles Sanders Peirce

Page 10: Bits and Boolean Algebra - core.cs.ksu.edu

Claude Shannon• A Symbolic Analysis of Relay and Switching Circuits

10

Page 11: Bits and Boolean Algebra - core.cs.ksu.edu

Logic Gates

11

Note: The little circle at the end of the NOT gate is the only part that matters.

AND OR XOR NOT

NAND NOR XNOR

Page 13: Bits and Boolean Algebra - core.cs.ksu.edu

Example 1

13

A B C OUT

0 0 0 0

0 0 1 0

0 1 0 0

0 1 1 1

1 0 0 0

1 0 1 1

1 1 0 0

1 1 1 1

Page 14: Bits and Boolean Algebra - core.cs.ksu.edu

(A ∧ C) ∨ (B ∧ C)

14

C ∧ (A ∨ B) works as well