The book (for the latecomers, "The Truth Machine" by James Halperin), to its credit, doesn't try to explain HOW it is done, you just understand that it has been done. It is a good read, no matter what you believe about the future; but it develops a lot of the threads discussed here-- AI, nanomachines, alt. medicine, cloning, cryogenics-- as a secondary plot to the main. (Each chapter, 3 - 5 years later than the previous, starts with related and unrelated current headlines to keep the reader up to speed).
While I don't think that it is technically impossible, one of the things that bothered me is that the machine would "flicker" when it detected a partial truth or a withholding of facts, which expands the complications of such a machine infinitely.
As far as the sociological aspects of such a machine, one aspect was an initial wave of suicides. In this book the market embraced it, however, to eventually having "wrist truth machines" for when a girl asks her man if she looks good today.
I wonder. The other thing, of course, is that kind of invention would be so dangerous to the people in power (such as our Perjurer-in-Chief =) ) that it would probably be squashed and destroyed immediately. At least, it would be denied federal funding.