Page 21, Exercise 4
ADT Boolean is
objects:
TRUE, FALSE ∈ Boolean and the Boolean== the usual boolean operation.
where == return TRUE if tw set elements are the same, and TRUE otherwise.
| Boolean not(x) | ::= if (x) return TRUE return FALSE |
| Boolean and(x,y) | ::= if(not(x)) return FALSE if (not(y)) return FALSE return TRUE |
| Boolean or(x, s) | ::= if(x) return TRUE if (y) return TRUE return FALSE |
| Boolean xor(x, s) | ::= if(and(not(x), not(y))) return FALSE |
| Boolean implies(x, s) | ::= if (and(x, y)) return TRUE if (and(not(x),not(y))) return TRUE return FALSE |
| Boolean equivalent(x, s) | ::= if(and(not(x), not(y))) return TRUE if (and(x, y)) return TRUE return FALSE |
end Set