module _ where open import bool open import eq open import nat open import nat-thms {- 0. set up agda. Visit the installation section of the agda website: https://agda.readthedocs.io/en/latest/getting-started/installation.html Also, get a copy of the text book: https://dl.acm.org/citation.cfm?id=2841316 The book points to the IAL agda library but it points to an old version. You want the latest, which you can get here: https://github.com/cedille/ial If that causes you trouble, there is a virtual machine that has everything set up that's linked from the course webpage. To solve the rest of these exercises, I recommend you create a file in the same directory as the IAL library you've checked out (icky, I know). I will grade your homework by putting it there to try it out. It is also possible to use a `.agda-lib` file but don't worry if you don't get that sorted out. Keystroke quick reference (but see the text!) c-c c-l: load the buffer & typecheck c-c c-,: tell me what's in the hole c-c c-.: tell me the type of the thing that's in the whole (the "Have") c-c c-c: case split on the variable that's in the hole c-c c-a: do an easy proof c-c c-r: replace the hole with its current contents (ie finish this case/proof) meta-. : go to the definition of whatever thing the cursor is on top of; can also be typed with two keystrokes: esc and period -} {- 1. Do exercises 1.1 and 1.2 (page 14) in the text. Just write what they evaluate to here. You don't need to open bool.agda as this file already imports it, but you're welcome to. NB: opening bool.agda will be useful to understand `imp` in the optional part of problem 3. -} {- 2. Do exercise 2.3 (page 41) in the text -} {- 3. prove the following identities: -} curry : ∀ (b1 b2 b3 : 𝔹) -> b1 imp (b2 imp b3) ≡ (b1 && b2) imp b3 curry b1 b2 b3 = {!!} demorgan : ∀ b1 b2 -> ~ (b1 && b2) ≡ ~ b1 || ~ b2 demorgan b1 b2 = {!!} imp-not-or : ∀ b1 b2 -> ~ b1 || b2 ≡ b1 imp b2 imp-not-or b1 b2 = {!!} {- 4. We did right distributive in class; state and prove that multiplication also distributes on the left, eg, for any three numbers, x, y, and z: z * (x + y) ≡ z * x + z * y -} {- 5. Prove commutivity of multiplication. Note that the proof is in the IAL; feel free to look, but give it a try on your own first. The idea of the proof is similar to that of commutivity of addition. You case split and then, in each case need a helper lemma. One that says what happens when you multiply by zero on the right and one that says how you call "peel off one succ", roughly speaking. -}