# Demonstration 2
## Problem 1: Boolean Blasters
(define my-not
(lambda (b)
(if b #f #t)))
(define my-and
(lambda (b1 b2)
(if b1 b2 #f)))
(define my-or
(lambda (b1 b2)
(if b1 #t b2)))
### Claim 1:
**Claim** : `(my-not (my-and #t #f)) ≡ #t`
Left Hand Side:
```
(my-not (my-and #t #f))
--->(my-not (#f))
--->#t
```
Right Hand Side:
#t
Hence the claim is valid.
### Claim 2: There exists a boolean b1 such that for all booleans b2, (my-or b1 b2) ≡ #t.
For all booleans b2,
**if b2 == #t**,
Let b1 be #t
Evaluation:
(my-or b1 b2)
-> (my-or #t #t)
-> #t
**if b2 == #f**,
Let b1 be #t
Evaluation:
(my-or b1 b2)
-> (my-or #t #f)
-> #t
Therefore, the required boolean b1 is #t for (my-or b1 b2) ≡ #t to be valid for all booleans b2.
Hence the claim is valid.
### Claim 3 (Negation is an Involution):
### For any boolean b, (my-not (my-not b)) ≡ b.
For any boolean b,
**if b == #t**,
Evaluation:
(my-not(my-not b))
-> (my-not(my-not #t))
-> (my-not(#f))
-> #t
**if b == #f**,
Evaluation:
(my-not(my-not b))
-> (my-not(my-not #f))
-> (my-not(#t))
-> #f
Hence the claim is valid.
### Claim 4 (De Morgan’s Law): For any pair of booleans b1 and b2,
### (my-not (my-and b1 b2)) ≡ (my-or (not b1) (not b2)).
For any pair of booleans b1 & b2,
**if b1 == #t & b2 == #t**,
Left Hand Side:
(my-not (my-and b1 b2))
->(my-not (my-and #t #t))
->(my-not (#t))
->#f
Right Hand Side:
(my-or (not b1) (not b2))
->(my-or (not #t) (not #t))
->(my-or #f #f)
->#f
**if b1 == #t & b2 == #f**,
Left Hand Side:
(my-not (my-and b1 b2))
->(my-not (my-and #t #f))
->(my-not (#f))
->#t
Right Hand Side:
(my-or (not b1) (not b2))
->(my-or (not #t) (not #f))
->(my-or #f #t)
->#t
**if b1 == #f & b2 == #t**,
Left Hand Side:
(my-not (my-and b1 b2))
->(my-not (my-and #f #t))
->(my-not (#f))
->#t
Right Hand Side:
(my-or (not b1) (not b2))
->(my-or (not #f) (not #t))
->(my-or #t #f)
->#t
**if b1 == #f & b2 == #f**,
Left Hand Side:
(my-not (my-and b1 b2))
->(my-not (my-and #f #f))
->(my-not (#f))
->#t
Right Hand Side:
(my-or (not b1) (not b2))
->(my-or (not #f) (not #f))
->(my-or #t #t)
->#t
Hence the claim is valid
## Problem 2: The Corporate World
### Claim: (pay '("Programmer" n t s)) ≥ (pay '("Manager" n t s))) for any employee with name n, time spent t, and shoe status s whenever (not (senior? '("Programmer" n t s))) and (not (senior? '("Manager" n t s)).
We work with an assumption that neither programmers nor managers have worked 5 years or more as neither of them are senior and for seniority for programmers need only 5 years.
**if t < 2 & s = #f**
prog-base=5;
Left hand side
(pay '("Programmer" n t s))
->(* 5 4)
-> 20
Right hand side
(pay '("Manager" n t s))
-> 5
**if t < 2 & s = #t**
Left Hand Side
(pay '("Programmer" n t s))
->(* 5 8)
-> 40
Right hand side
(pay '("Manager" n t s))
-> 5
**if t > 2 & s = #f**
Left Hand Side
(pay '("Programmer" n t s))
->(* 5 4)
-> 20
Right hand side
(pay '("Manager" n t s))
-> (* 5 2)
-> 10
**if t > 2 & s = #t**
Left Hand Side
(pay '("Programmer" n t s))
->(* 5 8)
-> 40
Right hand side
(pay '("Manager" n t s))
-> (* 5 2)
-> 10
## Problem 3: Zero Is The Hero
###### 1
(define (dropzeroes l)
(cond ((null? l)
'())
((equal? 0 (car l))
(dropzeroes (cdr l)))
(else
(cons (car l) (dropzeroes (cdr l))))))
2