UofT CSC 165 Course Log
Monday, 1 December 2014
Hmmmm
Monday, 24 November 2014
Hmmmmm
Saturday, 15 November 2014
Hmmmm
Thursday, 30 October 2014
Hmmmm
Friday, 24 October 2014
Hmmmmm
Hi, this week the professor said we were finishing up on proofs. I enjoyed the proofs section of the class. In high school, my teacher said epsilon delta proofs were hard, but they made more sense when the professor in this class did it. But when I tried thinking about it myself, it was frustrating. I felt good about the tutorial quiz this week. Even though I'm not that good with proofs, the problems are usually like the homework problems. I like them because I think they test people's understanding.
We started learning about sorting algorithms in class. To start, the professor asked us how we sort cards in our hands. Other people had specific ways they sort them. I thought about it, and I don't know how I sort my cards. I just move them around until they look sorted. Maybe I would be better if I knew how to sort my cards. My friend laughed and said I used bogosort, but it wasn't one of the algorithms in the lecture slides. Then he showed me it on wikipedia, and I don't think it was a good sorting algorithm. The professor said python uses timsort, so I should try to learn to sort my cards better.
Thursday, 16 October 2014
Hmmmm
Someone said that when you do ∃x, y, it should automatically mean x is different from y, because whenever you write ∃x, y you don't want them to be the same thing. It seemed right, but sometimes you don't care if x and y are the same. I thought of this example this week.
I say "The set S of positive even numbers excluding four is closed under addition." You say that's not true, and there's a counterexample: ∃x, y ∈ S, ¬(x + y ∈ S). But I don't think there are counterexamples if x and y are different. But if x and y are the same, 2 + 2 is 4 which is not in S.
So, sometimes when we use ∃x, y, we don't care if x and y are the same. Actually, in this example, it's important that x and y are generic.
This looks kinda short, so I will write about how one of my other classes related to CSC165. There was a question in a past midterm that said "the logic function f is true when any 2 of the inputs are true." My friend and I thought it meant "at least two are true", because if three inputs are true, there are "any 2" inputs that are true. But in the answer, "any" meant "only". In English, people might argue about exactly what things mean. But if I write it symbolically, I think most people would agree that "any two are true" is ∃x, y ∈ S, x not equal to y, x ∧ y. Now, it's clear that if three inputs are true, "any two are true" is still true. It's also clear that P(S) = ∃x, y, z ∈ S, x not equal to y not equal to z, x ∧ y ∧ z is a subset of Q(S) = ∃x, y ∈ S, x not equal to y, x ∧ y (the set of sets such that P holds is a subset of the set of sets such that Q holds). If P is a subset of Q, then P ⇒ Q. If Q(S), then we know three different inputs x, y, z are true. I can pick two for satisfying Q(S). Symbolic notation is good
Thursday, 9 October 2014
Hmmmm
Prove that f(n) = 1 − n is the only integer-valued function that defined on the integers that satisfies the following conditions:
a) f(f(n)) = n for all integers n
b) f(f(n + 2) + 2) = n for all integers n
c) f(0) = 1
I'm going to try to write it symbolically. Let F be the set of integer valued functions defined on the integers. ∀ f ∈ F, ∀ n ∈ Z, (f(f(n)) = n ∧ f(f(n + 2) + 2) = n ∧ f(0) = 1) ⇒ f(n) = 1 - n
Proof. The indents work in my word processor, but I don't know why my indents didn't work here, so I used dashes.
First I want to prove that f is one to one. I'm going to try to write that symbollically. ∀ x, y ∈ Z, (f(f(n)) = n ∧ f(f(n + 2) + 2) = n ∧ f(0) = 1) ⇒ (f(x) = f(y) ⇒ x = y)
Assume x, y ∈ Z # x, y are generic
- Assume f(f(n)) = n, f(f(n + 2) + 2) = n, f(0) = 1 # assume first antecedent
- - Assume f(x) = f(y) # assume second antecedent
- - - Let z = f(x) = f(y)
- - - z ∈ Z # f is an integer valued function function
- - - f(f(x)) = f(z) = x # f is defined on the integers
- - - f(f(y)) = f(z) = y
- - - Then x = y
- - Then f(x) = f(y) ⇒ x = y
- Then (f(f(n)) = n ∧ f(f(n + 2) + 2) = n ∧ f(0) = 1) ⇒ (f(x) = f(y) ⇒ x = y)
Then ∀ x, y ∈ Z, (f(f(n)) = n ∧ f(f(n + 2) + 2) = n ∧ f(0) = 1) ⇒ (f(x) = f(y) ⇒ x = y)
Now f is one to one.
Assume f ∈ F, n ∈ Z # f, n are generic
- Assume f(f(n)) = n, f(f(n + 2) + 2) = n, f(0) = 1 # assume the antecedent
- - Assume n | 2 (n is even)
- - - Then ∃ x ∈ Z, n = 2x # definition of even
- - - f(f(2x + 2) + 2) = 2x = f(f(2x))
- - - f(2x + 2) + 2 = f(2x) # f is one to one
- - - f(2(x + 1)) = f(2x) - 2
- - - Let a_x = f(2x)
- - - a_(x + 1) = a_x - 2
- - - a_x forms an arithmetic sequence
- - - a_0 = f(2 * 0) = 1
- - - d = -2
- - - a_x = a_0 + dx = 1 - 2x
- - - f(2x) = 1 - 2x
- - - Then f(n) = 1 - n
- - Then n | 2 ⇒ f(n) = 1 - n
- - Assume ¬(n | 2) (n is odd)
- - - Then ∃ x ∈ Z, n = 2x + 1 # definition of odd
- - - f(f((2x + 1) + 2) + 2) = 2x + 1 = f(f(2x + 1))
- - - f(2(x + 1) + 1) + 2 = f(2x + 1) # f is one to one
- - - Let a_x = f(2x + 1)
- - - a_(x + 1) = a(x) - 2
- - - a_x forms an arithmetic sequence
- - - a_0 = f(2 * 0 + 1) = f(1) = f(f(0)) = 0 # f is one to one
- - - d = -2
- - - a_x = a_0 + dx = -2x
- - - f(2x + 1) = -2x
- - - Then f(n) = 1 - n
- - Then ¬(n | 2) ⇒ f(n) = 1 - n
- - Then (n | 2) ∨ ¬(n | 2) ⇒ f(n) = 1 - n
- - Then f(n) = 1 - n
- Then (f(f(n)) = n ∧ f(f(n + 2) + 2) = n ∧ f(0) = 1) ⇒ f(n) = 1 - n
Then ∀ f ∈ F, ∀ n ∈ Z, (f(f(n)) = n ∧ f(f(n + 2) + 2) = n ∧ f(0) = 1) ⇒ f(n) = 1 - n