Compress a list that contains segments of continuous numbers to a list which contains list of range of segments [start,end]

FYI

I know your question is for subsequence removal but a similar compression is for run length encoding.

Note:

In case you didn’t know SWI-Prolog has the predicate clumped/2 that does RLE. (source code)