# CS 2603 Homework 8 — Induction Redux

## Due Friday, Apr 8, 2011

NOTE: This assignment is due by 5:00 pm on Friday, April 8, 2011. As I will be in and out of my office before 5:00 pm that day, please turn in your assignment by giving it to me ahead of time during my office hours or by sliding it under my office door if I am not in my office when you turn it in. Do not send assignments to me through email or leave them in my departmental mail box.

## 1. Motivation

Induction is a fundamental process of formal logic and is widely applicable in mathematics, computer science, software engineering, computer engineering, electrical engineering, and elsewhere. To thoroughly understand this processes, it is import to gain lots of experience with it.

## 2. Goal

The goal of this assignment is to give you experience with proofs using induction.

## 3. Assignment

1. Consider the process of exponentiation denoted an in which the base a is any numerical type and the exponent n is a non-negative integer. We will create a function power to provide the functionality of exponentiation with integer exponents.

1. Give the type definition of power.
2. Write the axioms for power, defining power in terms of the normal multiplication operator * that you have known about since grade school.

2. Consider the fact that ab+c = ab * ac, regardless of the values of a, b, and c, so long as a is a number and b and c are non-negative integers.

1. Formally state this fact as a theorem in terms of a, b, and c (all properly quantified), power, +, and *. Be sure to give the Universe of discourse for a, b, and c.
2. Prove ∀b.ab+c = ab * ac by induction on b. (You may rename b to be n if it makes it easier for you to think about the induction.)
3. Prove ∀c.ab+c = ab * ac by induction on c. (You may rename c to be n if it makes it easier for you to think about the induction.)

Hint: You should be able to prove 2b and 2c using only your axioms from 1b, grade school arithmetic, and P(n) (in the induction, of course).

Note that once you have proven 2b and 2c, you may treat the theorem you wrote in 2a as a theorem called {ab+c} for Problem 3, below.

3. Consider the fact that ax1+x2+…xn = ax1 * ax2 * … axn, regardless of the values of a, n, and x1, x2xn, so long as a is a number, n is a non-negative integer, and x1, x2xn are also non-negative integers.

1. Formally state this fact as a theorem in terms of a, xs (where xs is the sequence [x1, x2xn]), sum and map (from the lectures), power (from Problem 1 of this homework), and times (from homework 7).
2. Prove the theorem you have just stated.

Hint: You may use the theorem {ab+c} for this proof.

4. Consider concat (which we are referring to orally as "big concatenation") for concatenating a sequence of sequences, the axioms for which were covered during lecture.

1. Prove the following theorem: ∀n.P(n) where P(n) ≡ length(concat[xs1, xs2, … xsn]) = sum[length(xs1), length(xs2), … length(xsn)]
2. Prove (concat xss) = (foldr (++) [ ] xss), assuming that there are a finite number of sequences in xss, and all of those sequences have finite length.

## 4. Important Notes on this Assignment

1. 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.

2. 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.

3. Don’t forget that a metavariable (such as ‘a’ or ‘b’ in a rule, whether from Natural Deduction, Equational Reasoning, or Induction) can stand for any WFF, not just a single variable. For example, you know that you could use {∧ER} with ∀x.f(x) ∧ ∃y.g(y) to derive ∀x.f(x) by substituting ∀x.f(x) for ‘a’ and ∃y.g(x) for ‘b’ in the rule. However, don’t forget that you could use {∧ER} with ∀x.f(x) ∧ (∃y.g(y) ∧ (¬∃z.h(z) ∧ (¬∀w.i(w) ∨ (j(x) → k(y)) ∨ l(z)) ∧ m(a))) to derive ∀x.f(x) as well, simply by substituting ∀x.f(x) for ‘a’ and ∃y.g(y) ∧ (¬∃z.h(z) ∧ (¬∀w.i(w) ∨ (j(x) → k(y)) ∨ l(z)) ∧ m(a)) 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 work specified above. You will not need to submit anything electronic for this homework.