I get how that works for arithmetic operations - what about stuff like sorting, finding an element in a set etc? This would require knowledge of the cleartext data, wouldn't it?
Comparisons can be implemented by approximating a < b with
0.5 * (sign(a - b) + 1)
And the sign function can be approximated by a polynomial that uses only additions and multiplications and products with constants.Other FHE schemes have support for small-bitwidth lookup tables that makes supporting comparison more direct.
You can reduce anything happening on the computer to arithmetic operations. If you can do additions and multiplications, then it's turing complete. All others can be constructed from them.