4.24 How to check if an expression is integer, when it has symbols in it?

I had case where I needed to check if something is integer or not. The problem is that the result had a symbol \(n\) in it. I need a way to tell Maple that to check if the result can be an integer given that \(n\) is also an integer.

Using type does not work, since can’t use assumptions. One way is to use coulditbe as follows

restart; 
expr:=n-1+2*m; 
vars:=indets(expr,And(symbol,Not(constant))); 
coulditbe(expr,integer) assuming op(map(Z->Z::integer,vars)) 
 
#  true
 

In the above indets(expr,And(symbol,Not(constant))) picks all variables in the expression, and assuming op(map(Z->Z::integer,vars)) makes assumption that each is integer.