Whenever a person states what they believe and it contradicts the WordOfTheLord, we should ask them where they got their information.
As long as Adam was in fellowship with the Lord, Adam had only one source of information - the Truth. Once he chose to seek information outside of the Lord he sinned and lost his relationship with the Lord.
The Lord asks Adam a question that He knows the answer to, to see if Adam will compound his sin of disobedience with the sin of lying.