# Unexpected behavior of ForAll

Resolve[ForAll[n,Element[n,Integers],!IntegerQ[Sqrt[n^2-7 n-1]]]]


True

But as I know,when the n is $17$,Sqrt[n^2 - 7 n - 1] is $13$(integer).What's happen of this function?

• ForAll[] doesn't work that way. Resolve[ForAll[n, Element[n, Integers], ! IntegerQ[n]]] also evaluates to True. – Feyre Feb 13 '17 at 13:17
• @Feyre Funny,ForAll[n, ! IntegerQ[n]] will give True,too.Why? – yode Feb 13 '17 at 13:21

All functions ending in Q evaluate to True or False immediately. Therefore IntegerQ[x] is False if x has no value.

You are essentially writing

Resolve[ForAll[n, Element[n, Integers], True]]


so you get True.

IntegerQ is a "programming function" that tests the data type of the argument. It is not a "mathematical function" that will stay unevaluated with symbolic arguments and can represent a mathematical statement.

Use something \[Element] Integers instead.

• So how to write the code will be my original intention? – yode Feb 13 '17 at 14:12
• @yode Use Element or NotElement, as I said in the last line of the answer. Mathematica will not be able to solve this problem though. – Szabolcs Feb 13 '17 at 14:28
• Good lesson to me.Thanks. – yode Feb 13 '17 at 14:36