# On sorting non-ground terms and the standard order of terms

**URL:** <https://swi-prolog.discourse.group/t/on-sorting-non-ground-terms-and-the-standard-order-of-terms/1668>\
**Category:** General\
**Created:** [December 27, 2019, 11:57am UTC](https://swi-prolog.discourse.group/t/on-sorting-non-ground-terms-and-the-standard-order-of-terms/1668 "2019-12-27T11:57:23Z")\
**Posts on this page:** 1\
**Showing post:** 17

<div class="post-metadata">

**Author:** ![EricGT](https://avatars.discourse-cdn.com/v4/letter/e/f1d935/32.png) [@EricGT](https://swi-prolog.discourse.group/u/EricGT)\
**Post date:** [December 30, 2019, 2:43pm UTC](https://swi-prolog.discourse.group/t/on-sorting-non-ground-terms-and-the-standard-order-of-terms/1668/17 "2019-12-30T14:43:32Z")

</div>

> [@stassa.p](#):
>
> So my problem is what to do with a list that represents the elements of a set  
> and that may include terms that unify (so they are “alphabetic variants”).

I don’t know if you read further in the Wikipedia article on [Unification](https://en.wikipedia.org/wiki/Unification_(computer_science)#A_unification_algorithm), but they have a section [Order-sorted unification](https://en.wikipedia.org/wiki/Unification_(computer_science)#Order-sorted_unification) which looks a lot like your problem and links to [Many-sorted logic](https://en.wikipedia.org/wiki/Many-sorted_logic#Order-sorted_logic).

However the reason I am noting this is that IIRC one of the proof systems has the concept of a **sort** built-in, but I can not find which one. I never really understood why they called the concept **sort** even though they explained it, but in reading about your problem it makes more sense.

> [@stassa.p](#):
>
> My instinct is to treat those as “equal” for the purposes of sorting

Perhaps the examples in [Many-sorted logic](https://en.wikipedia.org/wiki/Many-sorted_logic#Order-sorted_logic) could serve as test cases.

---

_[View the full topic](https://swi-prolog.discourse.group/t/on-sorting-non-ground-terms-and-the-standard-order-of-terms/1668)._
