What is that thing that is according to the Kena Upanishad pratibodha videtam.(realised in every state of mind): Kena Up. 2.3
Brahman is known when It is realised in every state of mind; for by such Knowledge one attains Immortality. By Atman one obtains strength; by Knowledge, Immortality.
Let me suggest that both the freedom of the will and the identity of the self are reflections in the mind of the nature of the Self even though our psychological investigations do not establish the Self or the freedom of the will. If you look for freedom in the psyche you won't find it. You are so to speak looking in the container at the contained and missing containing as such. It is this containing or the pervading of every state of mind by consciousness that gives rise to the idea of freedom even though the cerebral activity is, as material, law abiding. 'Pervasion' here does not imply an activity on the part of consciousness. This 'pervasion' gives allows the mind/brain to seem to be conscious even though because it is 'jada'(inert) it is not conscious by nature.
The scientific/psychological construction of the human mind is not adequate to the metaphysical understanding of what the mind is. Balanced by wisdom and good judgement it is adequate for practical purposes such as legal and interpersonal assessment. States of mind are not objects in the scientific sense and it is the position of Bergson that states of mind are all different and are never repeated.
The advaitin position on free will is sometimes presented as a compatibilist one. That is for another post.