Tuesday, November 11, 2008

Week 9

The test was not extremely difficult but I was unprepared due to my lack of understanding about loop invariants. The question involving the loop was the most difficult for me only for the fact that I did not know how to include an invariant that will help me in my proof. It was easy to prove that the function terminated but my proof was definitely not in the pattern of what we were taught (and was probably wrong). The rest of the questions were easy.

Finally a change in the flavor of the material, the regular expressions are a wonderful break from induction (unless were going to use that for this too...). They seemed very confusing at first (especially the Kleene star but by the end of a lecture, they made sense.) The proof was very bizare but I am sure that with practice these things will become easy.

Week 8

I did not attend the lecture and after writing the test I wish I had. It was very difficult to figure out the proofs for functions with loops simply from the lecture notes. The concept of a loop invariant, although seemingly useful, does not differ from a postcondition in my mind?

The assignment went by very well even with my limited amount of time to work through and understand it. The partner system helped very much and I am upset I never utilized partners before. The questions were very similar to those done in the lecture and it was not difficult to extend those ideas to the assignment.

Week 7

Proving correctness of a program is an interesting concept. Rather than the way we have been taught to check our code (through test cases), we now define preconditions and postconditions to see if they work every time the program is recursively called. I wonder if this would be too complex of a proof for one of our 207 assignments in order to avoid writing test cases. The concept itself is very interesting, yet the proofs themselves don't seem to be. Oh well.

The problem set was very straightforward. Probably one of the easier ones so far but it's always the stupid silly mistakes that make me lose marks. The only difficulties I encountered are determining what is a sufficient for these (non-numerical) proofs. I find I have to define what something like
# Postcondition: revString(s) returns a string with
# the characters of s in reverse order.
What does reverse order mean? If I am the one deciding it, can I just say reverse order is defined as:
revString(s[1:]) + s[0]




Sunday, October 26, 2008

Week 6

I did not attend lecture this week due to the damned A1 for CSC207 so my comments will be solely based on Prof Heap's evening lecture notes. 

Time complexity: We did this a bit last year in 165 (i think) and 148 so this is not new. However, applying the unwrapping principle to time complexities is a nice summation of some of the things we learned so far. I found it interesting how we were allowed to essentially ignore a majority of cases and do the proof for the cases we can, then come back to the other ones later. This strategy seems like it will become quite useful over time. (Since I am writing this retrospectively I know how handy it comes in for A2). The proof however, was very standard, maybe even obvious, after that. 

Week 5

I was hoping on seeing my test before posting this entry but it's pretty late as it is so I will reply to this with my comments about the test when I see it.

The lectures: Well the problem set brings another lost mark from a stupid mistake, but not a bad result anyway. We discussed finding closed forms for recursively defined functions and I found this quite interesting. I have myself wondered if there was an easier way to find those Fibonacci numbers, had I known the closed form those Grade 12 Data tests would have been so much easier. At least I have a new tool in my toolbox. Finding closed forms (using the exponential method) is pretty intuitive once I saw it but I do not believe I would have ever figured out something like that.

Obviously this technique can be applied to almost any recursively defined function in some way yet the Fibonacci one in my opinion is the most interesting. The rest of the proofs were essentially things ive seen before and did have educational value but didn't catch my interest.

Wednesday, October 8, 2008

Week 4

So my blog has been blocked. Apparently I have created a spam blog where I am spamming very offending links/comments? Now a "human" must review my blog to make sure I'm not spamming. Oh well, I can't fall behind my sLog.

So heres my thoughts on week 4. More induction! Except this time, we use induction on recursively defined functions. Recursion is pretty straight forward (unless you need to figure out how to code it at times) but when I'm doing computer science my brain does not want to think in terms of math, therefore I don't like "unwrapping". But I must admit, I have always found the Fibonacci patterns, despite their recursive nature, quite interest. Next we looked at binary trees and I rather enjoyed this proof. I'm not sure I would have easily seen the idea of "unwrapping" in order to keep both values in the equation relatively similar and I am glad to have seen this now, rather than on the test for the first time.

Yet there is one thing about this week's lecture, and I am asuming from hereon out, that I am beginning to think will frustrate me slightly. We are done with python, and all these problems with python sure aren't helping me remember my java syntax from highschool. I'm sure there's people who were are not required to begin learning java and appreciate the problems being in python but I am wondering if test questions can be written in our programming language of choice. Speaking off the test, it's tommorow! ahh!

Sunday, October 5, 2008

Week 3

So week 3 and the assignment are done.

The lectures this week were interesting. I enjoyed the circular proofs of the three induction principles. However, I find a problem with the way we chose to prove them. We said that we would need to take any one of the as an axiom and can prove the other two that way. I have no problems with any of the principles being axioms as they just seem obvious, but if they are axioms then none of them should require a proof. It seems very arbitrary to say "pick one, the other two need proofs". In short, they should all either be axioms or require proofs using something other than a different principle of induction.

The assignment was pretty easy (we will see if this statement holds true when I receive my marks). The first question was structured in such a way that the answer was obvious, although I'm sure that was intended as it was the first question. The second question, about the rotating lunch orders, I found very interesting. The proposition of creating lunch menus that do not differ by more than 1 choice is very easy, yet I find that I wasn't thinking of the algorithm. I somehow naturally knew what the structure should be and only after writing a few different sized lunch combinations did I notice the algorithm. The proof was straightforward. The final question with the golden ratio had me fooled for a little as I tried to equate the hint to the formula, rather than plugging in n1, and n2, into the formula to transform it into the form that the hint was. However, after I reached the n2/(n1-n2) form it was smooth sailing from there.