Variables
Propositional variables as building blocks of logical expressions
P, Q, R represent propositionsVariables in logic (like P, Q, R) are placeholders that represent propositions. Just as x and y in algebra can represent any number, P and Q can represent any statement that is either true or false. This abstraction allows us to study logical patterns independent of specific content.
Key Properties:
- • Each variable represents exactly one proposition
- • Variables can be true or false (but not both)
- • Same variable means same proposition in a formula
- • Different variables can represent different propositions
Why Use Variables?
Variables let us focus on logical structure rather than specific content. The same logical pattern works whether we're talking about weather, mathematics, or any other domain.
P, Q, R → any propositionsSimple Assignment
Variable:
Assignment:
Result:
Complex Formula
Formula:
Assignments:
Meaning:
Truth Value Assignment
Variables:
Formula:
Result:
Key Point: Variables allow us to create general logical patterns that work regardless of the specific propositions they represent.
Example 1: Basic Assignment(Simple proposition)
Variable:
Assignment:
Explanation: Variable P now represents the proposition "The sky is blue". Any logical operation on P operates on this specific proposition.
Example 2: Multiple Variables(Complex relationships)
Formula:
Assignments:
Explanation: This expresses "It's sunny and warm, or it's a good day for a walk". The logical structure is preserved regardless of the specific propositions.
Example 3: Programming Context(Boolean variables)
Code Variables:
Logic Variables:
Explanation: Programming Boolean variables are essentially logical variables. The same logical principles apply to code conditions.