Specification in Verdect:
define TOGGLE( a?, b0!, .., b(k-1)! ) = pref *[ a?; b0!; .. ; a?; b(k-1)! ] endAlso available through this link
Specification in DI Algebra:
T(k) = T(k,0) where T(k,i) = a?; bi!; T(k,(i+1) mod k)Also available through this link.
Specification in DI Algebra:
# Generated by expexp.pl NAME ="T" I = { a? } O = { b0!, b1!, b2! } T_0_3 = a?; b0!; T_1_3 T_1_3 = a?; b1!; T_2_3 T_2_3 = a?; b2!; T_0_3Also available through this link.
Tk(a; b0, b1..., bk-1) / a b0 = Tk(a; b1, ..., bk-1, b0)
The k-Toggle satisfies Rules Y' and Z'.
When k is not a power of 2 (hence, k>2), also scheme 5 is needed. In this case, the resulting implementation does depend on the order. For instance, consider the implementation of a k-Toggle with k=5. One can start with a k-Toggle with k=8. to reduce it to a k-Toggle with k=5. This results in an implementation with 7 Toggles and 3 Merges.
Alternatively, we can first implement a k-Toggle with k=3 by reducing a k-Toggle with k=4 once according to scheme 5. This costs three Toggles and one Merge. Using scheme 4, the k-Toggle with k=3 can be made into a k-Toggle with k=6 by adding three Toggles `on the right'. The k-Toggle with k=6 can then be reduced to a k-Toggle with k=5 This implementation consists of 6 Toggles and 2 Merges.
Using scheme 4 to make a k-Toggle with k=6 from one Toggle (`on the left') and two k-Toggles with k=3 results in yet another implementation, costing 7 Toggles and 3 Merges.
Theorem: When constructing a k-Toggle with t Toggles and m Merges we must have k=t-m+1 and, hence, t>=k-1.
No information available
No information available
Exercise: What is an optimal implementation scheme for k-Toggles in terms of Toggles and Merges. The cost function can either be size or `average response time'.