# MD exercises1

```Lic. in Informatics and Computing Engineering (L.EIC)
Discrete Mathematics
1- Semantics of Propositional Logic
(lab class 1)
⇒ 1.1 For each of the following sentences, say whether it is a proposition. If so, state whether it is true or
false.
(a) Porto is the capital of Portugal.
(e) 1 + 2 + 3 = 6
(b) In 1910 the Portuguese Republic was proclaimed.
(f) 7 is an even number.
(c) Shall I compare thee to a summer's day.
(d) 1 + 2 + 3
(g) x + y is an even number.
(h) There is an x such that 7 + x is an even number.
1.2. Let p and q be the propositions \I play the lottery&quot; and \I win the jackpot &quot;, respectively. Express
each of the following compound propositions as a sentence in natural language (English or Portuguese):
(a) &not;p
(d) p → q
(b) p ∧ q
(e) q → p
(c) &not;p ∨ &not;q
(f) &not;p → &not;q
⇒ 1.3 Considering the priority conventions of logical operations given in the course (&not;&lt; ∧ &lt; ∨ &lt; → and →
right associative), for each of the following formulas draw its syntactic tree and indicate its subformulas:
(a)
(b)
(c)
(d)
(e)
p ∧ &not;q → &not;p;
p ∧ (&not;q → &not;p);
&not;(s → (&not;(p → (q ∨ &not;s))));
p → (&not;q ∨ (q → p));
(p → q) ∧ (&not;r → (q ∨ (&not;p ∧ r))).
⇒ 1.4 Construct truth tables for each of the following propositions.
(a) p → p
(c) (p ∧ q) → &not;(p ∨ q)
(b) &not;q ∧ (p → q)
(d) &not;(p ∨ q) → (&not;p ∧ &not;q)
⇒ 1.5 When v(p) = V and v(q) = F determine if |=v ϕ, where ϕ is:
(a) (p ∨ q) → (p ∧ q);
(b) (p ∨ &not;q) ∧ (&not;p ∧ q);
(c) (p → q) ∧ (p → &not;q);
(d) p → (q → (p ∨ q));
(e) ((p → q) → p) → p;
1.6. Using truth tables or the semantic equivalences given in class (boolean algebra), show the following
equivalences between propositions.
(a) &not;(p → q) ⇔ p ∧ &not;q
(b) &not;p → q ⇔ &not;q → p
(c) p → (q → r) ⇔ q → (p → r)
(d) (p → q) → p ⇔ p
(e) (p ∨ q) → r ⇔ (p → r) ∧ (q → r)
1.7. Assigning truth values to p, q, and r investigate how many of the disjunctions p ∨ &not;q, &not;p ∨ q, q ∨ r,
q ∨ &not;r, &not;q ∨ &not;r can be simultaneously true.
⇒ 1.8 Which of the following statements are valid? Justify.
(a) (p → q) ∧ (p → r) ⇔ (p → (q ∧ r))
(b) (p → r) ∧ (q → r) ⇔ ((p ∧ q) → r)
(c) (p ∧ q) ∨ r ⇔ (p ∨ r) ∧ (q ∨ r)
1.9. For the following formulas indicate, justifying, if they are tautologies, satis able or contradictions.
You can start by simplifying the formulas using semantic equivalences. For each of the formulas that
you think is not a tautology or a contradiction, indicate an assignment that makes the formula true
and another that makes the formula false.
(a) (p → (q ∨ r)) ∨ (r → &not;p);
(b) p → (q → &not;(&not;q → &not;p));
(c) (p → q) → (&not;p → &not;q);
(d) p → (q → (p ∨ q));
(e) (q → r) → ((&not;q → &not;p) → (p → r));
(f) (p ∨ q) → (q → (p ∧ q));
(g) (p → q) ∧ &not;((q → s) → (p → s));
(h) (p → q) ∧ (&not;r → (q ∨ (&not;p ∧ r)));
(i) (p ∨ q) → (p ∧ q)
(j) (p ∨ &not;q) ∧ (&not;p ∧ q)
2
(k) ((p ∨ q) ∧ r) ↔ ((p ∧ r) ∨ (q ∧ r))
1.10. Justify the truth or falsity of each of the following statements where p, q, r and s are propositional
variables.
(a) |= (p ∧ &not;p) → (p ∧ &not;r).
(b) |= (q ∨ &not;r) → (q ∧ &not;q).
(c) {(p → q) ∨ r, ((p → q) ∨ r) → &not;r, (p → q) → (q → r)} |= &not;q.
(d) {(p ∨ q) → r)} |= (p → r) ∨ (q → r).
⇒ 1.11 Without building the truth table, justify the truth or falsity of each of the following statements where
p, q, r and s are propositional variables.
(a) |= (p → (((q → p) → p) → r).
(b) |= (p → (q → s)) → (q → (p → s)).
(c) |= (p → (q → r)) → ((p → q) → (p → r)).
(d) |= ((p ∧ q) → (s ∨ t)) → ((p → s) ∨ (q → t)).
1.12. Justify the truth or falsity of each of the following statements, where Γ and Σ represent sets of formulas
and ϕ, ψ, θ, γ represent formulas of propositional logic. If the statement is false, you must give a
counterexample indicating particular values of the sets or formulas for which the statement is false. If
the statement is true you must justify using the de nitions.
(a) |= (θ ∨ ϕ) → (&not;θ → ϕ).
(b) {ϕ → ψ, ψ → ϕ} |= (ϕ ∨ ψ) → (ϕ ∧ ψ).
(c) {ψ → (&not;ϕ ∨ γ), &not;γ} |= &not;ϕ → &not;ψ.
(d) If ϕ, ψ |= θ → γ and ϕ |= θ then ϕ, ψ |= γ.
⇒ 1.13 Justi es the truth or falsity of each of the following statements, where Γ and Σ represent sets of
formulas and ϕ, ψ, θ, γ represent formulas of propositional logic. If the statement is false, you must
give a counterexample indicating particular values of the sets or formulas for which the statement is
false. If the statement is true you must justify using the de nitions.
Σ, then Σ |= θ.
If Σ |= θ and Γ Σ, then Γ |= θ.
If Γ |= θ and Σ |= θ, then Γ \ Σ |= θ.
If Γ |= θ and Σ Γ then Σ \ Γ |= θ.
If Σ |= θ then Σ \ Γ |= θ.
If Σ |= θ and Σ Γ then Σ [ Γ |= θ.
(a) If Γ |= θ and Γ
(b)
(c)
(d)
(e)
(f)
⇒ 1.14 For each of the truth functions (a), (b) and (c), construct a formula in disjunctive normal form and
a formula in conjunctive normal form:
3
p
V
V
V
V
F
F
F
F
q
V
V
F
F
V
V
F
F
r
V
F
V
F
V
F
V
F
(a )
(b )
(c )
V
V
V
V
F
V
V
V
F
V
F
V
V
V
F
F
V
F
V
F
V
F
V
F
1.15. For each of the following formulas determine an equivalent formula in disjunctive normal form and
another in conjunctive normal form.
(a) &not;(p → (&not;(q ∧ (&not;p → q))));
(b) p → (&not;q → &not;(p → q));
(c) &not;(p → (&not;(q ∧ (&not;p → q))));
(d) (p → q) → (&not;p → &not;q);
(e) ((p → q) → p) → p;
(f) p → &not;(q → &not;(p → q));
(g) (p → q) ∧ (&not;r → (q ∨ (&not;p ∧ r)));
(h) (p → q) ∧ (&not;q → (p ∨ &not;q));
(i) p → (q → &not;(&not;q → &not;p));
(j) p → (q → (p ∧ q));
(k) (p → q) → (&not;p → &not;q);
(l) ((p ∨ q) → (r ∧ s)) → (p ∨ &not;r);
(m) (p → q) ∧ &not;((q → s) → (p → s));
⇒ 1.16 Sets of connectives
(a) Show that the logical connectives {&not;, ∨} are a universal set. That is, propositions of the form
p → q, p ↔ q, and p ∧ q can be written using only the connectives &not; and ∨.
(b) De ne a new connective ∧ as follows:
p
V
V
F
F
q
V
F
V
F
p∧q
F
V
V
V
Show that the propositions &not;p, p ∧ q, and p ∨ q can be written using only the connective ∧.
Conclude that ∧ is universal.
1.17. Write a program (in your favourite language) to manipulate propositional logic formulas with the basic
connectives: negation, disjunction, conjunction and implication.
(a) Given a formula the program must allow for the following options:
4
– given as assignment of variables, calculate the value of the formula
– calculate the truth table of the formula
– determine if the formula is satis able, contradiction or tautology
– get an equivalent formula in conjunctive normal form
– get an equivalent formula in disjunctive normal form
(b) Given two formulas, determine whether one is a semantic consequence of the other, concluding
whether or not they are equivalent.
Laws of semantic equivalence
ϕ ∧ ψ
ϕ ∨ ψ
&not;(ϕ ∧ ψ)
&not;(ϕ ∨ ψ)
(ϕ ∧ ψ) ∧ θ
(ϕ ∨ ψ) ∨ θ
(ϕ ∨ ϕ)
(ϕ ∧ ϕ)
(ϕ ∧ ψ) ∨ θ
(ϕ ∨ ψ) ∧ θ
&not;&not;ϕ
ϕ→ψ
⇔
⇔
⇔
⇔
⇔
⇔
⇔
⇔
⇔
⇔
⇔
⇔
ψ ∧ ϕ
ψ ∨ ϕ
(&not;ϕ ∨ &not;ψ)
(&not;ϕ ∧ &not;ψ)
ϕ ∧ (ψ ∧ θ)
ϕ ∨ (ψ ∨ θ)
ϕ
ϕ
(ϕ ∨ θ) ∧ (ψ ∨ θ)
(ϕ ∧ θ) ∨ (ψ ∧ θ)
ϕ
&not;ϕ ∨ ψ
5
(commutativity)
(commutativity)
(DeMorgan's Law)
(DeMorgan's Law)
(associativity)
(associativity)
(idempotence)
(idempotence)
(distributiveness)
(distributivity)
(Double negation)
```