Download CSE596, Fall 2015 Problem Set 1 Due Wed. Sept. 16

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Propositional calculus wikipedia , lookup

Rewriting wikipedia , lookup

Structure (mathematical logic) wikipedia , lookup

Quasi-set theory wikipedia , lookup

Ambiguity wikipedia , lookup

Propositional formula wikipedia , lookup

Laws of Form wikipedia , lookup

Canonical normal form wikipedia , lookup

Transcript
CSE596, Fall 2015
Problem Set 1
Due Wed. Sept. 16
Reading. Keep Dr. Ogihara’s notes and the text chapters 1 and 2 in mind. Then read the
course webpage’s handout on the Myhill-Nerode Theorem, which fills the same purposes as
the (in)famous “Pumping Lemma” but is better in my opinion (and also a UB-Cornell joint
product in 1958). Also read problem (A) below.
The first problem is “for discussion” but is not assigned for credit. Sometimes I will ask
for a proof of having followed the discussion, which can be a brief “bottom-line conclusion”
in your own words, and it will have 3 pts. of “checkoff credit” (graded for showing a basic
understanding but not fullness or accuracy). Here, however, the bottom-line is a preview of
things to come (much) later, so it is just FYI. It expands “Homework 1.4” in the Boolean
logic section of Chapter 1.
(A) “Homework 1.4” says to convert every Boolean formula into conjunctive normal
form. Here is the answer —the real questions start where the answer ends:
• Convert any part of the form A → B into (¬A) ∨ B. Here A and B might be big clumps
of the formula, but not necessarily all of it.
• Convert any part of the form A ↔ B into (A ∧ B) ∨ ((¬A) ∧ (¬B)).
• Convert any part of the form A XOR B into (A ∧ (¬B)) ∨ ((¬A) ∧ B). Do similarly for
NAND and any other logic gate other than AND, OR, NOT.
• Use DeMorgan’s laws as the text suggests to convert any part of the form ¬(A ∨ B) into
((¬A) ∧ (¬B)) and ¬(A ∧ B) into ((¬A) ∨ (¬B)). Reduce any resulting case of ¬¬C
into just C. The negation signs “sink in” until they are all directly on variables. We
can write ¬x where x is a variable as x̄, whereupon we call both x and x̄ literals. Well,
x̄is also called a “negated literal.”
• The last step is to convert any part of the form A ∨ (B ∧ C) into (A ∨ B) ∧ (A ∨ C).
This “brings out ∧.”
• When you can’t do the last step anymore, it means all the ∧ gates are on the outside,
with all the ∨ gates inside clumps called clauses whose only parts are (possibly negated)
literals. You can also cut down parentheses so thay are only bracketing each clause.
That’s the definition of conjunctive normal form (CNF).
An example of a formula in CNF is (x1 ∨ x̄2 ∨x3 )∧(x̄1 ∨x2 ∨x3 ). It is not a tautology—it
can be made false by the assignment x1 = 0, x2 = 1, and x3 = 0. This kills the first clause,
and because the ∧ gate is outside, the second clause cannot help. The formula is, however,
satisfiable—that is, its negation is not a tautology (either). The easiest way to satisfy it is to
set x3 = 1, whereupon you don’t even have to care about the values of the other variables.
But you can also satisfy it with x3 = 0 provided you give the same value to x1 , x2 . Now for
the questions:
(a) What must happen for a CNF formula to be a tautology?
(b) What happens when you apply the algorithm to the following two formulas? OK, this
is tedious to do directly by the algorithm, but if you can tell whether either of them is
a tautology you might find shortcuts.
((x ∧ y) → z) ←→ ((x → z) ∧ (y → z))
((x ∧ y) → z) ←→ ((x → z) ∨ (y → z))
(c) What happens when you apply the algorithm to a formula that is already in disjunctive
normal form (DNF), such as this one?
(r ∧ s ∧ t) ∨ (u ∧ v ∧ w) ∨ (x ∧ y ∧ z).
(d) The bottom line is that conversion to CNF provides a foolproof way to tell whether a
formula is a tautology, but is the algorithm practical?
For-credit portion
(1) Design a deterministic finite automaton with alphabet {0, 1} to recognize the language of binary numbers (in standard binary notation with leading zeroes allowed) that are
multiples of 5. It is your choice whether you prefer to include the empty string λ in this
language, or not—you must state your choice clearly. (Design Hint: Imitate the process of
binary long division by 101 with states denoting the five possible “carry values.”)
Then say what would happen if you represented the given number in 2-adic notation
rather than standard binary. If you have used a logical design then the change might not be
too painful. . . (18 + 9 = 27 pts.)
(2) Consider regular expressions without Kleene stars—or equivalently, consider expressions written as unions and concatenations of languages, such as we did in writing the
distributive law as A · (B ∪ C) = (A · B) ∪ (A · C). Define a notion of “disjunctive normal
form” for such expressions and give an algorithm for converting arbitrary expressions with
just union and concatenation to that form.
Suppose the basic languages in our expressions are just {c} for characters c in the
alphabet Σ, possibly including also the languages {λ} and ∅ “just for show” (they won’t
change anything). Note that without the Kleene star operation you can’t ever get an infinite
language this way. But show that every finite language L has such a “star-free” expression,
indeed one in your disjunctive normal form. Intuitively, how does this form relate to the set
of strings in L? (18 pts. total, for 45 on the set)