in reply to Re: Illegal Modulus zero
in thread Illegal Modulus zero

technically, you'd need some restriction on your z, otherwise z + y is just as good a solution, for n = n - 1. And besides, why would you ever want to look at things mod 0? - if it ever happens, it's probably an error, so might as well report it.

Also, how do you define the restriction for other additive groups? For vectors you could look at the norm - but that's a consequence of the very very natural and useful multiplication between vectors, ie dot product...

Replies are listed 'Best First'.
Re^3: Illegal Modulus zero
by ambrus (Abbot) on May 21, 2005 at 07:39 UTC

    The restriction in other rings is indeed that z = x % y such that (norm(z) < y -- Update: corrected error spotted by ivancho) norm(z) < norm(y). Of course, you have some freedom in how you define the norm.

    The point is that, if you can define modulus and a norm in such a way, then the ring is a principial ideal ring, and thus, a UFD. (The proof goes this way: norm and remainder => gcd => all ideals are principial => every irreducible elements are prime => unique factorisation.) This is one of the most common proofs you can prove the Fundamental Theorem of arithmetic, that is, the fact that every integer can be decomposed to the product of primes.

    #ifdef MATHMONKS
    #endif
      oooh, heavyweight maths, delicious.. ++

      just want to point out a couple of things - first, a minor ommission, at the top you want norm(z) < norm(y)
      second, I was commenting on the impossibility to define that for general groups - looking at the cyclic group generated by y and its coset generated by x, there's no obvious element to be called 'the remainder'. When you go to rings, things are different, indeed.

      my algebra is a little rusty by now, but I think you need your principal ideal ring to be an integral domain as well, before you get UFD ( ie, no Z_6 and the like ), this relating to your second paragraph.. Looking further down, I see that you talk about domains only, so fair enough, and we don't want to look at ugly non-domain PIRs anyway..

      I think the issue with multivariate polynomials is that they are UFDs, but definitely not PIDs ( e.g. <x,y^2> ), but in any case, now I'm just getting depressed realizing how much I've forgotten, so I'll drop it here, and go back to my leaking recursive closures...

        Thanks for spotting the error.

        As for integral domain, I think you are right. However, let me note that a norm on the ring implies that there are no zero-divisors.