A shot to the head has Simon (James McAvoy) forgetting where he stashed his Goya, which leads him to try hypnosis in “Trance.” (Photo By: Susie Allnutt)

Danny Boyle plays fast and loose with reality in “Trance,” a lurid, propulsive, twisty and trippy thriller about an amnesiac man who gets hypnotized in order to remember where he has hidden a stolen, multimillion-dollar painting. You’re never quite sure whether what you’re seeing is actually happening or merely the result of a character’s post-hypnotic suggestion. Like “Inception,” a film with which it bears obvious similarities, it’s premised on the mind’s ability to fool itself.

That’s one of the film’s pleasures. Three others are the main cast.

James McAvoy plays Simon, an employee of an art auction house who, after a blow to the head, forgets what he has done with a canvas he’s helping a gang of criminals steal. Vincent Cassel plays Franck, the suave yet ruthless mobster who will stop at nothing to get the painting. And Rosario Dawson plays Elizabeth, the opportunistic hypnotherapist Franck hires to unlock Simon’s unconscious. That’s after Franck’s unsuccessful attempt to jog Simon’s memory by having his goons pull out Simon’s fingernails.

Yes, “Trance” is surprisingly, even unnecessarily, violent, as it escalates toward a grisly climax. There’s also a scene of startlingly graphic nudity.

That one, at least, is essential, seeing as Simon’s knowledge of the fine points of, er, female grooming trends in art history is a key plot point. Let’s just say that you will come out of this movie knowing nearly as much about the topography of Dawson’s naked body as her ex-boyfriend, Boyle, probably does. It’s hot, but also a little voyeuristic.

What’s nicest about McAvoy, Cassel and Dawson is that none of them plays a wholly sympathetic — or wholly unsympathetic — character. Of the three, McAvoy probably has to stretch the most, playing a gambling addict with a history of drug use (and other misbehaviors it would not be nice to reveal, for spoiler reasons). That shows, as he never looks totally comfortable here.

Cassel, however, was born to play sexy, debonair bad guys. Dawson surprises in her role, which allows Elizabeth to have the upper hand for much of the film, as a woman who can make men do what she wants with the snap of her fingers. One scene features Elizabeth attempting to put Franck and his gang (Danny Sapani, Matt Cross and Wahab Sheikh) under hypnosis, to intriguing effect. The movie’s greatest kicks come from watching the three protagonists vie to maintain their leverage — through sex, hypnosis, deception, willpower and, inevitably, the barrel of a gun.

There are, however, some problems. Chief among them is the notion that the purloined painting (Francisco de Goya’s 1797-1798 “Witches in the Air”) would be worth, to a thief, anything close to what it might fetch at open auction. You can’t just fence such a famous artwork the way you would stolen silverware. It’s too recognizable.

Another problem is the way Boyle, working from a screenplay by Joe Ahearne and John Hodge, unpacks the film’s densely interlocking twists and turns of plot. There’s a little too much happening in the film’s violent, frenetic conclusion, which involves the retrieval of fractured memories, the confession of betrayals and so many narrative loops within loops that the film’s big reveals never make perfect, deeply satisfying sense.

Maybe it’s not supposed to.

I came away wondering whether the headache I left the theater with was such a bad — or even unintentional — thing after all. In the end, Simon isn’t the only one who gets bashed on the head by “Trance.”

R. At area theaters. Contains violence and torture, obscenity, sex and nudity. 104 minutes.