...

/

Sets and Propositional Logic

Sets and Propositional Logic

Learn why a set is a critical component in data structures.

Introduction to propositional logic

Sets, symmetric difference, and propositional logic are at the very center of discrete mathematics and computer science. These concepts are immersed in data structures and algorithms too. Without understanding these key concepts, we can’t move forward.

We’ve seen a few implementations of sets in various programming languages. We’ve also found that sets are statements, just like we use the term “statement” within the coding paradigm.

Let’s write a discrete mathematical set of even numbers like this:

A={2,4,6,8}A = \{2, 4, 6, 8\}

We can read the set of these even numbers as a statement—it’s an even number. In discrete mathematics, numerical sets are considered a collection of discrete numbers that doesn’t contain duplicate numbers. Yet, this statement will possess something else if we replace the words “numbers” with “things.” We’ll come to that point in a minute.

If two different sets contain duplicate numbers, the symmetric difference will quickly point out those numbers. Sets use the XOR symbol to express inequality, and this boolean concept is implemented in every programming language.

This is where propositional logic comes in. We can’t find the ...