  We present a full high resolution SPIRE FTS spectrum of the nearby
ultraluminous infrared galaxy Mrk231. In total 25 lines are detected, including
CO J=5-4 through J=13-12, 7 rotational lines of H2O, 3 of OH+ and one line each
of H2O+, CH+, and HF. We find that the excitation of the CO rotational levels
up to J=8 can be accounted for by UV radiation from star formation. However,
the approximately flat luminosity distribution of the CO lines over the
rotational ladder above J=8 requires the presence of a separate source of
excitation for the highest CO lines. We explore X-ray heating by the accreting
supermassive black hole in Mrk231 as a source of excitation for these lines,
and find that it can reproduce the observed luminosities. We also consider a
model with dense gas in a strong UV radiation field to produce the highest CO
lines, but find that this model strongly overpredicts the hot dust mass in
Mrk231. Our favoured model consists of a star forming disk of radius 560 pc,
containing clumps of dense gas exposed to strong UV radiation, dominating the
emission of CO lines up to J=8. X-rays from the accreting supermassive black
hole in Mrk231 dominate the excitation and chemistry of the inner disk out to a
radius of 160 pc, consistent with the X-ray power of the AGN in Mrk231. The
extraordinary luminosity of the OH+ and H2O+ lines reveals the signature of
X-ray driven excitation and chemistry in this region.
