/* Given the alphabet {A,B}, the function Prefix(e.x1, e.x2) checks whether e.x1 is a prefix of e.x2. The function Concat is concatenation. The supercompiler is to check when e.x is a prefix of Concat('A'e.x, e.y). */ /***********************************************/ /* the input program */ /***********************************************/ $ENTRY Go { (e.x) e.y = >; } Prefix { () e.x = 'T'; (t.x e.z1) t.x e.z2 = ; ('A' e.x1) 'B' e.x2 = 'F'; ('B' e.x1) 'A' e.x2 = 'F'; (t.y e.x) = 'F'; } Concat { (e.x1) e.x2 = e.x1 e.x2; } /***********************************************/ /* the residual program */ /***********************************************/ /* $ENTRY Go { (e.x1) e.x2 = ; } Prefix_124_0 { () (e.x1) = 'T'; ('A' e.x1) (e.x2) = ; ('B' e.x1) (e.x2) = 'F'; } */ /* The loop Prefix_124_0 of the residual programm answers to the question given by the task: a word e.x is a prefix of word 'A' e.x e.y if and only if the word e.x consists only of letters 'A' and is not empty. */