Homework 02
Homework 02
Homework 02
due: January 23
Problem 1. Consider the following inductively defined set of “good” strings of a’s and b’s:
• Seed: The empty string is good.
• Rule 1: If s is good, then a s b is good.
• Rule 2: If s is good, then b s a is good.
• Rule 3: If s1 , s2 are good, then s1 s2 is good.
(b) Give a characterization of the good strings: i.e., a property P such that a string s is good if
and only if s has property P .
(Your characterization should be non-trivial; e.g., P cannot be “all good strings”.)
(d) Prove that every string that satisfies your P is good. (Completeness.)
Problem 2. (a) Prove that → distributes over ∧, i.e., that the following formula is a tautology:
p → (q ∧ r) ↔ (p → q) ∧ (p → r) .
(b) Prove that part (a) is not true if we swap → with ∧, namely the formula
p ∧ (q → r) ↔ (p ∧ q) → (p ∧ r) .
Problem 3. For each of the following formulas, prove that the formula is valid or give an inter-
pretation to show that it is not valid.
(a) ∀u P (u) → R(u) → ∀uP (u) → ∀uR(u) .
(b) ∀uP (u) → ∀uR(u) → ∀u P (u) → R(u) .
(d) isEqual(x, y), for “the binary numbers represented by x and y are equal”.
Problem 5 (BONUS). Let T be any rooted tree. Let v by any node of T . The subtree of T rooted
at v is the set of all nodes x for which every path from the root of T to x goes through v. To attach
to v another rooted tree T 0 is simply to draw an edge from v to the root of T 0 . (Note that a rooted
tree need not be binary —each node may have any number of children.)
Now consider the following rule for modifying a rooted tree T :
Problem Sets: Homework 02 3