Design a commutative injective function between any (restricted) infinite set and unordered pairs thereof Related, but this only requires positive integers and does not have to be commutative

The Cantor Pairing Function is described in this Wikipedia article. Essentially, it is an operation such that when it is applied to two values X and Y, one can obtain the original values X and Y given the result.

Your task is to design two functions: one which performs X, Y -&gt; Z and the other which performs Z -&gt; X, Y. Here's the catch: X, Y -&gt; Z must be commutative. This means that Z -&gt; X, Y won't be able to determine if the input was X, Y or Y, X.

The formal definition of this challenge would be:

Choose an countable infinite set S of numbers.
Design two functions that perform the following tasks:  


Given an unordered pair of values in S, return a value in S  
Given a return value from the initial function, return the unordered pair of values which evaluates to the input integer when passed through the first function. I don't care about the behaviour of this inverse function if the input isn't a return value from the first function.  


Requirements


The result should be identical between runs.  
{a, a} is an unordered pair


Note: your answer is more likely to get an upvote from me if you provide a proof, but I will test answers when I get to it and upvote it once I'm fairly sure it works.
Haskell, 65 + 30 = 95 bytes



a#b=length.fst$span(&lt;(max a b,min a b))[(a,b)|a&lt;-[1..],b&lt;-[1..a]]


Try it online!

([(a,b)|a&lt;-[1..],b&lt;-[1..a]]!!)


Try it online!



Note: When the two functions may share code, this is only 75 bytes:



(l!!)
a#b=length.fst$span(&lt;(max a b,min a b))l
l=[(a,b)|a&lt;-[1..],b&lt;-[1..a]]


Try it online! The domain is the positive integers. The function (#) performs the pairing, the function (l!!) its inverse. Usage example: Both (#) 5 3 and (#) 3 5 yield 12, and (l!!) 12 yields (5,3).

This works by explicitly listing all sorted pairs in an infinite list l:

l = [(1,1),(2,1),(2,2),(3,1),(3,2),(3,3),(4,1),(4,2),(4,3),(4,4),(5,1),(5,2),(5,3),(5,4),(5,5),(6,1), ...`


The encoding is then just the index in this list.