Instructor: Jeremy Johnson

Due date: Thursday May 23 at 9am

- Implement an interpreter for the proposition calculus using scheme.
You should use the following syntax
- < boolexp > → #t | #f [boolean constants]
- < boolexp > → variable [boolean variables]
- < boolexp > → (and boolexp ... boolexp)
- < boolexp > → (or boolexp ... boolexp)
- < boolexp > → (not boolexp)
- < boolexp > → (implies boolexp boolexp) [P => Q, where P is the first argument and Q is the second argument]
- < boolexp > → (equiv boolexp boolexp) [P <=> Q, where P is the first argument and Q is the second argument]

**and**and**or**) with more than two arguments to nested operators with just two arguments (similar to the way cond is handled in the scheme interpreter). - Use your boolean expression interpreter from question 1 to prove tautologies. I.E. a boolean expression that is true for all possible values of the variables. E.G. (or P (not P)), (equiv (or P Q) (or Q P)), (equiv (or P Q) (or P (and (not P) Q))). Your prover should generate all possible values for the variables occuring in the boolean expression [all possible bindings], and using your interpreter, check to verify that the expression is true for all possible variable bindings.
- Trace scheme interpreter from SICP using as input the following two
expressions [you will have to add =, *, - as primitive procedures for
this to work].
(define (fact n) (if (= n 0) 1 (* n (fact (- n 1))))) (fact 3)

You should indicate exactly how the interpreter interprets this code. - Modify the SICP interpreter to use dynamic instead of static scope. Provide an example where the same code provides two different answers depending on which scoping rule is used.
- Implement an interpreter for the mini language in scheme. Use the following representation for mini language programs.
- prog -> stmt-list
- stmt-list -> (stmt-seq)
- stmt-seq -> stmt | stmt stmt-seq
- stmt -> assign-stmt | if-stmt | while-stmt
- assign-stmt -> (assign identifier expr)
- if-stmt -> (if expr stmt-list stmt-list)
- while-stmt -> (while expr stmt-list)
- expr -> integer | identifier | (+ expr expr) | (- expr expr) | (* expr expr)