15
3
A field in mathematics is a set of numbers, with addition and multiplication operations defined on it, such that they satisfy certain axioms (described in Wikipedia; see also below).
A finite field can have pn elements, where p is a prime number, and n is a natural number. In this challenge, let's take p = 2 and n = 8, so let's make a field with 256 elements.
The elements of the field should be consecutive integers in a range that contains 0 and 1:
- -128 ... 127
- 0 ... 255
- or any other such range
Define two functions (or programs, if that is easier), a(x,y) for abstract "addition", and m(x,y) for abstract "multiplication", such that they satisfy the field axioms:
- Consistency:
a(x,y)andm(x,y)produce the same result when called with same arguments - Closedness: The result of
aandmis an integer in the relevant range - Associativity: for any
x,yandzin the range,a(a(x,y),z)is equal toa(x,a(y,z)); the same form - Commutativity: for any
xandyin the range,a(x,y)is equal toa(y,x); the same form - Distributivity: for any
x,yandzin the range,m(x,a(y,z))is equal toa(m(x,y),m(x,z)) - Neutral elements: for any
xin the range,a(0,x)is equal tox, andm(1,x)is equal tox - Negation: for any
xin the range, there exists suchythata(x,y)is0 - Inverse: for any
x≠0in the range, there exists suchythatm(x,y)is1
The names a and m are just examples; you can use other names, or unnamed functions. The score of your answer is the sum of byte-lengths for a and m.
If you use a built-in function, please also describe in words which result it produces (e.g. provide a multiplication table).
3@LeakyNun "addition" is just an abstract operation here that satisfies the above properties. There is no need for
a(2,1) = 3, you could havea(2,1) = 5as long as the above axioms are satisfied.adoesn't have to do anything with the usual addition you're used to e.g. from the field of rational numbers. – Martin Ender – 2016-06-14T07:41:02.5032A commutative ring is trivial. A field... not so easy. – Neil – 2016-06-14T07:50:18.913
Is there anything wrong with
a=+m=×? – Adám – 2016-06-14T08:01:27.6474@Adám Yes - 2 wouldn't have an inverse if
m=×– Sp3000 – 2016-06-14T08:02:08.2802Related – Peter Taylor – 2016-06-14T09:48:08.837
I am eagerly waiting for an INTERCAL example. – Ross Presser – 2016-06-14T20:57:16.123