2026-10-09 17:42
Status:
Week 1
Propositional Logic is a system that deals with propositions or statements
Imagine that there is an island full of two types of people, liars who always tell lies, as well as knights who always tell the truth. You visit the island and encounter two people, person A and person B. Person A says “At least one of us is a liar” and person B says nothing
The answer for this is that person A is a knight and person B is a liar. This is because logically person A can be either a liar or a knight, if they were a liar, their statement would be false, meaning that nobody there was a liar, but that is contradictory because if nobody was a liar, then their statement would have been a lie. This means that person A must be telling the truth and is a knight, which by process of Elimination means that person B must be the liar.
Propositions and connectives
A proposition is a statement that can be either true or false but it CANNOT be both or neither, it must be either or. This follows standard boolean logic of either T or F or 1 or 0 in terms of logic
Examples of propositions
- 2 is a prime number
- 5 is an even number
These are basically things that are fact check-able, it either is right or it is not right, it follows a basic source of logic with definitive factors that are not subject to change.
Examples of non-propsitions:
- X is a prime number
- Are you going to school?
- Do your homework now
Things that are questions or commands, and things with a variable factor are things that are not outright propositions, this is because they can either be true or false, or they simply just do not fit the bill of boolean logic
Syntaxes of Propositional Logic:
Propositions are denoted by CAPITAL letters P, Q, R:
- P = 3 is an odd number
- Q = 2+5 is an even number
So in this given scenario, these would actually evaluate to boolean logic, and P would be considered true while Q would be considered false
General Statements are denoted by lowercase letters p, q, r
- They carry a logical argument
- Are used in proofs
- and are called propositional variables
Connectives: change or combine propositions
-
Logical NOT:
¬- ¬ p is true if, and only if, p is false
- It is also called negation, and is the same thing as using the
!operator in programming
-
Logical OR:
v- p v q is true if, and only if, at least one of p or q are true
- it is also called a disjunction
-
Logical AND:
^- p ^ q is true if, and only if, both p and q are true
- It is also called a conjunction
-
Logical IF… THEN: ->
- p -> q is true if, and only if,, either p is false, or q is true
- It is also called conditional or implication
- p is the premise, q is the conclusion
-
Logical IF and only IF: <->
- p <-> is true if, and only if, both p and q are true
- It is also called logical bi-conditional
-
Exclusive OR: XOR
- p XOR q is true if p or q is true, but not both
P = I will study 20 hours a week R = I will pass the exam
S = I will be happy Q = I attend all the lectures
- (P v Q) -> (R ^ S)
- This basically translates to IF (I will study 20 hours a week OR I attend all the lectures) THEN (I will pass the exam AND I will be happy)
If the UK does not leave the EU, then skilled nurses will not leave the NHS and research grants will remain intact.
P = UK leaves the EU, Q = Nurses leave NHS, S = Research grants will remain intact
This would translate out to: (¬P) -> (¬Q ^ S)
Truth Tables
A truth table is a set of ALL POSSIBLE OUTCOMES or propositions and connectives. Every proposition is either true or false.
There is also general propositions where a variable signifies a statement being either true or false.
Truth tables for the different connectives:
Negation: ¬
| p | ¬p |
|---|---|
| 1 | 0 |
| 1 |
Basically values are outright negated, this is the truth table of negation, and a negation is basically similar to the concept of 1 - T(p) or 1 - the truth value of P
Conjunction: ^
| p | q | p ^ q |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 0 |
This is basically the and operator if you think about it, so it means that if there is even one zero, then it means that the outcome is false. You can think of this as multiplication, so T(p) X T(q), so you only get 1 when q and p are both equal to one.
There is a basic concept in propositions and connectives. Basically if depending on the number of propositions that you have in a given connective, you would then have a number of different rows in a table.
Disjunction: V
| p | q | p v q |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 0 | 1 |
| 0 | 1 | 1 |
| 0 | 0 | 0 |
This is basically the and operator, and in all theory it looks like it would actually be equivalent to something like ¬(p ^ q). This means that something is true if at least one of the given propositions is true.
You can think of it as the equivalent to a Maximum: Max{T(p), T(q)}, so basically if one is 1, then the maximum of the two is one, otherwise it is zero
Implication: ->
| p | q | p -> q |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 0 | 0 |
| 0 | 1 | 1 |
| 0 | 0 | 1 |
The best way to think of this is if it like a promise and then whenever the promise is broken, then the implication is false.
Take the promise of “If you study hard, I will give you a cookie”. If you do not study hard, and you do not get the cookie, then the statement is true, if you do not study hard and you do get the cookie then it is false.
A good way of seeing this is basically seeing if it is <= mathematically, so if p <= q this is how you would evaluate the idea, basically just think of it as that operator whenever you have to compare the two different p or q values
IMPLICATION IS FALSE ONLY WHEN THE PREMISE IS TRUE AND THE CONCLUSION IS FALSE
Bi-Conditional: <->
| p | q | p <-> q |
|---|---|---|
| 1 | 1 | 1 |
| 1 | 0 | 0 |
| 0 | 1 | 0 |
| 0 | 0 | 1 |
This one can be thought of as the == check inside of a programming language. This means that basically you check if the two of the different proportions are equal to each other so T(p) = T(q)
Exclusive or: XOR
| p | q | p XOR q |
|---|---|---|
| 1 | 1 | 0 |
| 1 | 0 | 1 |
| 0 | 1 | 1 |
| 0 | 0 | 0 |
This is basically the idea of p != q and is the check of inequality for a given set of two propositions. T(p) != T(q), and it can be thought of as the opposite or ¬ of a bi-conditional connective
Sometimes you will get a connective operator without any actual paranthesis for how it evaluates. This is where the operator precedence comes in for the propositional logic, and it basically follows the above order. Negation goes first, then the and operative binds the second tightest, the or after, then the if… then statements
This is pretty similar to the functioning of how the conditionals would evaluate inside of a programming language syntax as well
Constructing Truth Tables for complex formulas
(p ^ q) -> p
| p | q | p ^ q | (p ^ q) -> p |
|---|---|---|---|
| 1 | 1 | 1 | 1 |
| 1 | 0 | 0 | 1 |
| 0 | 1 | 0 | 1 |
| 0 | 0 | 0 | 1 |
You basically evaluate this in the order of operations that you see, moving from the left hand side to the right hand side. You evaluate the expression by part and then based on what you get, you use that to evaluate the next portion of the expression. So here you basically evaluate the first 2 columns, and then use the first and the third column to evaluate the fourth
Tautology and Consistency (Part 1)
Tautology is a formula that is always true:
- p v ¬p
- (p ^ q) -> p
- (p ^ q) -> q
Examples of something that is not tautology would be:
- p ^ q
- Because if T(p) = 0, then p ^ q is false
- p -> q
- Because if T(p) = 1 and T(q) = 0, then p -> q is false
Consistent and ¬Consistent
A formula that is true at least once is considered to be consistent. So something like p ^ q is consistent because it can be both true and not true.
A formula is considered not consistent when it is never true so no matter what the outcomes that come in, the outcome can never be considered true. An example is p ^ ¬p
This is because the and operator requires for both parties to always be true.
Formulas that are Not Consistent are also sometimes called Contradictions
Truth Table for (¬p ^ q) <-> (p v ¬q)
| p | q | ¬p | ¬p ^ q | ¬q | p v ¬q | (¬p ^ q) <-> (p v ¬q) |
|---|---|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 0 | 1 | 0 |
| 1 | 0 | 0 | 0 | 1 | 1 | 0 |
| 0 | 1 | 1 | 1 | 0 | 0 | 0 |
| 0 | 0 | 1 | 0 | 1 | 1 | 0 |
This is therefore a Contradiction or Inconsistent formula because no matter what the input is you end up getting a 0. This is logical enough if you really think about it (I have no idea how).
Tautology and Consistency Part 2
Tautology is a formal that is always true basically, and a Contradiction is a condition that is always considered false. This is nice if you think about it because it means that you can abstract out away these given parts of your formula and then replace them with whatever they always evaluate to
So imagine you have something like: (p v ¬p) v (p ^ ¬p) and you want to determine if this is a tautology, consistent, or a contradiction formula
- We know that
p ^ ¬pis always going to be false because you cannot have something liketrue && !trueto be valid. - We know that
p v ¬p isis always going to be true, because at least p or ¬p is going to be true no matter what p is
This means that eventually (p v ¬p) v (p ^ ¬p) is going to just boil down to true v false meaning that we know that the whole entire formula is actually a tautology because we can quickly understand that it’s inner parts do not all need to be solved out
Now say you have something like (p -> p) v (q ^ r)
Here, you know that the p -> p is always going to be true, and you know that because you are using the or: v operator, even though (q ^ r) is technically just consistent, you end up with a tautology you use the little three line ham burger to show what kind of formula something is
Useful Relations:
- Tautology v consistent ☰ tautology
- Tautology ^ consistent ☰ consistent
- Tautology v contradiction ☰ tautology
- Tautology ^ contradiction ☰ contradiction
- Contradiction v consistent ☰ consistent
- Contradiction ^ consistent ☰ contradiction
- Tautology -> contradiction ☰ contradiction
- Contradiction -> Tautology ☰ tautology
- Contradiction -> consistent ☰ tautology
Reading: Discrete mathematics with applications by Koshy, T. Discrete Mathematics pg 1-30:
Notes on Pages 1-30
The first page goes a little bit over the history of logic. It basically says that Aristotle was the father of logic and then over the years people developed different symbols to help understand logic. Logic is also really useful for several fields like computer science because it is used to do things like develop programming languages and also establish the correctness of programs
He also poses two different questions:
- The answer to the first is pretty obvious, the answer is clearly yes and this is just because of logic. Given that there are more residents than there are hairs on any head of a resident. You can count up by one for each every single resident and then you would still not have enough to cover the total number of residents. This means mathematically you have to repeat at least once.
- For the second one you have to look at the statement “At least one of us is a knave”, this statement is either true or false, if it was false, then that means that the both of them are knights, and that Tom lied so he is a knave, but that would make his statement true, it is contradictory. This means that Tom is a Knight and his statement is true so that way Dick is a knave.
Proposition- a declarative sentence that is either true or false, but not both or neither. It is denoted by lowercase letters: p, q, r, s, or t these are also called boolean or logic variables
Truth Value the truthfulness of falsity of a proposition is called it’s truth, value, it is denoted by either T(True) or F(False), or 1 / 0 for computer scientists.
Sentences like: this sentence is false. Match the outright ideas of a proposition, it is a declarative sentence with something that can be in a sense fact checked, but it become contraditory because if the sentence is true then it says the sentence is false. If it is false then it is true. This makes it a paradox and not a contradiction.
The truth of a proposition may simply not be known because it has not yet been fact checked, but it is still a proposition
Take the example of: has no positive integer solutions where n >= 3
- also known as Fermat’s Last “Theorem, this is basically saying that this only works for Pythagoras theorem and downwards. Probably some 3 dimensional shit lowkey
This was still a proposition, a statement that was declarative, even if it’s truth value was not yet known for hundreds of years until one Andrew J. Wiles solved it at Princeton.
Two Types of Propositions:
Simple Propositions: these are the basic statements, something like 2+2=4 or Today it rained, they are contigent only to themselves and have a single part.
Compound Propositions: occur whenever you join two or more simple propositions together, something like: If 2+2=4, then I am cool or The sky is blue and it is raining the truth value of these propositions then is the product of two different simple propositions and how they logically interact
Different Types of Compound Propositions
The conjunction of two arbitrary propositions p and q, as denoted by p ^ q, this is called a connective
It basically means that the statement of p^q is determined to be true only when p and q are both true. It is basically the AND operator, and the more detail of it can be seen above. The given statement table defines a way for use to see the all of the different possible outcomes of a given statement.
It should also be noted that a given statement can be calculated with the number of possible outcomes that it has by using the formula of where n = the number of unique simple propositions
Expressions that yield the true or false values are called boolean expressions and often occur in both math and computer science. They are used in things like for or while loops in order to determine execution of a given piece of logic
Take for example:
i = 3
j = 5
sum = 0
if(i < 4) and (j <= 5):
sum += i + jGiven the values that exist here, this code runs because the boolean expression is considered to be true.
The Disjunction / Or / v / operative
This is basically the or statement, only one of the given propositions has to be considered true for the entire boolean expression to be evaluated to a true value. It is denoted by the expression p ∨ q
There are generally two types of Dis-junctions, either the inclusive disjunction: v known as OR or the exclusive disjunction known as ⊕ or XOR which basically means that the statement is true if and only if ONLY ONE of the two statements is true, it is not true if both are true. This is useful for things that are logically impossible like being in two places at once
The negation operators: ~ or ¬
There is also others like the negation operative: ¬ or the ~ which inverts a given boolean value, sort of like the word not or the ! operator in a programming language
The if then operator: →
This one basically works kind of like the <= operator, at least for only when the actual values are between one and zero. It basically means that these statements can both be true or false, however if they differ, the statement is only true if the if statement is false and then the then statement is true.
The best way to think of this one is as a promise
if you do P, then I promise to do Q
If the promise if kept, then we consider the implication to be true, if the promise is not kept, then we consider it to be false.
This is basically saying that the implication here for the promise really comes down to if the first action was actually committed or not, if it was committed then your promise is really being tested, and then if you do keep your promise then the statement is true, and if you do not it is false. However if the original promise is NOT tested, then basically your own response to the promise does not matter because it did not happen, and so it evaluates to true. Seems a bit arbitrary but whatever
This generally applies without logic as well, even though in the English language If the power is on, then 3+5=8 does not make sense, this is technically a tautology because it is always going to evaluate to true.
Converse, Inverse and Contra-positive:
This is basically saying you can really fuck around with the given implications, you can have the converse, which basically:
converse:
p → q becomes q → p
inverse:
p → q becomes ¬p → ¬q
contrapositive:
p → q becomes ¬q → ¬p
Example of how to use truth tables in a given situation:
p = The capitial is in the mountains
q = The road on the right goes to the captial
Also consider the false hood of these items
| p | q | p v q | p ^ q | p → q |
|---|---|---|---|---|
| 1 | 0 | 1 | 0 | 0 |
| 1 | 1 | 1 | 1 | 1 |
| 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 0 | 1 |
Based on the two things that they have said A is a knight because he called the other man a liar, which is something he logically could not have done if he was a knave. This means that the other man is in fact a liar, and that one of the things that the Knight said was true and one of the things that the knave said was a lie. This makes sense given the use of the and and or statements from the two of them.
Following this logic we can construct the truth table, we can ignore the parts that say that both have lied or both have told the truth because we know that this is in fact not something that is possible, so only rows 1 and 4 are of interest.
Example 2:
| g | b | C: g ^ ~b | D: ~g ^ b | E: ~g ^ ~b |
|---|---|---|---|---|
| 1 | 1 | 0 | 0 | 0 |
| 1 | 0 | 1 | 0 | 0 |
| 0 | 1 | 0 | 1 | 0 |
| 0 | 0 | 0 | 0 | 1 |
Given they all said the exact same thing about at one being a knave and then two being knights, this must mean that they are ALL knaves, and so every single thing that they have said is considered a false statement. This is given the fact that they all used AND statements though.
Using the table in that case, we know that the answers from C, D, and E all must eventually end up being a lie and evaluate to 0. Looking at the table is this actually only possible if both g ^ b are equal to 1, so this means that this road does in fact lead to the capital, and that this is in fact a bus stop.
Bi-Conditional Statements: ↔
This basically is the == operator, and works to see that both the statements are actually equal to what they represent to one another, meaning that you can read it out as q if and only if q.
This logically makes sense because this means that one is dependent on the other, and so something like (p → q) ∧ (q → p) means that exact same thing as p ↔ q, hence the given symbol and what not.
It essentially means that the two propositions have to share the same logical value in order for them to evaluate to true.
Truth table for (p → q) ↔ (¬p ∨ q)
| p | q | (p → q) | ¬p | (¬p ∨ q) | (p → q) ↔ (¬p ∨ q) |
|---|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 1 | 1 |
| 1 | 0 | 0 | 0 | 0 | 1 |
| 0 | 1 | 1 | 1 | 1 | 1 |
| 0 | 0 | 1 | 1 | 1 | 1 |
This statement is always true! This means it is a tautology
A symbolic resolution of this would be:
B ∨ (A ∧ ¬B) ∨ (¬A ∧ C)?
They give: [(A ^ B) v B] v (~A ^ C), its the same thing the ordering of solution and parenthesis does not matter, it would only matter for programming language sake
1.2 Logical Equivalences
These are basically two compound propositions that, although they may look outright different, can actually have the identical truth values for all possible pairs of truth values of their components
These are called logically equivalent, and are denoted with the symbol ≡
Take for example:
p → q ≡ ¬p ∨ q
| p | q | p → q | ¬p | ¬p ∨ q |
|---|---|---|---|---|
| 1 | 1 | 1 | 0 | 1 |
| 1 | 0 | 0 | 0 | 0 |
| 0 | 1 | 1 | 1 | 1 |
| 0 | 0 | 1 | 1 | 1 |
Notice therefore, that columns p → q and ¬p ∨ q are actually exactly the same in the values that they output
















