Question 1.
Type your answer in a .txt file named Q1.txt:
For this circuit,
Show the values of all the internal subexpressions of the proposition as well as the value of the overall proposition, like it's done in the lecture notes, Chapter 0. (The truth table will have 4 rows --- fill in all the columns for all the logical operators for all 4 rows.)
For the remaining exercises, do your work with the CIS301 proof checker, using the checker's v (verbose) option, as demo-ed in class and as described in the Beginner's Guide, http://www.cis.ksu.edu/~schmidt/301s14/cis301/howtocheck.html.
IMPORTANT: As in all other posted examples and exercises, I have used blank spaces only to indent the code lines. Please be careful not to mix tabs and blanks in your indentations!
Question 2. Prove the assertion stated at the last line of the program. Place your solution in the file, Q2.py, and check it with the checker, generating the file, Q2A.py.htm.
# Q2.py x = readInt() y = x * 2 z = x + 1 x = x - 1 # prove: x + z == y
Question 3. Do the same here as in Question 2, with the file named Q3.py:
# Q3.py x = readInt() assert x > 0 a = x * 2 x = x + 1 # prove: a >= x and a > 0
Question 4. Do the same, but with Q4.py:
# Q4.py money = readInt() withdraw = readInt() assert money >= 0 and withdraw <= money m = money money = money - withdraw # prove: money >= 0 and withdraw + money == m
Bring your work with you to class on the 31st, so that we can review it on the board.