implement compose and transform
use variable for type A
start_length, end_length
prove correctness of apply and compose