Minecraft wiki entry for Anvil_mechanics, associated text: Experience Cost = [Value of Sacrificed item - Thorns III + Feather Falling IV (16)] + [Work Penalty of Diamond Boots (Soul Speed III) (1)] + [Work Penalty of Thorns III + Feather Falling IV book (1)] = 18 Levels.
New Value of resulting item = [Value of Diamond Boots (Soul Speed III) (12)] + [Value of Thorns III + Feather Falling IV book (16)] = 28 Value.
Remember that the Work Penalty for each item here is a value of 1 because each has been used only once on the anvil previously.