:internal: add a function to determine if the expression is valid or not.