Calibration Homework: Regular Languages, Order Reasoning, Wilson's Theorem, Exercises of Advanced Computational Complexity

Solutions to homework problems from a computer science engineering (cse) 200 course in spring 2010. The problems cover topics such as regular languages, reasoning about order, wilson's theorem, and the maximum independent set. The solutions include proofs and explanations for each problem.

Typology: Exercises

2012/2013

Uploaded on 04/24/2013

bandana
bandana 🇮🇳

4.4

(36)

87 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSE 200 Spring 2010
Calibration Homework Solutions
Chris Calabro and Russell Impagliazzo
April 10, 2012
1 Regular languages
Prove that Regk+1 is a proper superset of Regk.
It is immediate from the definition that Regk+1 is a superset of Regk. We
need to show that the inclusion is proper.
To do this, we need to exhibit a language Lk+1 in Regk+1, i.e., that is
accepted by a k+ 1 state finite automaton, but not in Regk, that is, cannot be
accepted by any kstate finite automaton.
Let Lk+1 ={x {0} ||x|= 0 mod k+ 1}of strings over a one-symbol
alphabet whose length is evenly divisible by k+1. Let Abe the automaton with
states 0, ..k, with 0 as the start state and only accepting state, and transitions
δ(q, 0) = q+ 1 mod k+ 1, i.e., upon reading the next symbol, we go to the next
state, unless we are in the last, in which case we go to the initial state.
We can see by induction that 0lends in state lmod k+ 1. since this is true
for l= 0, and if 0lis in state lmod k+ 1, 0l+1 ends in state (lmod (k+1))+ 1
mod (k+ 1) = (l+ 1) mod (k+ 1).
Since the only accepting state is 0, then 0lis accepted if and only if l
mod (k+ 1) = 0, which is by definition if and only if 0lLk+1.
Thus, automaton Ais a k+ 1 state machine that accepts Lk+1, so Lk+1
Regk+1.
Let A0be any at most kstate automaton. Consider the states A0reaches
on λ, 0,00,000, ...0k, where λ= 00is the empty string. Since there are k+ 1
such strings, and A0has fewer than k+ 1 states, two of these end at the same
state of A0. Let these two be 0i,0j, with 0 i<j k. Then 0i0k+1j=
0k+1+ijmust end at the same state as 0j0k+1j= 0k+1. Now 0k+1 Lk+1 ,
but 0k+1+ij6∈ Lk+1, since its length is between 1 and ksince 0 i<jk.
Thus, if the state reached on both strings is accepting A0accepts a string not
in Lk+1, and if it is rejecting, A0rejects a string in Lk+1 . So in neither case
does A0recognize Lk+1. Since A0was an arbitrary DFA with at most kstates,
Lk+1 6∈ Regkas needed, so Regk6=Regk+1 and the inclusion is proper.
1
pf3

Partial preview of the text

Download Calibration Homework: Regular Languages, Order Reasoning, Wilson's Theorem and more Exercises Advanced Computational Complexity in PDF only on Docsity!

CSE 200 Spring 2010

Calibration Homework Solutions

Chris Calabro and Russell Impagliazzo

April 10, 2012

1 Regular languages

Prove that Regk+1 is a proper superset of Regk. It is immediate from the definition that Regk+1 is a superset of Regk. We need to show that the inclusion is proper. To do this, we need to exhibit a language Lk+1 in Regk+1, i.e., that is accepted by a k + 1 state finite automaton, but not in Regk, that is, cannot be accepted by any k state finite automaton. Let Lk+1 = {x ∈ { 0 } ∗ ||x| = 0 mod k + 1} of strings over a one-symbol alphabet whose length is evenly divisible by k +1. Let A be the automaton with states 0, ..k, with 0 as the start state and only accepting state, and transitions δ(q, 0) = q + 1 mod k + 1, i.e., upon reading the next symbol, we go to the next state, unless we are in the last, in which case we go to the initial state. We can see by induction that 0l^ ends in state l mod k + 1. since this is true for l = 0, and if 0l^ is in state l mod k + 1, 0l+1^ ends in state (l mod (k + 1)) + 1 mod (k + 1) = (l + 1) mod (k + 1). Since the only accepting state is 0, then 0l^ is accepted if and only if l mod (k + 1) = 0, which is by definition if and only if 0l^ ∈ Lk+1. Thus, automaton A is a k + 1 state machine that accepts Lk+1, so Lk+1 ∈ Regk+1. Let A′^ be any at most k state automaton. Consider the states A′^ reaches on λ, 0 , 00 , 000 , ... 0 k, where λ = 0^0 is the empty string. Since there are k + 1 such strings, and A′^ has fewer than k + 1 states, two of these end at the same state of A′. Let these two be 0i, 0 j^ , with 0 ≤ i < j ≤ k. Then 0i 0 k+1−j^ = 0 k+1+i−j^ must end at the same state as 0j^0 k+1−j^ = 0k+1. Now 0k+1^ ∈ Lk+1, but 0k+1+i−j^6 ∈ Lk+1, since its length is between 1 and k since 0 ≤ i < j ≤ k. Thus, if the state reached on both strings is accepting A′^ accepts a string not in Lk+1, and if it is rejecting, A′^ rejects a string in Lk+1. So in neither case does A′^ recognize Lk+1. Since A′^ was an arbitrary DFA with at most k states, Lk+1 6 ∈ Regk as needed, so Regk 6 = Regk+1 and the inclusion is proper.

2 Reasoning about order

Let f (n) be a positive, integer-valued function on the natural numbers that is non-decreasing. Show that if f (2n) ∈ O(f (n)), then f (n) ∈ O(nk) for some constant k. Is the converse also always true? First, if f (2n) ∈ O(f (n)), by definition of order, there are constants n 0 > 0 , c > 0 so that for all n > n 0 , f (2n) ≤ cf (n). (Note this is similar to the recurrence: T (n) = cT (n/2), and the proof that f is polynomial is just another proof of the Master Theorem). We’ll first prove that f is polynomial on powers of 2, then use monotonicity to conclude the same thing for other values. Without loss of generality, assume c > 1 and that n 0 is a power of 2, n 0 = 2i. Let c′^ = f (n 0 )/ci. We’ll prove by induction that for j ≥ i for n = 2j^ , f (n) = f (2j^ ) ≤ c′cj^ = c′(2j^ log^ c) = c′nlog^ c. The claim is true for j = i, by definition of c′. If f (2j^ ) ≤ c′cj^ , then f (2j+1) = f (22j^ ) ≤ cf (2j^ ) ≤ c′ccj^ = c′cj+1, so the claim holds inductively. Then for any n ≥ n 0 , let n′^ = 2dlog^ ne^ be the next power of 2; n ≤ n′^ ≤ 2 n, so f (n) ≤ f (n′) ≤ c′(n′)log^ c^ ≤ c′(2n)log^ c^ = c′cnlog^ c. Picking n 0 and cc′^ in the definition of O, we have f (n) ∈ O(nlog^ c). The converse isn’t always true. We give a counter-example Let f (n) =

22

dlog log ne

. Then f (n) ≤ 22

log log n+ = 22 log^ n^ = n^2 , so f (n) ∈ O(n^2 ). However, if n = 2^2 l , f (n) = n and f (2n) ≥ n^2. Since a gap of n occurs for infinitely many n, f (2n) is NOT in O(f (n)).

3 Wilson’s Theorem

The integers modp that are non-zero form a group under multiplication, in that each element 1 ≤ x ≤ p − 1 has a multiplicative inverse x−^1 so that x ∗ x−^1 = 1 mod p. You can quote an algebra text book for this, but we’ll give a proof here. Let fx(y) = xy mod p be a function from the integers mod p to the integers modp, i.e., from 0, ..p − 1 to 0, , ..p − 1. If fx(Y ) = fx(z) then xy = xz mod p, so p divides xy − xz = x(y − z). Thus, either p divides x, or p divides y − z. But both x and y − z are not zero and have absolute value less than p, so p cannot divide them evenly, a contradiction. Therefore, fx is 1-1, and since its domain and range have the same size, it is also onto. In particular, 1 is in the range, and has a unique preimage y, where fx(y) = xy mod p = 1 This y is x−^1. Note that x = x−^1 means that x^2 = 1 mod p, which means that p divides x^2 − 1 = (x − 1)(x + 1) Thus, either x = 1 or x = p − 1 are the two values where x = x−^1. Then we can pair up all the remainders between 2 and p−2 into pairs of the form x, x−^1 , and have each remainder in exactly one pair. Therefore, Thus, if we look at the product 2(3)...(p − 2), each remainder will cancel with its inverse, leaving 1 mod p. Then (p − 1)! mod p = 1(p − 1)Π 2 ≤x≤p− 2 x mod p = 1 ∗ − 1 ∗ 1 mod p = − 1 mod p Therefore, p divides (p − 1)! + 1.