# Order theory: why isless is strict / issubset is loose by default?

**URL:** <https://discourse.julialang.org/t/order-theory-why-isless-is-strict-issubset-is-loose-by-default/20180>\
**Category:** General Usage\
**Created:** [January 28, 2019, 2:24pm UTC](https://discourse.julialang.org/t/order-theory-why-isless-is-strict-issubset-is-loose-by-default/20180 "2019-01-28T14:24:39Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![o314](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/o314/32/252_2.png) [@o314](https://discourse.julialang.org/u/o314)\
**Post date:** [January 28, 2019, 2:24pm UTC](https://discourse.julialang.org/t/order-theory-why-isless-is-strict-issubset-is-loose-by-default/20180/1 "2019-01-28T14:24:39Z")

</div>

```nohighlight
julia> @test issubset([1,2],[1,2]) # loose order
Test Passed

julia> @test isless((1,2), (1,2)) == false # strict order
Test Passed

```

`isless` is defined in term of lexicographic order. scientific litterature (bender, williamson, arndt) is quite conservative about saying that implies the order is [strict](http://mathworld.wolfram.com/StrictOrder.html)

`issubset` does not test for proper subsetting.

Any rational about this?

Currently working on poset / lattice in Julia.  
sound foundation are appreciated.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 28, 2019, 2:52pm UTC](https://discourse.julialang.org/t/order-theory-why-isless-is-strict-issubset-is-loose-by-default/20180/2 "2019-01-28T14:52:37Z")

</div>

If you have an a \preceq b relation, you can easily get a \prec b = (a \preceq b) \wedge \neg(b \preceq a) (and vice versa), so they are equivalent in functionality. Some texts prefers one, some the other, neither is superior to the other.

Cf `Base.cmp` if you want to economize on computation.

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [January 28, 2019, 4:12pm UTC](https://discourse.julialang.org/t/order-theory-why-isless-is-strict-issubset-is-loose-by-default/20180/3 "2019-01-28T16:12:52Z")

</div>

They are named consistently with the meanings of the words:

- `issubet(a, b)` tests whether `a` is a subset of `b`
- `isless(a, b)` tests whether `a` is less than `b`

The word `subset` does not entail strictness, the word `less` does entail strictness.

---

<div class="post-metadata">

**Author:** ![o314](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/o314/32/252_2.png) [@o314](https://discourse.julialang.org/u/o314)\
**Post date:** [January 28, 2019, 5:07pm UTC](https://discourse.julialang.org/t/order-theory-why-isless-is-strict-issubset-is-loose-by-default/20180/4 "2019-01-28T17:07:01Z")

</div>

> equivalent in functionality

Not true. you have two ops. you build a third.  
first and third are equivalents. not the same of saying two first are.  
With graph, lattice, structure can become heavy at some points.  
Adding another indirection/level of storage can be tricky.  
fine, if it can be avoided,

> They are named consistently with the meanings of the words:

a bit tautological. so let’s say it’s some common way.

Without clear defs/perimeters/consensus, problems may appear when you have to deeply chain computing, for example when computing type lattice, even function type lattice and work to get precise result. example more precise than `repr(typeof(isless)) == "typeof(isless)")`.

Anyway, definitively not a priority question at this point

---

<div class="post-metadata">

**Author:** ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)\
**Post date:** [January 28, 2019, 6:08pm UTC](https://discourse.julialang.org/t/order-theory-why-isless-is-strict-issubset-is-loose-by-default/20180/5 "2019-01-28T18:08:47Z")

</div>

I’m just basing this on standard dictionary definitions of these words:

- [Subset - Wikipedia](https://en.wikipedia.org/wiki/Subset)
- [Less-than sign - Wikipedia](https://en.wikipedia.org/wiki/Less-than_sign)

The word “subset” is non-strict in its most common meaning while “less than” is strict in its most common meaning. If you want to have non-strict version of `isless` you can define one; if you want a strict version of `issubset` you can also define one.

---

<div class="post-metadata">

**Author:** ![o314](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/o314/32/252_2.png) [@o314](https://discourse.julialang.org/u/o314)\
**Post date:** [January 28, 2019, 10:55pm UTC](https://discourse.julialang.org/t/order-theory-why-isless-is-strict-issubset-is-loose-by-default/20180/6 "2019-01-28T22:55:49Z")

</div>

> [@StefanKarpinski](#):
>
> …

Thanks for taking time to answer.
