Skip to main content
Discrete Math
CHAPTER 02 Beginner

Propositional Logic Fundamentals

Updated: May 17, 2026
15 min read

# CHAPTER 2

Propositional Logic Fundamentals

1. Introduction

Before you can build an algorithm, a database, or a CPU, you must have a system to determine reality. In computer programming, every decision a computer makes is based on whether a specific condition is True or False. This binary decision-making framework is mathematically formalized as Propositional Logic. It is the absolute bedrock of computational thought. If you have ever written an if/else statement in Python, Java, or C++, you have already been executing Propositional Logic.

2. Learning Objectives

By the end of this chapter, you will be able to:
  • Define what constitutes a valid "Proposition" in mathematics.
  • Identify sentences that are NOT propositions.
  • Assign Truth Values to discrete statements.
  • Understand how single propositions combine to form compound logical architectures.

3. What is a Proposition?

A Proposition is a declarative sentence that is either strictly True or strictly False, but *never both*, and *never neither*.

Valid Propositions:

  • "Paris is the capital of France." *(True)*
  • "$2 + 2 = 5$." *(False - It is wrong, but it is still a valid declarative proposition!)*
  • "The server is currently online." *(True or False)*

NOT Propositions:

  • "What time is it?" *(A question cannot be true or false).*
  • "Read the documentation!" *(A command cannot be true or false).*
  • "$x + 5 = 10$." *(This is an open sentence. We cannot determine if it is true or false without knowing the value of $x$.)*
  • "This statement is false." *(A paradox. It cannot be assigned a truth value).*

4. Variables and Truth Values

In algebra, we use variables like $x$ and $y$ to represent numbers. In Propositional Logic, we use variables (usually $p, q, r$) to represent entire propositional sentences.

Let:

  • $p =$ "The user is logged in."
  • $q =$ "The file exists."

Every propositional variable possesses exactly one Truth Value:

  • T (True) or 1
  • F (False) or 0

If the user is currently logged in, then $p = T$. If the file is missing, then $q = F$.

5. Compound Propositions

A single proposition ($p$) is simple. But real-world computer science requires evaluating multiple conditions simultaneously. "If the user is logged in AND the file exists, THEN allow download."

When we link multiple simple propositions together using Logical Operators (AND, OR, NOT), we create a Compound Proposition.

*Example:*

  • $p$: "It is raining."
  • $q$: "I will bring an umbrella."
  • Compound: "It is raining, AND I will bring an umbrella."

6. The Programming Connection

How does this mathematical theory translate to software engineering? Variables in code that hold True/False values are called Booleans (named after George Boole, a pioneer of propositional logic).
javascript
12345678
// JavaScript Boolean Variables (Propositions)
let p = true;  // Proposition p: "User is Admin"
let q = false; // Proposition q: "Account is Banned"

// A simple conditional evaluation based on Truth Values
if (p === true) {
    console.log("Welcome Admin.");
}

7. Logical State Evaluation Table

To systematically track all possible states of a proposition, mathematicians use a foundational visualization called a Truth Table. For a single proposition $p$, there are exactly 2 possible states:
$p$State Meaning
TThe proposition is functionally True.
FThe proposition is functionally False.

For two propositions ($p$ and $q$), there are exactly $2^2 = 4$ possible combinations of reality:

$p$$q$Combination Reality
TTBoth are True.
TFFirst is True, Second is False.
FTFirst is False, Second is True.
FFBoth are False.

8. Common Mistakes

  • Confusing facts with propositions: Remember, a proposition does not have to be scientifically accurate. "The moon is made of cheese" is a perfectly valid mathematical proposition because it can be definitively evaluated as False.
  • Treating variables as numbers: In logic, $p$ does not equal 5. $p$ exclusively equals $T$ or $F$.

9. Exercises

  1. 1. Which of the following are valid propositions?
a) Initialize the database. b) 10 is an odd number. c) Is the network connection secure? d) Python is a programming language.
  1. 2. If you have 3 distinct propositions ($p, q, r$), how many total possible True/False combinations exist? (Hint: Base-2 mathematics).

10. MCQs with Answers

Question 1

What is the strict mathematical definition of a Proposition in discrete logic?

Question 2

Which of the following sentences formally qualifies as a valid Proposition?

Question 3

Why does the sentence "$x + 10 = 20$" FAIL to qualify as a mathematical proposition?

Question 4

In standard programming architectures (Java, C++, Python), what specific primitive data type directly maps to the mathematical concept of a Proposition?

Question 5

How many explicit Truth Values exist in standard classical Propositional Logic?

Question 6

If a mathematician defines the variables $p=$"It is raining" and $q=$"The street is wet", what constitutes a "Compound Proposition"?

Question 7

When constructing a Truth Table mapping all possible reality states for three distinct, independent propositional variables ($p, q, r$), how many explicit rows of combinations are generated?

Question 8

Is the sentence "The binary number 10 equals the decimal number 5" a valid proposition?

Question 9

What severe logical anomaly occurs when attempting to evaluate the sentence "This statement is false"?

Q10. True or False: In Discrete Mathematics, propositional variables like $p$ and $q$ are allowed to hold fractional probabilities (e.g., $p = 75\%$ True). a) True. This represents Fuzzy Logic algorithms. b) False. Standard Propositional Logic enforces rigid, absolute binary states. A proposition is 100% True or 100% False. Fractional probability belongs to Continuous Mathematics and Probability Theory, not foundational Propositional Logic. Answer: b) False. Standard Propositional Logic enforces rigid, absolute binary states. A proposition...

11. Interview Preparation

Top Interview Questions:
  • *Algorithmic translation:* "An API requires three separate Boolean flags to be passed. If you need to test every single possible combination of these flags to ensure the system doesn't crash, how many tests must you write?" *(Answer: $2^n$ combinations. With 3 flags, you must write exactly $2^3 = 8$ distinct unit tests to achieve 100% absolute logical coverage!)*

12. Summary

Propositional Logic is the atom of computer science. By restricting communication to absolute declarative statements that resolve exclusively to True or False, mathematicians established a language that digital hardware can physically understand. Every complex algorithm in the world is simply a massive chain of propositions evaluating reality.

13. Next Chapter Recommendation

We know what propositions are, but how do we connect them? How do we mathematically command the CPU to evaluate two propositions together? In Chapter 3: Logical Operators and Truth Tables, we will unlock the core Boolean operators: AND, OR, NOT, and XOR.

Finish this Chapter

Save your progress on your learning path and prepare for coding interview challenges.

Discussion

Join the discussion

Log in or create a free account to participate.

Sort: ·