subst var expr (Var name) | var == name = expr
                          | otherwise = Var name
subst var expr (Var name) | var == name = expr
                          | otherwise = Var name
subst var expr (Var name) | var == name = expr
                          | otherwise = Var name