News for hackers. Stuff that matters.
Re:Things I would like to see in a computer algebra system by colanderman on Thursday April 21, 2022 @03:07PM (#31113889)
> For example, 6 has an additive inverse in ℤ but not in ℕ [...] (this is the reason why int often makes more sense than unsigned int in C, even when you have an unsigned value)

`unsigned int` isn't actually ℕ though, it's ℤ∕nℤ [1], i.e., the integers modulo n, which does have an additive inverse of 6 (being n−6).

The reason `int` often makes more sense is because it's a useful property that the additive inverse of 6 actually be less than 6 -- or more generally, that `int` isn't modular.

Agree with the overall point though, that 6 is an element of many "types". Of the CAS-adjacent languages I'm experienced with, TLA+ gets this right; SMTLIBv2 does not.

[1] https://en.wikipedia.org/wiki/Modular_arithmetic#Integers_mo...

Re:Things I would like to see in a computer algebra system by zozbot234 on Thursday April 21, 2022 @03:46PM (#31114330)
I don't think modulo arithmetic per se includes any notion of "less". Typical definitions of "order" for an algebraic structure would require the order to be translation invariant, which isn't true in modulo arithmetic.
Re:Things I would like to see in a computer algebra system by colanderman on Sunday April 24, 2022 @07:47PM (#31149337)
Fair point! I mean "less" in the same sense that "less" is defined for unsigned/modular arithmetic in most languages (e.g. C).
Re:Things I would like to see in a computer algebra system by StopDarkPattern on Thursday April 21, 2022 @10:55PM (#31117710)
Wow, look at hackernews getting relevant again. nice work. great post.