### What is logic?**In philosophy:** Logic was formed to "formalise correct argumentation and deduction".**In mathematics:** Rules of logic are used to distinguish between correct and incorrect mathematical arguments (otherwise known as proofs).
Propositions
Proposition
A proposition is a **declarative sentence** of which we can meaningfully ask whether it is true $(T)$ or false $(F)$.
Sample syntax:
Propositional / boolean random variables:
Cavity = true↦cavityCavity = false↦¬cavity
Discrete random variables (finite or infinite)
Given Weather is one of {sunny,rain,cloudy,snow}
"Weather=rain" is a proposition
Continuous random variables (bounded or unbounded)
Temp=21.6; Temp<22.0; Temp≥5.0 AND Temp≤23.0
We use propositional variables, denoted as lower case letters (p,q,r or p1,p2,..) to denote propositions whose structure we don’t want to analyse further.
We build compound expressions called formulas, denoting compound propositions. They are built from logical connectives and parentheses.
We can define a formula as a compound expression made up of propositions, logical connectives and parentheses.
Let p and q be propositions.
The conjunction of p and q, denoted by p∧q, is the proposition that "$p$ and $q$".
v(A∧B)={1,0,if v(A)=1 and v(B)=1if v(A)=0 or v(B)=0
p
q
p∧q
T
T
T
T
F
F
F
T
F
F
F
F
For example:
Let p be that “Today is Tuesday”.
Let q be that “It is raining today”.
p∧q is that “Today is Tuesday and it is raining today”.
But in English, $p \wedge q$ and $q \wedge p$ do not always mean the same thing.- "Bob became sick and he visited the doctor."- "Bob visited the doctor and he became sick."This can be handled by dynamic conjunctions.
Let p and q be propositions.
The conditional statement p→q, is the proposition that "if $p$ then $q$". This is also called an implication.
v(A→B)={1,0,if v(A)=0 or v(B)=0if v(A)=1 and v(B)=0
p
q
p→q
T
T
T
T
F
F
F
T
T
F
F
T
For example:
If it is sunny today, we will go to the beach.
If I am elected, I’ll lower taxes.
You may encounter some weird statements which are still true.- "If the Moon is made of green cheese then $2\times2=5$." $(F \rightarrow F)$.- "If the Moon is made of green cheese then $2\times2=4$." $(F \rightarrow T)$.- "If London is in the UK then $2\times2=4$." $(T \rightarrow T)$. This is also known as irrelevant logic.
Let p and q be propositions.
The biconditional statement p⟺q, is the proposition that "$p$ if and only if $q$". This is also called an bi-implication or an equivalence.
v(A⟺B)={1,0,if v(A)=v(B)if v(A)=v(B)
p
q
p⟺q
T
T
T
T
F
F
F
T
F
F
F
T
There are some implicit uses of biconditional statements in English, for example:- If you finish your meal then you can have desert, $p \rightarrow q$.But we actually mean $p \iff q$:- You can have desert if and only if you finish your meal.
We have to use parantheses to not create confusion, for example p∧q∨r can have two different truth tables depending on how you parse it.
To reduce the number of brackets, we agree ¬ takes priority, for example ¬p∧q means (¬p)∧q.
A tautology (otherwise known as valid) is a formula that is true under all [[Interpretation|interpretations]], every row in a truth table of a tautology makes it true.
We can denote a tautology by ⊨x, where x is a formula which is a tautology.
Given the following specifications:- Message is stored in buffer or it is trasmitted. $p\vee q$- Message is not stored in buffer. $\neg p$- Message is stored in buffer then it is trasmitted. $p \rightarrow q$| $p$ | $q$ | $p \vee q$ | $\neq p$ | $p\rightarrow q$ ||:-----:|:-----:|:----------:|:--------:|:----------------:|| T | T | T | F | T || T | F | T | F | F || *F* | *T* | **T** | **T** | **T** || F | F | F | T | T |
An argument is logically correct if in every situation that makes all premises true, the conclusion is true as well.
p1p2..pnq is logically correct⟺the formula (p1∧p2∧p3∧..∧pn)→q is a tautologyLink to original
Situation
A situation is a row in the truth table of $p_1, p_2, .., p_n, q$ or otherwise a possible assignment for the propositional variables in $p_1, p_2, .., p_n, q$.
An inference rule is a representation of a valid step in a formal proof, indicating the conditions that must be satisfied before a conclusion can be obtained in the proof.
A rule will be presented in the form: R:BA1,A2,...,An
A1,A2,...,An are the premises or conditions of the rule, and B is the conclusion.
Informally, R: “if A1,A2,...,An are true, then B is also true.”
We can always use a truth table to decide whether an argument is correct.
This can be very tedious.
If we consider 10 different variables, the truth table requires 210=1024 rows.
Instead, we can establish the correctness of simple argument forms using rules of inference, and then use them to construct more complicated correct arguments.
For example, Modus ponens (the rule of detachment).
∴p→qpqIf it snows today, then we will go skiing.It snows today.We will go skiing.
Examples
Should practice trying to justify these!There will be no exam Q in this module for building these, no need to memorise.
Are quite often found in different places but these statements are neither true or false. As well as this, the variables x and y are not propositional variables but instead denote entities, which are things or objects.
We can formalise "x>3" as P(x) where x is a variable and P is the predicate (property), which in this case is that it is “greater than 3”.
By assigning a value (a concrete entity) to the variable, P(x) becomes a proposition that has a truth value.
P(5) means 5 is greater than 3⇝ T
P(1) means 1 is greater than 3⇝ F
We typically use upper case letters (P,Q,A,B) to denote predicates.
To formalise a statement such as "x=y+4", we use the predicate Q(x,y), where:
x and y are variables.
Q is the predicate connecting two things (otherwise called a binary predicate).
“the first number is the sum of the second number and 4”
Quantification is another way of creating a proposition from P(x), it expresses the extent to which a predicate is true over a range of entities, called the domain.
Universal quantifier, ∀.
Universal quantifier
The universal quantification of P(x) for a particular domain, denoted by ∀xP(x), is the proposition "$P(x)$ is true for all values of $x$ from the domain". $\forall$ means "For all".
The truth value of ∀xP(x) might change if domain changes.
Domain must always be specified when universal quantifier is used.
For example, take P(x) is "x>0":
For the domain of positive integers, ∀xP(x)⇝T.
For the domain of all integers, ∀xP(x)⇝F.
To say “Everyone does not like Jane”, we write that for every x, x does not like Jane:
(∀x)(¬Likes(x,jane))
In general, the notation for universal quantifiers is $(\forall x)(\phi)$ where $\phi$ is a formula in which $x$ and possible other variables may appear.
A universal instantiation means for each and every entity $c$ in the domain we have a correct inference rule of the form: $$\boxed {\begin{array}{c}\underline{\forall xP(x)} \\P(c)\end{array}}$$
For example,
∴Everyone in the class is feeling miserable today.Agi is feeling miserable today.
By universal instantiation, given the premise (∀x)ϕ(x), we may derive the conclusion ϕ(x/t), where t is any object in the domain:
ϕ(x/t)(∀x)ϕ(x)(UI)
If ϕ(x) holds for all the elements of the domain, it holds in particular for the element t as well. Universal instantiation can be seen as ∀-elimination.
A universal generalisation is $$ \boxed{\begin{array}{c} \underline{P(c) \textsf{ for any arbitrary entity } c \textsf{ in the domain}} \\ \forall x P(x)\end{array}} $$
By universal generalisation, given the premise ϕ(x/t) takes place for a generic object t of the domain, we may derive (∀x)ϕ(x):
(∀x)ϕ(x)ϕ(x/t)(UG)
The object t in the premise of (UG) must not be specific but arbitrary, i.e. we cannot make any assumption about t other than it comes from the domain. Universal generalisation can be seen as ∀I.
The existential quantification of P(x) for a particular domain, denoted by ∃xP(x), is the proposition that "there exists a value for $x$ in the domain such that $P(x)$ is true".
The truth value of ∃xP(x) might change when domain changes.
Domain must always be specified when used.
For example, take P(x) is "x<−3":
If the domain is all integers, then it is true.
We simply need to give one example, such as x=−5 then P(−5) is true.
If the domain is the positive integers, then it is false.
To say “(at least one) car is yellow”, we write that for some x, x is yellow:
(∃x)(Colour(x,yellow))
In general, the notation for existential quantifiers is $(\exists x)(\phi)$, where $\phi$ is a formula in which $x$ and possible other variables may appear..
An existential generalisation means that for every entity c in the domain, we have a correct inference rule of the form $$ \boxed{ \begin{array}{c} \underline{P(c)} \\ \exists x P(x) \end{array} } $$
For example:
∴Marla is reading the lecture notes.There is someone in the class reading the lecture notes.
By existential generalisation, given that ϕ(x/t) is known to hold for a particular object t of the domain, we may derive (∃x)ϕ(x):
Or can be obtained from earlier premises in the sequence by a logically correct argument.
It is said that theorem t follows from the axioms.
How are theorems stated
Many theorems assert that a property holds for all entities in a domain. The precise statement must include a universal quantifier, standard convention in mathematics is to omit it.
The statement “if x>5, where x is a positive integer, then x2>30”
Means that “for all positive integers x, if x>5, then x2>30”
For example, given the theorem “If n is an odd integer, then n2 is odd”, the proof is:
Let n be an arbitrary integer.
Assume n is odd.
Since n is odd, let n=2k+1.
Hence,
n2=(2k+1)2=4k2+2k+2k+1=4k2+4k+1=2(2k2+2)+1 which is odd ∵2n(..) even and+1 makes it odd
∴n2 must be odd if n is an odd integer.
Indirect Proof
For example, show that at least 4 of any 22 dates in the calendar must fall on the same day of the week. We can try a proof by contradiction, which does not prove a result ‘directly’.
Let p be “at least 4 of 22 chosen dates fall on the same day of the week”.
Suppose that ¬p is true, that means “at most 3 of 22 chosen dates fall on the same day of the week”.
We know that there are 7 days of the week, this implies at most 21 dates could have been chosen, as for each of the 7 days of the week, at most 3 of the chosen dates could fall on that day.
So, if q is the statement that ”22 dates are chosen” then we found that ¬p→¬q.
Using q as a premise, we reached a contradiction by showing (q∧¬p)→(q∧¬q).
We find that q∧¬q is a contradiction, it will always be false.
As q is true (our premise), q∧¬p can only be false when ¬p is false, hence p is true.