In reply to Have_A_Doubt:
Constraints involving inputs to function get solved before calling the function. See this post. The built-in iterative sum() method gets unrolled into an equation and does not behave like a function call.
I don’t understand the next part of your question. Why do you need to check for non-zero sizes if you already have constraints to keep them non-zero? Also, please explain what you meant by “Unfortunately doesn’t work in declarative Context”