Propositional Logic

Description

Propositional Logic (also known as Boolean logic) is a branch of logic that deals with propositions — statements that are either true or false, but not both. It forms the basis of reasoning in Artificial Intelligence, computer science, and digital circuit design. It uses logical connectives like:

  • ¬ (NOT): Negation
  • ∧ (AND): Conjunction
  • ∨ (OR): Disjunction
  • → (IMPLIES): Implication
  • ↔ (BICONDITIONAL): Equivalence

Examples (Code)

Below is a simple example

#Example 1: Evaluating Basic Propositions
# Defining propositions as Boolean variables
P = True
Q = False

# Logical operations
print("NOT P:", not P)           # False
print("P AND Q:", P and Q)       # False
print("P OR Q:", P or Q)         # True
print("P => Q:", not P or Q)     # False (Implication)
print("P <=> Q:", P == Q)        # False (Equivalence)


#Example 2: Constructing a Truth Table
from itertools import product

print("P\tQ\t¬P\tP∧Q\tP∨Q\tP→Q\tP↔Q")
for P, Q in product([True, False], repeat=2):
    not_P = not P
    and_PQ = P and Q
    or_PQ = P or Q
    implies = not P or Q
    equiv = P == Q
    print(f"{P}\t{Q}\t{not_P}\t{and_PQ}\t{or_PQ}\t{implies}\t{equiv}")

 

AI Reasoning Systems

Used in knowledge bases to infer facts and decisions logically.

Digital Circuit Design

Logic gates use propositional logic to compute outputs from inputs.

Cybersecurity

Used in rule-based firewalls and decision-making for threat detection.

Programming

Conditionals and loops are built using Boolean logic (IF, ELSE).

Where topic Is Applied

Field Application
Artificial Intelligence Knowledge representation and rule-based systems
Electronics Design of logic gates and digital circuits
Software Development Control structures and conditional execution
Mathematics Proof theory and logical inference
Cybersecurity Access control and threat modeling rules

Resources

What is a proposition?

A proposition is a declarative statement that is either true or false, but not both.

What is the difference between implication and equivalence?

Implication (P → Q) is false only when P is true and Q is false. Equivalence (P ↔ Q) is true when both P and Q are either true or both false.

Is propositional logic decidable?

Yes, propositional logic is decidable — there exists an algorithm that can determine the truth of any propositional formula.

How is propositional logic used in AI?

It is used in AI for knowledge representation and automated reasoning in rule-based expert systems.