2014年9月29日星期一

Week 3: Negation

In the third week, we learned conjunction, disjunction and negation. At first, it was not hard to understand, because conjunction just means "and", and disjunction means "or". However, the "and" and "or" in logic is sometimes different from their meaning in daily life. When we translate English into logic language, we need to be careful about those difference.

Negation is to negate a statement. We should not only change the latter part of the sentence,  we also need to change ∀ into ∃ and vice versa.


It's new for me that the negation of P(x) => Q(x) can be P(x)⋀¬Q(x). We can understand this in English by saying the opposite of "if P is true, then Q is true" is "P is true and Q is not true". 

PS: P => Q equals to ¬P ⋁ Q, which is difficult to understand. Finally, I figured it out by using an example. If our teacher wins the lottery, then he will buy us a cake. If he doesn't win, no matter whether he buys us a cake, the implication will be true. And if he buy us a cake, no matter he wins the lottery, the implication will also be true. Only when he wins but doesn't buy the cake, the implication is false. So, the truth table is like the one on the last 20th page of the slide.

Another challenging thing for me is the distributive law. Although it's like the distributive law in multiplication [like a(b+c)=ab+ac], it might take some time to get familiar with it when using in logic.


In this student's slog this week, he/she said that the word "several" is confusing in "some courses have several prerequisites" because it can means infinite cases such as three, four, thirty and so on. At first, I have the same feeling. However, I figured it out later. What we need to write is a statement in which a course has two prerequisites. In that statement, we do not tell whether there are more prerequisites for this course, so that is exactly what "several" means. 


Since things are getting harder, hope I can hold it until December.

2014年9月23日星期二

Week 2: Quantifiers

The topic of CSC165 in the second week is quantifiers.
A language element which generates a quantification (such as "every") is called a quantifier. (From Wikipedia)

Some of the logic symbols like ∀, ∃ were introduced in high school, so it's quite easy to understand those quantified sentences.

In the implication section, I learned how to write an "if..., then..." sentence in math language.
And it was quite interesting to find out that if my mom told me that
"If you eat vegetables, then you can have dessert."
I might also have dessert, because she doesn't mention the case I don't eat vegetables. (Real life is different...)
Actually, we can write the sentence like: I eat vegetables => I have dessert.
We cannot tell whether the reverse and the negation are True, 
so the implication: "I don't eat vegetables => I have dessert" maybe True or maybe False.
However, the contrapositive of a statement is the same as the original sentence.
It's like: "I eat vegetables => I have dessert" equals "I didn't have dessert => I didn't eat vegetables".
They are both True of False.

The most tricky thing in this week must be "only if".
The professor said in the sentence "I'll go if you insist", "you insist" is antecedent, and "I'll go" is the consequent, which is easy to understand.
However, in the sentence "I'll go only if you insist" is on the opposite.
After the discussion with my friend, I finally figured it out.
In the first sentence, we know that You insist => I'll go, but we cannot indicate that if I go, then you must be insisting.
But in the second sentence, "I'll go only in the case that you insist" indicates that if I'll go, then you must be insisting. BUT, I may still not go if you are not insisting, so the reverse (first sentence) is not sure.
It's easy to understand that the phrase "if and only if" equals to "<=>", 
so "if P, then Q" means "P => Q" and "only if P, then Q" means "P <= Q"
(It's just my way to understand these kind of tricky sentences, I'm not sure whether they are technically right, though I think they are right.)

Week 1: Introduction

CSC165 is a course about expression.
In the first week, anything seems normal and not very hard to understand.

At the beginning, the professor showed a slide about the language ambiguity.
Since I'm not an English native speaking, it was a little bit difficult to point out the double meaning of some sentences. Fortunately, I understood that the professor tried to tell us the importance of precision in computer language.

After that, I learned how to write code about sets in python.
It's tricky that we don't write {x for x in S and x > 6} as we say, we use "if" instead of "and".

Then some more hard things appeared.
For example, for "all({x in S2 for x in S1}", it means for each elements in S1, if it is also in S2, then this single judgement is True, if all judgments are True, the the whole statement is True.
For example, S1 = {1,2,3}, S2 = {3,4}. Element 1 is in S1 but not in S2, so the first judgement is False. (Actually we can say the statement is False already) So do element 2. But 3 in S1 is also an element of S2, so we can change the statement into all({False, False, True}).

For the first week in U of T, I am exited and nervous. Courses are not so hard and I have plenty of free time. But since it's my first time to live in a place where people speak English only.
Hope I didn't make lots of grammar mistakes in the SLOG.

2014年9月12日星期五