Inversion Lookahead in Sorted Concatenation
Suppose that and are finite tuples sorted in ascending order and define . If and form an inversion then for every and form an inversion in
Before the proof starts note that has elements, and then refers to the element at position with respect to
We know that because they form an inversion, we also know that is sorted in ascending order, therefore we know that , therefore for each we know forms an inversion in as needed.
No Inversion Lookahead in Sorted Concatenation
Suppose that and are finite tuples sorted in ascending order and define . If and do not form an inversion then for every and do not form an inversion in
Since and do not form an inversion then we know that , since is sorted in ascending order then we know that , and thus for every we know and do not form an inversion.
\texttt{counting_inversions}
ParseError: Expected 'EOF', got '_' at position 17:
…texttt{counting_̲inversions} is Correct
Given any list \texttt{counting_inversions}
ParseError: Expected 'EOF', got '_' at position 17:
…texttt{counting_̲inversions} returns the number of inversions in