Posts

Showing posts with the label technique

1.9.3 Derived Variables Video

The technique of derived variables comes up in analyzing state machines. So let's just take a quick look at it together. So a derived variable is simply a function on the states of a state machine that assigns some value to the states. So it's just that kind of a function mapping. If the values happen to be, say, the non-negative integers, it's called non-negative integer value, but it could be real value, complex value, and even take on other kinds of odd kinds of values, not necessarily numerical. No pun there-- not odd numbers, but unusual values. So let's look at the example of the robot on the grid. The states were pairs of non-negative integers giving the coordinates of where the robot was. And one of the derived variables that we found was real useful was the sum value, sigma, of a state, which is defined to be x plus y. And this would be a non-negative integer valued derived variable. So the word "derived" comes because we're making i...

1.2.3 Proof by Cases

PROFESSOR: Another basic proof technique is called Proof By Cases, which we prove something by breaking it up into pieces that are easy to prove but that together cover all possibilities. Let's look at an explicit, simple example from computer science. Here's a Java logical expression. The way to decipher this is that the double vertical bar means "or" in Java. And the double ampersand means "and" in Java. So this is a conditional test, an IF test, that is the guard on a bunch code to be executed if this test comes out to be true. Let's read the test. If x is greater than 0, or x is less than or equal to 0, and y is greater than 100, go ahead and do the code that's in there indicated by the vertical dots. We're going to assume here that x and y are variables that are declared to be of type floating point, [? or a ?] real number, or integers for that matter. OK. Now what I claim is this code can be improved if it's rewritten in t...