Relational program derivation and context-free language recognition