Computational Logic PT 1
Computational Logic PT 1
It is a collection of rules.
Dr. R. Rajkamal 2
1
21-08-2020
Example
True or false of statements, and how the
truth/falsehood of a statement can be
determined from other statements.
Dr. R. Rajkamal 3
Example
Logic in computer science covers the overlap
between the field of logic and that of computer
science.
Dr. R. Rajkamal 4
2
21-08-2020
Dr. R. Rajkamal 5
3
21-08-2020
Sentences considered in propositional logic are not arbitrary sentences but are
the ones that are either true or false, but not both.
Dr. R. Rajkamal 7
If a proposition is true, then we But "Close the door", and "Is it hot
say it has a truth value of "true"; outside ?"are not propositions.
if a proposition is false, its truth
value is "false".
Example "x is greater than 2",
where x is a variable representing a
"Grass is green", and "2 + 5 = 5" are
number, is not a proposition, because
propositions.
unless a specific value is given to x we
can not say whether it is true or false,
The first proposition has the truth
nor do we know what x represents.
value of "true" and the second
"false".
Dr. R. Rajkamal 8
4
21-08-2020
Dr. R. Rajkamal 9
Solution
(I like logic and you like logic) or (you do not like logic)
(I like logic) and (you like logic or you do not like logic)
5
21-08-2020
Dr. R. Rajkamal 11
Connectives
Dr. R. Rajkamal 12
6
21-08-2020
Formation Rules
T and ⊥ Propositional Constants. They 1. T and ⊥ are propositions
stand for propositions which are ‘true’ 2. Each pi is a proposition, where i ∈ N.
and ‘false’ 3. If x is a proposition, then ¬x is a
proposition.
Both propositional variables (p) and 4. If x,y are propositions, then (x∧y),
propositional constants are (x∨y), (x→y), (x↔y) are propositions.
commonly called atomic propositions 5. Nothing is a proposition unless it
or atoms. satisfies some or all of the rules (1)-
(4). – Clousure Rule
The alphabet of Propositional Logic,
PL, is the set The set of all propositions is written as PROP.
“PROP is the smallest set that satisfies (1)-(4)”
{ ), (, ¬, ∧, ∨, →, ↔, T, ⊥, p0, p1, p2, . . .}
Dr. R. Rajkamal 13
7
21-08-2020
Dr. R. Rajkamal 15
Proposition or not?
Dr. R. Rajkamal 16
8
21-08-2020
can be abbreviated to
p1 ∨(p3 ∧ p6) → (p100 ↔ ¬p1)
Using abbreviations p,q, r, s for p1, p3, p6, p100, respectively, the abbreviated
proposition is
p∨(q∧r)→(s↔¬p)
Dr. R. Rajkamal 17
9
21-08-2020
10
21-08-2020
Theorem:
Let w be a proposition. Then exactly one of the following happens:
(1) w ∈ {T, ⊥, p0, p1, . . .}.
(2) w = ¬x for a unique x ∈ PROP.
(3) w = (x ◦ y) for a unique ◦ ∈ {∧, ∨,→,↔} and unique x, y ∈ PROP.
Proof
Due to the formation rules of a proposition, either w is atomic, or it is in one
of the forms ¬x or (x◦y).
We must show that in the two cases, the propositions x and y are unique.
Dr. R. Rajkamal 21
11
21-08-2020
The unique parse tree for a proposition has only atomic propositions on
its leaves.
2
Whereas if an expression is not a proposition, in any parse tree for the
expression some leaf will contain an expression other than an atomic
proposition.
Dr. R. Rajkamal 23
PROCEDURE PropDet
Input : Any string x over the alphabet of PL.
Output : ‘yes’, if x is a proposition, else, ‘no’.
2. Otherwise, scan x from left to right to get a substring w in one of the forms
¬p, (p∧q), (p∨q), (p→q), (p↔q);
where p,q are symbols not in the set { ), (, ¬, ∧, ∨, →, ↔}.
If not found, then report ‘no’; and stop.
If found, then replace w by p0; go to Step 1.
Dr. R. Rajkamal 24
12
21-08-2020
Propositions are built from the atomic propositions with the help of connectives.
Negate Bi-Conditional
Dr. R. Rajkamal 26
13
21-08-2020
Dr. R. Rajkamal 27
Dr. R. Rajkamal 28
14
21-08-2020
Check for
The interpretation j with j(p) = 1, j(q) = j(r) = 0
The table says that j ⊨ u.
Dr. R. Rajkamal 30
15
21-08-2020
A proposition w is called
valid, written as ⊨w, iff each interpretation of w is its model;
invalid iff it is not valid, and we write ⊭ w;
satisfiable iff it has a model;
unsatisfiable iff it is not satisfiable;
contingent iff it is both invalid and satisfiable;
the proposition T is defined to be satisfiable;
the proposition ⊥ is defined to be invalid.
Dr. R. Rajkamal 31
16
25-08-2020
Unit 1
Part 2 of 2
8/25/2020 Dr. R. Rajkamal 26
Propositions are built from the atomic propositions with the help of connectives.
Negate Bi-Conditional
Dr. R. Rajkamal 27
1
25-08-2020
Dr. R. Rajkamal 28
Dr. R. Rajkamal 29
2
25-08-2020
Check for
The interpretation j with j(p) = 1, j(q) = j(r) = 0
The table says that j ⊨ u.
Dr. R. Rajkamal 31
3
25-08-2020
A proposition w is called
valid, written as ⊨w, iff each interpretation of w is its model;
invalid iff it is not valid, and we write ⊭ w;
satisfiable iff it has a model;
unsatisfiable iff it is not satisfiable;
contingent iff it is both invalid and satisfiable;
the proposition T is defined to be satisfiable;
the proposition ⊥ is defined to be invalid.
Dr. R. Rajkamal 32
Dr. R. Rajkamal 33
4
25-08-2020
Determine whether ?
Propositions u and v are called equivalent,
p ∨ q ≡ (p→q)→q
u ≡ v,
iff each model of u is a model of v, and
each model of v is also a model of u.
Dr. R. Rajkamal 34
“If the band performs, then the hall will be full provided that the tickets are
not too costly. However, if the band performs, the tickets will not be too
costly. Therefore, if the band performs, then the hall will be full.”
Check the given argument is correct or not?
p : the band performs
The hypotheses are the propositions
q : the hall is (will be) full
p→(r→q), p→r, and the
r : tickets are not too costly
conclusion is p→q
Dr. R. Rajkamal 35
5
25-08-2020
Find out all (common) models of both p→(r →q) and p→r.
Evaluate p→q in the rows 2, 4, 6 since it does not matter whether p→q receives the truth
value 0 or 1 in these cases.
But if one of the rows 1, 3, 5, 7, 8 had 0 for p→q, then the consequence would not be valid
Dr. R. Rajkamal 36
Monotonicity
Paradox of Material Implication
Let Σ and Γ be sets of propositions, Σ ⊆ Γ, and
let w be a proposition.
A set of propositions Σ is unsatisfiable
(1) If Σ is unsatisfiable, then Γ is unsatisfiable.
iff Σ ⊨ w for each proposition w.
(2) If Σ ⊨ w, then Γ ⊨ w.
Reductio ad Absurdum
(DT: Deduction Theorem)
Let Σ be a set of propositions, and let
Let Σ be a set of propositions, and let x,y
w be a proposition.
be propositions. Then, Σ ⊨ x→y iff Σ∪{x} ⊨ y.
(1) Σ ⊨ w iff Σ∪{¬w} is unsatisfiable.
(2) Σ ⊨ ¬w iff Σ∪{w} is unsatisfiable.
Dr. R. Rajkamal 37