The CLOG-SLOG is back!
CSC165 has begun, and the change is material is refreshing for now. Given that we haven't really touched much code, I am inclined to believe the course will remain fairly theoretical. So be it. I can handle theory.
The lectures have remained mainly in the field (or Venn diagram, if you will) of logic and Venn diagrams so far. I am familiar with these sorts of techniques from some logic lectures in high school, although there are some differences. Our work has mostly covered "if" at the moment ("only if" just recently reared its head) and "iff" still has a class or two to emerge fully. For now, I've made a small table to help me work through implications. It's neat how different "if" and "iff" ultimately are when determining information from a statement. Observe:
In these tables, we are checking to see whether our implication is TRUE or FALSE each time. What is interesting is that a regular "if" only limits a contradiction - when A occurs but B does not, even though A implies B. Anything goes if A does not occur, as the right column shows.
By contrast, "iff" excludes all results but the implication: B can only happen if A happens first (which is another way of stating "B only if A" - for this scenario at least, and as far as I can tell).
I don't know why the example comes to mind, but I like to consider an apocalyptic prophecy in this scenario. If 2012 or Ragnarok is upon us, then everyone will die very quickly. That's an "if" statement, and if 2012 or Ragnarok is NOT upon us (~A), then...?
Well, there are other ways to have everyone die very quickly. So don't get too hopeful if 2012 or Ragnarok is not upon us: that doesn't mean you're safe - there could be something else brewing. The Rapture, for instance.
The Rapture is a bit more strict compared to 2012 or Ragnarok. If and only if you were a good person while alive, you will go to heaven during the Rapture. If you weren't good enough, tough. Enjoy hell on earth.
One thing about "if" statements is that they can be more precise when there's fewer options. If a bit isn't 1, then it's 0. If a bit isn't 0, then it's 1. This can be used in statements in programs easily: if the value is True, then print "success!" Barring errors, you know that this code won't ever print anything aside from "success!":
def bool_success(value):
"""Return "success!" if value boolean is True."""
return "success!" if value
But again, now the "if" is just functioning as an "iff," since it's waiting for 1 particular possibility to occur. That's how I like to conceive of it: "if" checks for 1 possibility to produce the result, but doesn't care if another possibility triggers it (consider an "elif" statement which produces the same result after an "if", or an "or" statement within an "if"), while "iff" is the only way to get a particular result (all other answers lead elsewhither).
The other area I briefly mentioned that we touched on was Venn diagrams, a very useful tool for visualizing how areas interact. I am enjoying the opportunity to learn the new symbols ("for all" and "there exists," to name two) and the new terminology ("converse", "contrapositive") although I admit it can be disorienting if I lose focus. Nonetheless, all seems to mesh together in a fun set of patterns:
my TA imparted a very useful trick to remember when testing universal or existential claims, which he referred to as "big or small" - distinguishing between when an example or counterexample is needed (just one thing to find!), or when we need to prove no examples or counterexamples exist (check all the things!). This has helped somewhat.
From here on, it will be a matter of seeing how the Venn diagrams can grow more complicated: we've already looked at subsets and intersections - but is there any way a Venn diagram can express an "or" visually?
No comments:
Post a Comment