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" and \I win the jackpot ", respectively. Express each of the following compound propositions as a sentence in natural language (English or Portuguese): (a) ¬p (d) p → q (b) p ∧ q (e) q → p (c) ¬p ∨ ¬q (f) ¬p → ¬q ⇒ 1.3 Considering the priority conventions of logical operations given in the course (¬< ∧ < ∨ < → and → right associative), for each of the following formulas draw its syntactic tree and indicate its subformulas: (a) (b) (c) (d) (e) p ∧ ¬q → ¬p; p ∧ (¬q → ¬p); ¬(s → (¬(p → (q ∨ ¬s)))); p → (¬q ∨ (q → p)); (p → q) ∧ (¬r → (q ∨ (¬p ∧ r))). ⇒ 1.4 Construct truth tables for each of the following propositions. (a) p → p (c) (p ∧ q) → ¬(p ∨ q) (b) ¬q ∧ (p → q) (d) ¬(p ∨ q) → (¬p ∧ ¬q) ⇒ 1.5 When v(p) = V and v(q) = F determine if |=v ϕ, where ϕ is: (a) (p ∨ q) → (p ∧ q); (b) (p ∨ ¬q) ∧ (¬p ∧ q); (c) (p → q) ∧ (p → ¬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) ¬(p → q) ⇔ p ∧ ¬q (b) ¬p → q ⇔ ¬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 ∨ ¬q, ¬p ∨ q, q ∨ r, q ∨ ¬r, ¬q ∨ ¬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 → ¬p); (b) p → (q → ¬(¬q → ¬p)); (c) (p → q) → (¬p → ¬q); (d) p → (q → (p ∨ q)); (e) (q → r) → ((¬q → ¬p) → (p → r)); (f) (p ∨ q) → (q → (p ∧ q)); (g) (p → q) ∧ ¬((q → s) → (p → s)); (h) (p → q) ∧ (¬r → (q ∨ (¬p ∧ r))); (i) (p ∨ q) → (p ∧ q) (j) (p ∨ ¬q) ∧ (¬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 ∧ ¬p) → (p ∧ ¬r). (b) |= (q ∨ ¬r) → (q ∧ ¬q). (c) {(p → q) ∨ r, ((p → q) ∨ r) → ¬r, (p → q) → (q → r)} |= ¬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) |= (θ ∨ ϕ) → (¬θ → ϕ). (b) {ϕ → ψ, ψ → ϕ} |= (ϕ ∨ ψ) → (ϕ ∧ ψ). (c) {ψ → (¬ϕ ∨ γ), ¬γ} |= ¬ϕ → ¬ψ. (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) ¬(p → (¬(q ∧ (¬p → q)))); (b) p → (¬q → ¬(p → q)); (c) ¬(p → (¬(q ∧ (¬p → q)))); (d) (p → q) → (¬p → ¬q); (e) ((p → q) → p) → p; (f) p → ¬(q → ¬(p → q)); (g) (p → q) ∧ (¬r → (q ∨ (¬p ∧ r))); (h) (p → q) ∧ (¬q → (p ∨ ¬q)); (i) p → (q → ¬(¬q → ¬p)); (j) p → (q → (p ∧ q)); (k) (p → q) → (¬p → ¬q); (l) ((p ∨ q) → (r ∧ s)) → (p ∨ ¬r); (m) (p → q) ∧ ¬((q → s) → (p → s)); ⇒ 1.16 Sets of connectives (a) Show that the logical connectives {¬, ∨} are a universal set. That is, propositions of the form p → q, p ↔ q, and p ∧ q can be written using only the connectives ¬ 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 ¬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 ϕ ∧ ψ ϕ ∨ ψ ¬(ϕ ∧ ψ) ¬(ϕ ∨ ψ) (ϕ ∧ ψ) ∧ θ (ϕ ∨ ψ) ∨ θ (ϕ ∨ ϕ) (ϕ ∧ ϕ) (ϕ ∧ ψ) ∨ θ (ϕ ∨ ψ) ∧ θ ¬¬ϕ ϕ→ψ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ⇔ ψ ∧ ϕ ψ ∨ ϕ (¬ϕ ∨ ¬ψ) (¬ϕ ∧ ¬ψ) ϕ ∧ (ψ ∧ θ) ϕ ∨ (ψ ∨ θ) ϕ ϕ (ϕ ∨ θ) ∧ (ψ ∨ θ) (ϕ ∧ θ) ∨ (ψ ∧ θ) ϕ ¬ϕ ∨ ψ 5 (commutativity) (commutativity) (DeMorgan's Law) (DeMorgan's Law) (associativity) (associativity) (idempotence) (idempotence) (distributiveness) (distributivity) (Double negation)