<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3987380299046406517</id><updated>2011-04-21T21:05:44.782-07:00</updated><title type='text'>c7wangsi</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>13</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-2080951058650460932</id><published>2008-12-05T19:47:00.000-08:00</published><updated>2008-12-05T19:51:05.204-08:00</updated><title type='text'>Week 13</title><content type='html'>Last week of school! And my last post!&lt;br /&gt;&lt;br /&gt;We had out last term test today as well. It was easier than I thought - no questions on contex-free gramma. Hope I did better than my 2nd term test. Study hard and do well in the final exams! Most importantly, enjoy the holiday!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-2080951058650460932?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/2080951058650460932/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=2080951058650460932' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/2080951058650460932'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/2080951058650460932'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-13.html' title='Week 13'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-4699452429019397508</id><published>2008-12-05T19:41:00.000-08:00</published><updated>2008-12-05T19:47:44.448-08:00</updated><title type='text'>Week 12</title><content type='html'>The languages and their expressions are getting more and more complex.&lt;br /&gt;&lt;br /&gt;I don't quite understand why the language L that has an equal number of 0s and 1s violates the pumping lemma. Say for example, u = 1, v = 01, w = 0 and p = 3, then uv^kw \in L still.&lt;br /&gt;&lt;br /&gt;Ah, I know where I got it wrong! The example I gave is just a specially case in L, more generally it doesn't hold. For example u = 01, v = 01, w = 0 and p = 3, then uv^kw not \in L.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-4699452429019397508?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/4699452429019397508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=4699452429019397508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/4699452429019397508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/4699452429019397508'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-12.html' title='Week 12'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-6855089416524580518</id><published>2008-12-05T19:10:00.000-08:00</published><updated>2008-12-05T19:41:04.413-08:00</updated><title type='text'>Week 11</title><content type='html'>Try to prove the DFSA we derived for binary strings that include the substring 011 last week.&lt;br /&gt;&lt;br /&gt;P(x): = delta*(s, x)&lt;br /&gt;= { q_0, if x is zero-free&lt;br /&gt;= { q_1, if x has a 0 suffix but don't contain 011&lt;br /&gt;= { q_2, if x has a 01 suffix but don't contain 011&lt;br /&gt;= { q_3, if x contains 011.&lt;br /&gt;Claim: if Sigma = { 0, 1}, then \forall string x, P(x).&lt;br /&gt;Proof:&lt;br /&gt;Base Case: For x = epsilon, delta*(q_0, epsilon) = q_0 since x is zero-free. All other cases follow since they all have a false antecedent. So P(x) is true in this case.&lt;br /&gt;Induction Step: assume x' \in Sigma and P(x') is true. Let x = x'a, then x \in Sigma and either a = 0 or a = 1.&lt;br /&gt;Case 1: a = 0. Then delta*(s, x) = delta*(q_0, x'a) = delta(delta*(q_0, x'), 0)&lt;br /&gt;&lt;br /&gt;= { delta(q_0, 0), if x' is zero-free&lt;br /&gt;= { delta(q_1, 0), if x' has a 0 suffix but don't contain 011&lt;br /&gt;= { delta(q_2, 0), if x' has a 01 suffix but don't contain 011&lt;br /&gt;= { delta(q_3, 0), if x' contains 011&lt;br /&gt;&lt;br /&gt;= { q_1, if x has a 0 suffix but don't contain 011&lt;br /&gt;= { q_1, if x has a 0 suffix but don't contain 011&lt;br /&gt;= { q_1, if x has a 0 suffix but don't contain 011&lt;br /&gt;= { q_3, if x contains 011.&lt;br /&gt;So P(x) is true in Case 1.&lt;br /&gt;Case 2: a = 1. Then delta*(s, x) = delta*(q_0, x'a) = delta(delta*(q_0, x'), 1)&lt;br /&gt;&lt;br /&gt;= { delta(q_0, 1), if x' is zero-free&lt;br /&gt;= { delta(q_1, 1), if x' has a 0 suffix but don't contain 011&lt;br /&gt;= { delta(q_2, 1), if x' has a 01 suffix but don't contain 011&lt;br /&gt;= { delta(q_3, 1), if x' contains 011&lt;br /&gt;&lt;br /&gt;= { q_0, if x is zero-free&lt;br /&gt;= { q_2, if x has a 01 suffix but don't contain 011&lt;br /&gt;= { q_3, if x contains 011&lt;br /&gt;= { q_3, if x contains 011.&lt;br /&gt;So P(x) is true in Case 2.&lt;br /&gt;Thus P(x) is true.&lt;br /&gt;Therefore, if Sigma = {0, 1}, then \forall string x, P(x).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-6855089416524580518?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/6855089416524580518/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=6855089416524580518' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/6855089416524580518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/6855089416524580518'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-11.html' title='Week 11'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-6227393093351092824</id><published>2008-12-05T18:42:00.000-08:00</published><updated>2008-12-05T19:10:30.673-08:00</updated><title type='text'>Week 10</title><content type='html'>Try to prove L(((0 + 1)(0 + 1))*(0 + 1)) denotes the language of binary strings with odd length.&lt;br /&gt;&lt;br /&gt;P(x): if Sigma = {0, 1} and L_1 = { x \in Sigma  x has odd length}, then L_1 = L(((0 + 1)(0 + 1))*(0 + 1)).&lt;br /&gt;Claim: \forall x \in Sigma, P(x).&lt;br /&gt;Proof:&lt;br /&gt;(i) assume x \in Sigma and x \in L_1, then x has odd length, say x = 2*k + 1 for some k \in N. Then x can be written as a concatenation of some substrings of x, i.e. x = x_1x_2...x_kx_(k + 1), where&lt;br /&gt;x_i for 1 &lt;= i &lt;= k carries 2 characters either 0 or 1 and 2*k characters in total;&lt;br /&gt;x_(k + 1), the last character of x.&lt;br /&gt;Since x_i \in L((0 + 1)(0 + 1)), x_1x_2...x_k \in L(((0 + 1)(0 + 1))^k), and x_(k + 1) \in L(0 + 1), x = x_1x_2...x_kx_(k + 1) \in L(((0 + 1)(0 + 1))^k)L(0 + 1) = L(((0 + 1)(0 + 1))^k(0 + 1)), which is a subset of L(((0 + 1)(0 + 1))*(0 + 1)). So L_1 is a subset of L(((0 + 1)(0 + 1))*(0 + 1)).&lt;br /&gt;(ii) assume x \in Sigma and x is a typical string in the language denoted by L(((0 + 1)(0 + 1))*(0 + 1)). Then x can be written as a series of strings x_1x_2...x_k where each x_i carries 2 characters either 0 or 1 for some k \in N concatenated with a single character which can be either 0 or 1. Since each x_i has a length of 2, they have a length of 2*k in total. With the single character at the end, x = 2*k + 1 which is an odd number. So L(((0 + 1)(0 + 1))*(0 + 1)) is a subset of L_1.&lt;br /&gt;Since L_1 is a subset of L(((0 + 1)(0 + 1))*(0 + 1)) and L(((0 + 1)(0 + 1))*(0 + 1)) is a subset of L_1, L_1 = L(((0 + 1)(0 + 1))*(0 + 1)) according to the set property.&lt;br /&gt;Thus, \forall x \in Sigma, P(x).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-6227393093351092824?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/6227393093351092824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=6227393093351092824' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/6227393093351092824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/6227393093351092824'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-10.html' title='Week 10'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-5737995615449347875</id><published>2008-12-05T18:32:00.000-08:00</published><updated>2008-12-05T18:42:34.190-08:00</updated><title type='text'>Week 9</title><content type='html'>As what I have expected, term test 2 tested something about the loop invariant. I spent a lot of time on it and didn't finish the proof of termination of the program although that maight only take about one line or two. For the loop invariant part, I didn't think I got that right either, where I put a lot of things - a lot more that what it should be.&lt;br /&gt;&lt;br /&gt;However, I think I am kind of getting it now. From what I think, loop invariant should include at least the preconditions of the loop, like the nature of the variables in the loop; the condition of the loop (the part after while or if) for the loop to execute; and the postcondition of the loop written with the subscript i denoting the ith iteration of the loop, for that in the last iteration of the loop, it will just return what the postcondition says. I hope this would work.&lt;br /&gt;&lt;br /&gt;Anyways, I didn't do as well in term test 2 as in test 1. I should really investigate more on the loop invariant stuff for that there for sure would be a question on it on the final exam!&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-5737995615449347875?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/5737995615449347875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=5737995615449347875' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/5737995615449347875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/5737995615449347875'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-9.html' title='Week 9'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-8301460145183353551</id><published>2008-12-05T18:10:00.000-08:00</published><updated>2008-12-05T18:23:10.341-08:00</updated><title type='text'>Week 8</title><content type='html'>I am having some troubles stating the loop invariant, like the example we had during Wednesday's (Oct. 29th) lecture. For the function counter, how we worked out its loop invariant to be: a and b \in N, and 7*m + n = 7*a_i + b_i + c_i? I think I know why a and b has to be natural numbers, but for the latter part, the equation, I really didn't get it. Did we use the trail and error, or there is a systematic way for us to find the loop invariant for any while loops and for loops?&lt;br /&gt;&lt;br /&gt;I know the casual defination for the loop invariant is that any variable or relationship that is unchanged during the loop's execution. However, will that just be the loop's content itself?&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-8301460145183353551?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/8301460145183353551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=8301460145183353551' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/8301460145183353551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/8301460145183353551'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-8.html' title='Week 8'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-6412232551982704701</id><published>2008-12-05T17:40:00.000-08:00</published><updated>2008-12-05T18:07:20.823-08:00</updated><title type='text'>Week 7</title><content type='html'>Assignment 2 is so hard!&lt;br /&gt;&lt;br /&gt;Although question 1 is from assignment 1, I still didn't get it this time. The only part of this question that I felt confident about is I managed to show that if a ternary tree has n nodes, there will be (2*n + 1) positions available to add a new node onto the tree. Although I didn't include that into my solution to question 1 since I think it is kind of irrelevant to the problem, I will prove it here.&lt;br /&gt;&lt;br /&gt;P(n): if a ternary tree has n nodes, there will be (2*n + 1) positions on the tree available to add a new node.&lt;br /&gt;Claim: \forall n \in N, P(n).&lt;br /&gt;Proof: Base Case: For n = 0, the tree is the empty tree and there is only one position available to add a new node, namely the root. Since 1 = 2*0 + 1, P(0) is true.&lt;br /&gt;Induction Step: assume n \in N and P(n) is true, that is (2*n + 1) positions are available to be added for a ternary tree with n nodes. To add a new node, note that it will take up one old position but itself will open up three new positions for a newer node to be add. Thus, from n to (n + 1), 2 more positions are created. Since 2*n + 1 + 2 = 2*(n + 1) + 1, P(n + 1) is true.&lt;br /&gt;So \forall n \in N, P(n) =&gt; P(n + 1).&lt;br /&gt;Thus, \forall n \in N, P(n).&lt;br /&gt;&lt;br /&gt;That is everything. Hope the next assignment and the coming test won't be that hard.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-6412232551982704701?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/6412232551982704701/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=6412232551982704701' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/6412232551982704701'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/6412232551982704701'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-7.html' title='Week 7'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-5732539727142735888</id><published>2008-12-05T17:30:00.000-08:00</published><updated>2008-12-05T17:39:49.212-08:00</updated><title type='text'>Week 6</title><content type='html'>I think the Master Therom for divide and conquer is so complicated. It has a lots of parameters (like a, b l) and conditions (like equal piece division), and the asymptote bounds generated by it is complicated too. Hope we don't have to memorize the whole formula in a test or exam.&lt;br /&gt;&lt;br /&gt;One excited stuff: I got perfect on my term test 1! Although term test 1 is more like the stuff we did in CSC165, I am still happy about that, and should study even harder next time to keep the record, I guess.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-5732539727142735888?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/5732539727142735888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=5732539727142735888' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/5732539727142735888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/5732539727142735888'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-6.html' title='Week 6'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-3987377649579791384</id><published>2008-12-05T17:16:00.000-08:00</published><updated>2008-12-05T17:30:08.119-08:00</updated><title type='text'>Week 5</title><content type='html'>In the lecture on Oct 6th, we worked out a closed form for the function:&lt;br /&gt;              0, if n = 0&lt;br /&gt;H(n) = { 2, if n = 1&lt;br /&gt;              3*H(n - 1) - 2*H(n - 2), if n &gt; 1&lt;br /&gt;which is H(n) = 2^(n + 1) - 2. Here is a proof of this formula by complete induction.&lt;br /&gt;&lt;br /&gt;P(n): the closed form for the given function above is H(n) = 2^(n + 1) - 2.&lt;br /&gt;Claim: \forall n \in N, P(n).&lt;br /&gt;Proof: assume n \in N and P(0) /\ P(1) /\.../\P(n - 1) are true. Then either n &lt;= 1 or n &gt; 1.&lt;br /&gt;Case 1: n &lt;= 1. For n = 0, H(0) = 2^(0 + 1) - 2 = 2 - 2 = 0 which satisfies the defination of H(n) when n = 0. For n = 1, H(1) = 2^(1 + 1) - 2 = 4 - 2 = 2 which also satisfies the defination for n = 1. So H(0) and H(1) are true.&lt;br /&gt;Case 2: n &gt;= 1. According to the defination of H(n), H(n) = 3*H(n - 1) - 2*H(n - 2) = 3*(2^(n - 1 + 1) - 2) - 2*(2^(n - 2 + 1) - 2) = 3*2^n - 6 - 2*2^(n - 1) + 4 = 3*2^n - 2^n - 2 = 2*2^n - 2 = 2^(n + 1) - 2 which is the closed form for H(n).&lt;br /&gt;So \forall n \in N, P(0) /\ P(1) /\.../\ P(n - 1) =&gt; P(n)&lt;br /&gt;Thus, \forall n \in N, P(n).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-3987377649579791384?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/3987377649579791384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=3987377649579791384' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/3987377649579791384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/3987377649579791384'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-5.html' title='Week 5'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-5670241614528991582</id><published>2008-12-05T16:39:00.000-08:00</published><updated>2008-12-05T17:04:36.784-08:00</updated><title type='text'>Week 4</title><content type='html'>I don't quite understand the "Zero-pair free binary strings" example given in class on Oct. 1st. It says:&lt;br /&gt;&lt;br /&gt;def zpf(n):&lt;br /&gt;if n == 0: #return the number of empty BS that do not have pairs of adjacent zeros.&lt;br /&gt;if n == 1: #return the number of length one BS that do not have pairs of adjacent zeros.&lt;br /&gt;else: #how many strings of length n, in terms of n - 1 and n - 2?&lt;br /&gt;&lt;br /&gt;What does the last sentence mean? Does it mean that the strings of length n equals can be represented by the strings of length (n - 1) and (n - 2)? If so, how?&lt;br /&gt;&lt;br /&gt;The example we had in class was:&lt;br /&gt;&lt;br /&gt;00 and 10 in terms of n - 2&lt;br /&gt;01 and 11 in terms of n - 1&lt;br /&gt;&lt;br /&gt;That's even more confusing. Does it mean that if the string has length n ends with 00 or 10, the number of zero-free pairs equals that has a length (n - 2), and same argument for strings ends with 01 or 11? If so, why this is true?&lt;br /&gt;&lt;br /&gt;I guess I'll look through the textbook to see if there is a solution to my question.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-5670241614528991582?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/5670241614528991582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=5670241614528991582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/5670241614528991582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/5670241614528991582'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-4.html' title='Week 4'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-1482511051217542139</id><published>2008-12-05T15:09:00.000-08:00</published><updated>2008-12-05T16:39:26.865-08:00</updated><title type='text'>Week 3</title><content type='html'>I am a little bit behind, but here is the proof of the uniqueness of quotient and remainder Prof. Heap mentioned in last Friday's (Sept 19's) class.&lt;br /&gt;&lt;br /&gt;P(m): \forall n \in N\{0}, if \exists q and r \in N such that m = q*n + r and 0 &lt;= r &lt; n, then q and r are unique.&lt;br /&gt;Claim: \forall m \in N, P(m).&lt;br /&gt;Proof (by contradiction): assume m \in N. First we know that by the Principle of Well-Ordering, the set R = {r \in N  \exists q \in N, m = q*n + r} has a least element, call it r_1 and the q corresponding to this r_1 is q_1. Then m = q_1*n + r_1. If q_1 and r_1 are unique, then there exist a pair q_2 and r_2 such that m = q_2*n + r_2 and 0 &lt;= r_2 &lt; m =" q_1*n" r_1 =" q_2*n"&gt; r_1. Rearrange the above equation, we get (q_1 - q_2)*n = r_2 - r_1 &gt; 0. So q_1 &gt; q_2. Say q_1 = q_2 + k where k is some natural number greater than 0. Then m = q_1*n + r_1 = (q_2 + k) *n + r_1 = q_2*n + (r_1 + k*n) = q_2*n + r_2. So r_2 = r_1 + k*n &gt; n, contradicts to that 0 &lt;= r_2 &lt; n. So q_1 and r_1 are unique.&lt;br /&gt;So \forall m \in N, P(m).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-1482511051217542139?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/1482511051217542139/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=1482511051217542139' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/1482511051217542139'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/1482511051217542139'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-3.html' title='Week 3'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-7368791875862843746</id><published>2008-12-05T14:47:00.000-08:00</published><updated>2008-12-05T15:08:26.647-08:00</updated><title type='text'>Week 2</title><content type='html'>The postage problem we did in class on Sept 19th used complete induction to prove. Here the same problem is proved by simple induction.&lt;br /&gt;&lt;br /&gt;P(n): postage of n cents can be formed with 4- and 5-cent stamps.&lt;br /&gt;Claim: \forall n \in N, n &gt;= 12 =&gt; P(n).&lt;br /&gt;Proof:&lt;br /&gt;Base Case: for n = 12, 12-cent postage can be made by using three 4-cent stamps. So P(12) is true.&lt;br /&gt;Induction Step: assume n \in N and n &gt;= 12. Also assume P(n) is true, that is postage of n cents can be made by using 4- and 5-cent stamps. Then either n has at least one 4-cent stamp or n doesn't have any 4-cent postage.&lt;br /&gt;Case 1: n has at least one 4-cent stamp. Then for (n + 1) postage, we can exchange that 4-cent stamp to a 5-cent stamp to get one cent more postage. So P(n + 1) is true in this case.&lt;br /&gt;Case 2: n has no 4-cent stamp. Then n must have at least three 5-cent stamps, since 15 is the next natural number after 12 which is a multiple of 5. To get one more postage, we can simply exchange three 5-cent stamps (15 cents) to four 4-cent stamps (16 cents). So P(n + 1) is also true in this case.&lt;br /&gt;Thus, P(n + 1) is true.&lt;br /&gt;So \forall n \in N, (n &gt;= 12 and P(n) ) =&gt; P(n + 1)&lt;br /&gt;Therefore, \forall n \in N, n &gt;= 12 =&gt; P(n).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-7368791875862843746?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/7368791875862843746/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=7368791875862843746' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/7368791875862843746'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/7368791875862843746'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/12/week-2.html' title='Week 2'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3987380299046406517.post-250991009515796658</id><published>2008-09-29T19:03:00.000-07:00</published><updated>2008-09-29T19:05:09.976-07:00</updated><title type='text'>1st Post!</title><content type='html'>It is my 1st time using blogger. Hope everything works well! =)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3987380299046406517-250991009515796658?l=c7wangsi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://c7wangsi.blogspot.com/feeds/250991009515796658/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3987380299046406517&amp;postID=250991009515796658' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/250991009515796658'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3987380299046406517/posts/default/250991009515796658'/><link rel='alternate' type='text/html' href='http://c7wangsi.blogspot.com/2008/09/1st-post.html' title='1st Post!'/><author><name>c7wangsi</name><uri>http://www.blogger.com/profile/08358207125736527584</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='23' height='32' src='http://3.bp.blogspot.com/_3mDb8zEeTWU/SOGISuz5cuI/AAAAAAAAAAM/DYTyq9ZCoFc/S220/09.jpg'/></author><thr:total>0</thr:total></entry></feed>
