CS 2603 Homework 5 — More Equational Reasoning

Due Wednesday, Feb 22, 2012

SPECIAL NOTE: This assignment is actually due at the end of office hours (11:30 am) on Friday, Feb 24. However, if you turn it in at the start of class on Wednesday, Feb 22, I will turn it over the the TA and ask him to work on grading it ASAP, so that it can be of more use to you in preparing for the exam.

NOTE: If you are worried about potentially being late in submitting your assignment and losing 20%, turn in your assignment ahead of time. Do this by submitting it to me during office hours or by sliding it under my office door. Do not send assignments to me through email or leave them in my departmental mail box.

1. Motivation

Equational reasoning is a fundamental process of formal logic and the proof checker is an important tool for verifying these kinds of proofs as well. To understand these tools and their relationship to one another, it is import to gain experience with them.

2. Goal

The goal of this assignment is to give you additional experience with proofs using equational reasoning, the proof checker, and their relationship to one another.

3. Assignment

  1. Consider the equation: a → a = True

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

  2. Consider the equation: ¬True = False

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

  3. Consider the equation: ¬False = True

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

  4. Consider the equation: a ∧ False = False

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

  5. Consider the equation: a ∧ True = a

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

  6. Consider the equation: ¬(a ∧ b) = (¬a) ∨ (¬b)

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

  7. Consider the equation: a ∧ (b ∨ c) = (a ∧ b) ∨ (a ∧ c)

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

  8. Consider the equation: (w ∧ x) ∧ (y ∨ z) = (¬w ∨ (¬x ∨ ¬y)) → (w ∧ (x ∧ z))

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

  9. Consider the equation: (p ∨ q) ∧ q = q

    1. Prove this equation using equational reasoning.
    2. Convert this equation and your proof of it to equational proof-checker notation and check it using Hugs.

4. Important Notes on this Assignment

  1. NEW NOTE: Most of the equations you are to prove in this assignment are found on your handout of equations you may use in proofs. For example, the second equation you are to prove is identical to {negate True}. However, please recall that you are never allowed to use an equation to prove itself!

  2. NEW NOTE: If you use one of the equations you are required to prove in this assignment (call it X) in order to prove a higher numbered equation in this assignment (call it Y), then you must use your proven equation (X), rather than the equivalent named equation already in Stdm.lhs, when you use Hugs to prove the new equation (Y). For example, if you use {∧ distributes over ∨} to prove equation 8 of this assignment (hint, hint), then you must use your proven equivalent to {∧ distributes over ∨} because {∧ distributes over ∨} is equation 7 on this assignment. Also, when you name the equation in the proof checker, be sure not to use the name that the proof checker already uses for that equation.

  3. Warnings and Cautions

    The following words of advice come directly from Prof Page who has taught this course many times. Please pay them great heed!

    Warning! For almost all people, the most effective way to work on proofs is to distribute the work over several days. Work a couple hours a day, every day, on the problems. When you’ve worked a good while on one of the problems and find yourself stuck, try another problem. Eventually, problem by problem, you will discover a key that leads to a solution. It may seem that key comes to you suddenly, but somehow the hard work invested before the epiphany gradually builds the picture in your mind until the solution pops out. If you start working on this homework assignment the day before it’s due, you probably won’t finish it. That means you will have missed one of your only real opportunities to prepare for the examinations in this course.

    Importance of Finding Your Own Keys. Each problem that you fail to invest enough time in to find the key yourself reduces, substantially, your chances of passing the exams in this course. I advise you not to discuss a problem with someone else until you have found the key. If you have questions about the material, ask the instructor or the assistant. Email should work well for this. I don’t regard discussing the problems with others as cheating, as long as can explain to me whatever you turn in, but I want you to know that the more you rely on such discussions, the less likely it is that you will succeed on the exams.

    Important Alert! Homework problems provide your only real opportunity to study for exams. Studying the night before the exam will be of almost no use at all. If you have difficulties, come to see the Instructor or Teaching Assistant during office hours.

    How Much Time Will This Homework Take? Some of the problems may take hours to complete. Others, only a few minutes. Some problems may seem difficult to you that seem easy to others, and vice versa. There is no way to predict when or how the insights you will need to solve these problems will come to you. Also, expect some frustration in the process of using the proof checker. Just as in programming, you have to get all the required characters in the right order. All the commas, parentheses, case-sensitive names, etc have to be right. It can easily take an hour to get an already correct proof pushed through the proof checker.

  4. Adding parentheses around an entire statement creates a new statement with the same truth value as the original statement. Likewise, removing parentheses from around an entire statement creates a new statement with the same truth value as the original statement. Therefore, you may add parentheses to or remove parentheses from entire statements within your proofs as you see fit. However, inserting or removing parentheses within a larger statement may change its truth value and is, therefore, not allowed within these proofs. (We will talk later about when we can insert or remove parentheses within statements.)

    For example, if you find yourself at some point in your proof with the statement "X ∧ Y ∨ Z," but you need "(X ∧ Y ∨ Z)" instead, it would be fine to add the parentheses and proceed. Similarly, if you have "(X ∧ Y ∨ Z)," but you need "X ∧ Y ∨ Z" instead, you may remove the parentheses and proceed. However, if you have "X ∧ Y ∨ Z," but you need "X ∧ (Y ∨ Z)" or "(X ∧ Y) ∨ Z" instead, you are not allowed to add the parentheses. Similarly, if you have X ∧ (Y ∨ Z)" or "(X ∧ Y) ∨ Z" but need "X ∧ Y ∨ Z" instead, you are not allowed to remove the parentheses.

  5. Recall that "¬a" is, by definition, the same as "a → False." Therefore, you may substitute one for the other (either direction) in your proofs, as long as you cite this definition.

  6. Modified Note: Recall that you can use as rules in your proofs equations other than those on your handout sheet, provided that those equations have already been proven (in class or in your homework) and that the proof of the equation does not cite, directly or indirectly, the equation you are proving. An equation is "indirectly cited" if it is cited, directly or indirectly, in the proof an equation you are citing.

  7. Modified Note: You may also use already proven equations as rules in the proof checker. To do so, you need to tell the proof checker to use the equation as a rule using thmEq. For example "impSelf = thmEq (Imp A A) TRUE" (or, equivalently ((A `Imp` A) `thmEq` TRUE)) would tell the proof checker that there is an equation named "impSelf" that can be use as a rule by the proof checker.

    Note the phrase "already proven" in this description. Before you tell the proof checker to use impSelf as a rule, you are required to enter a proof of impSelf into the proof checker and run the proof checker on this proof.

  8. Don’t forget that a metavariable (such as ‘a’ or ‘b’ in a rule, whether from Natural Deduction or from Equational Reasoning) can stand for any WFF, not just a single variable. For example, you know that you could use {∧ER} with (A ∧ B) to derive A by substituting A for ‘a’ and B for ‘b’ in the rule. However, don’t forget that you could use {∧ER} with (A ∧ (B ∧ C ∧ (D ∨ (E → F) ∨ G) ∧ H)) to derive A as well, simply by substituting A for ‘a’ and (B ∧ C ∧ (D ∨ (E → F) ∨ G) ∧ H) for ‘b’ in the rule.

5. What to Turn In

You will turn in a typed or neatly written hard copy of your homework that shows all the proofs above in equational reasoning format and all of the requested proofs in proof checker notation. You will also need to submit an electronic copy of all of the requested proofs in proof checker notation.