Signature:
a : --> T
f : T --> T
g : T × T --> T
h : T --> bool
Axioms: For all x,y : T,
(1) h(a) = false
(2) h(f(x)) = ¬(h(x))
(3) g(x,a) = x
(4) g(x,f(y)) = g(f(f(x)),y)
For the sake of brevity, we can abbreviate the expression
(a) Find a g-free expression (i.e., one having no occurrences of g) that is equivalent to
(b) Using your result from (a), simplify the expression
(c) By examining the axioms (and perhaps working out some more examples similar to that given in (a)), you should be able to discern a fairly simple rule by which to determine a g-free expression equivalent to
(d) Suppose that we were to add a fifth axiom to our system:
(5) g(f(x),y) = g(x,f(y))
Show that, after including this axiom, we have that, for all m>0,
From this it follows that fm(a) = fn(a) for all m,n > 0. Thus, the type T that we specified has at most two distinct values, a and f(a). Note that, in using an axiom, you may apply it in either direction (i.e., not only in the more usual left-to-right fashion but also from right-to-left).
(e) Supposing, as in (d), that axiom (5) has been added, and using the conclusion mentioned there (i.e., that f(a), f2(a), f3(a), etc., etc., all denote the same element of T) show that the resulting system is inconsistent. To do this, simply show that there exist two expressions, say E and F of type T such that E and F denote the same element of T but such that h(E) and h(F) have distinct values (of type bool).
2. Supply axioms to complete an algebraic specification of the deque abstract data type, which combines the capabilities of stacks and queues. That is, a deque is a linear collection of items allowing insertion, deletion, and observation at both ends.
The signature is as follows:
empty : --> Deque
isEmpty : Deque --> Bool
frontOf : Deque --> Elem
rearOf : Deque --> Elem
frontInsert : Deque × Elem --> Deque
rearInsert : Deque × Elem --> Deque
frontDelete : Deque --> Deque
rearDelete : Deque --> Deque
It is suggested that you devise your axioms in such a way that every Deque-expression (excepting those that denote the empty deque) can be rewritten into one of the two forms
where fI and rI are abbreviations for frontInsert and rearInsert, respectively.
This will make it easy to devise axioms for frontOf and rearOf so that all expressions of the form frontOf(E) or rearOf(E), where E is a Deque-expression not denoting the empty deque, can be rewritten into an expression in which neither frontOf nor rearOf occurs.